1#!/usr/bin/env python 2# 3# Copyright 2019 Espressif Systems (Shanghai) PTE LTD 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17from __future__ import print_function 18 19import os 20import sys 21 22if __name__ == '__main__': 23 # Checks for the content of environment variable TERM to use with the Python- and curses-based menuconfig. It is 24 # not implemented in shell so calling this script could not use some other shell environment where TERM is set 25 # differently. Implemented here so it could be checked at one place for make and cmake as well. 26 if sys.platform == 'win32' and 'MSYSTEM' not in os.environ: 27 # no TERM is used in Windows command line 28 exit(0) 29 30 term = os.environ.get('TERM', None) 31 32 if term is None: 33 print('WARNING: The TERM environment variable is not defined. The curses-based menuconfig ' 34 'will probably fail to run. Please consult the documentation of your terminal to set it up.') 35 else: 36 if term.endswith('256color'): 37 print('TERM environment variable is set to "{}"'.format(term)) 38 else: 39 print('WARNING: Menuconfig may fail because of the TERM environment variable is set ' 40 'to "{}". Please consult the documentation of your terminal to set it up. ' 41 'Some good, proved to been working setups include xterm-256color, screen-256color, ' 42 'rxvt-unicode-256color.'.format(term)) 43