Give info and warnings about the TERM environment variable
This commit is contained in:
parent
f9335a1785
commit
d1541c74a6
3 changed files with 50 additions and 1 deletions
|
@ -107,6 +107,12 @@ else
|
||||||
MENUCONFIG_CMD := $(PYTHON) $(IDF_PATH)/tools/kconfig_new/menuconfig.py
|
MENUCONFIG_CMD := $(PYTHON) $(IDF_PATH)/tools/kconfig_new/menuconfig.py
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
.PHONY: term_check
|
||||||
|
term_check:
|
||||||
|
ifneq ($(OS),Windows_NT)
|
||||||
|
${PYTHON} ${IDF_PATH}/tools/check_term.py
|
||||||
|
endif
|
||||||
|
|
||||||
# macro for running menuconfig
|
# macro for running menuconfig
|
||||||
define RunMenuConf
|
define RunMenuConf
|
||||||
mkdir -p $(BUILD_DIR_BASE)/include/config
|
mkdir -p $(BUILD_DIR_BASE)/include/config
|
||||||
|
@ -130,7 +136,7 @@ ifndef MAKE_RESTARTS
|
||||||
# depend on any prerequisite that may cause a make restart as part of
|
# depend on any prerequisite that may cause a make restart as part of
|
||||||
# the prerequisite's own recipe.
|
# the prerequisite's own recipe.
|
||||||
|
|
||||||
menuconfig: $(KCONFIG_TOOL_DIR)/mconf-idf | check_python_dependencies prepare_kconfig_files
|
menuconfig: $(KCONFIG_TOOL_DIR)/mconf-idf | check_python_dependencies term_check prepare_kconfig_files
|
||||||
$(summary) MENUCONFIG
|
$(summary) MENUCONFIG
|
||||||
ifdef BATCH_BUILD
|
ifdef BATCH_BUILD
|
||||||
@echo "Can't run interactive configuration inside non-interactive build process."
|
@echo "Can't run interactive configuration inside non-interactive build process."
|
||||||
|
|
41
tools/check_term.py
Normal file
41
tools/check_term.py
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
#
|
||||||
|
# Copyright 2019 Espressif Systems (Shanghai) PTE LTD
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
# Checks for the content of environment variable TERM to use with the Python- and curses-based menuconfig. It is
|
||||||
|
# not implemented in shell so calling this script could not use some other shell environment where TERM is set
|
||||||
|
# differently. Implemented here so it could be checked at one place for make and cmake as well.
|
||||||
|
if sys.platform == 'win32' and 'MSYSTEM' not in os.environ:
|
||||||
|
# no TERM is used in Windows command line
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
term = os.environ.get('TERM', None)
|
||||||
|
|
||||||
|
if term is None:
|
||||||
|
print('WARNING: The TERM environment variable is not defined. The curses-based menuconfig '
|
||||||
|
'will probably fail to run. Please consult the documentation of your terminal to set it up.')
|
||||||
|
else:
|
||||||
|
if term.endswith('256color'):
|
||||||
|
print('TERM environment variable is set to "{}"'.format(term))
|
||||||
|
else:
|
||||||
|
print('WARNING: Menuconfig may fail because of the TERM environment variable is set '
|
||||||
|
'to "{}". Please consult the documentation of your terminal to set it up. '
|
||||||
|
'Some good, proved to been working setups include xterm-256color, screen-256color, '
|
||||||
|
'rxvt-unicode-256color.'.format(term))
|
|
@ -256,6 +256,7 @@ function(__kconfig_generate_config sdkconfig sdkconfig_defaults)
|
||||||
set(MENUCONFIG_CMD ${mconf})
|
set(MENUCONFIG_CMD ${mconf})
|
||||||
else()
|
else()
|
||||||
set(MENUCONFIG_CMD ${python} ${idf_path}/tools/kconfig_new/menuconfig.py)
|
set(MENUCONFIG_CMD ${python} ${idf_path}/tools/kconfig_new/menuconfig.py)
|
||||||
|
set(TERM_CHECK_CMD ${python} ${idf_path}/tools/check_term.py)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Generate the menuconfig target
|
# Generate the menuconfig target
|
||||||
|
@ -267,6 +268,7 @@ function(__kconfig_generate_config sdkconfig sdkconfig_defaults)
|
||||||
--env "IDF_TARGET=${idf_target}"
|
--env "IDF_TARGET=${idf_target}"
|
||||||
--dont-write-deprecated
|
--dont-write-deprecated
|
||||||
--output config ${sdkconfig}
|
--output config ${sdkconfig}
|
||||||
|
COMMAND ${TERM_CHECK_CMD}
|
||||||
COMMAND ${CMAKE_COMMAND} -E env
|
COMMAND ${CMAKE_COMMAND} -E env
|
||||||
"COMPONENT_KCONFIGS_SOURCE_FILE=${kconfigs_path}"
|
"COMPONENT_KCONFIGS_SOURCE_FILE=${kconfigs_path}"
|
||||||
"COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE=${kconfigs_projbuild_path}"
|
"COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE=${kconfigs_projbuild_path}"
|
||||||
|
|
Loading…
Reference in a new issue