Merge branch 'revert-02a19c6d' into 'master'

Revert "Merge branch 'feature/build_color_output' into 'master'"

See merge request espressif/esp-idf!19852
This commit is contained in:
Roland Dobai 2022-08-30 16:05:51 +08:00
commit 61860832ac
4 changed files with 41 additions and 45 deletions

View File

@ -344,12 +344,6 @@ macro(project project_name)
# Generate compile_commands.json (needs to come after project call). # Generate compile_commands.json (needs to come after project call).
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# If CMAKE_COLOR_DIAGNOSTICS not set in project CMakeLists.txt or in the environment,
# enable it by default.
if(NOT DEFINED CMAKE_COLOR_DIAGNOSTICS AND NOT DEFINED ENV{CMAKE_COLOR_DIAGNOSTICS})
set(CMAKE_COLOR_DIAGNOSTICS ON)
endif()
# Since components can import third-party libraries, the original definition of project() should be restored # Since components can import third-party libraries, the original definition of project() should be restored
# before the call to add components to the build. # before the call to add components to the build.
function(project) function(project)

View File

@ -12,6 +12,7 @@ GENERATORS: Dict[str, Union[str, Dict, list]] = collections.OrderedDict([
# - dry_run: command to run in dry run mode # - dry_run: command to run in dry run mode
# - verbose_flag: verbose flag # - verbose_flag: verbose flag
# - force_progression: one liner status of the progress # - force_progression: one liner status of the progress
# - envvar: environment variables
('Ninja', { ('Ninja', {
'command': ['ninja'], 'command': ['ninja'],
'version': ['ninja', '--version'], 'version': ['ninja', '--version'],
@ -19,6 +20,7 @@ GENERATORS: Dict[str, Union[str, Dict, list]] = collections.OrderedDict([
'verbose_flag': '-v', 'verbose_flag': '-v',
# as opposed to printing the status updates each in a in new line # as opposed to printing the status updates each in a in new line
'force_progression': True, 'force_progression': True,
'envvar': {}
}), }),
]) ])
@ -28,7 +30,9 @@ if os.name != 'nt':
'version': [MAKE_CMD, '--version'], 'version': [MAKE_CMD, '--version'],
'dry_run': [MAKE_CMD, '-n'], 'dry_run': [MAKE_CMD, '-n'],
'verbose_flag': 'VERBOSE=1', 'verbose_flag': 'VERBOSE=1',
'force_progression': False} 'force_progression': False,
# CLICOLOR_FORCE if set forcing make to print ANSI escape sequence
'envvar': {'CLICOLOR_FORCE': '1'}}
URL_TO_DOC = 'https://docs.espressif.com/projects/esp-idf' URL_TO_DOC = 'https://docs.espressif.com/projects/esp-idf'

View File

@ -233,6 +233,12 @@ class RunTool:
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])') ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
return ansi_escape.sub('', text) return ansi_escape.sub('', text)
def prepare_for_print(out: str) -> str:
if not output_stream.isatty():
# delete escape sequence if we printing in environments where ANSI coloring is disabled
return delete_ansi_escape(out)
return out
def print_progression(output: str) -> None: def print_progression(output: str) -> None:
# Print a new line on top of the previous line # Print a new line on top of the previous line
sys.stdout.write('\x1b[K') sys.stdout.write('\x1b[K')
@ -269,15 +275,8 @@ class RunTool:
output = await read_stream() output = await read_stream()
if not output: if not output:
break break
output_noescape = delete_ansi_escape(output) output = prepare_for_print(output)
# Always remove escape sequences when writing the build log. output_file.write(output)
output_file.write(output_noescape)
# If idf.py output is redirected and the output stream is not a TTY,
# strip the escape sequences as well.
# (There shouldn't be any, but just in case.)
if not output_stream.isatty():
output = output_noescape
if self.force_progression and output[0] == '[' and '-v' not in self.args and output_stream.isatty(): if self.force_progression and output[0] == '[' and '-v' not in self.args and output_stream.isatty():
# print output in progression way but only the progression related (that started with '[') and if verbose flag is not set # print output in progression way but only the progression related (that started with '[') and if verbose flag is not set
print_progression(output) print_progression(output)
@ -301,17 +300,11 @@ def run_target(target_name: str, args: 'PropertyDict', env: Optional[Dict]=None,
env = {} env = {}
generator_cmd = GENERATORS[args.generator]['command'] generator_cmd = GENERATORS[args.generator]['command']
env.update(GENERATORS[args.generator]['envvar'])
if args.verbose: if args.verbose:
generator_cmd += [GENERATORS[args.generator]['verbose_flag']] generator_cmd += [GENERATORS[args.generator]['verbose_flag']]
# By default, GNU Make and Ninja strip away color escape sequences when they see that their stdout is redirected.
# If idf.py's stdout is not redirected, the final output is a TTY, so we can tell Make/Ninja to disable stripping
# of color escape sequences. (Requires Ninja v1.9.0 or later.)
if sys.stdout.isatty():
if 'CLICOLOR_FORCE' not in env:
env['CLICOLOR_FORCE'] = '1'
RunTool(generator_cmd[0], generator_cmd + [target_name], args.build_dir, env, custom_error_handler, hints=not args.no_hints, RunTool(generator_cmd[0], generator_cmd + [target_name], args.build_dir, env, custom_error_handler, hints=not args.no_hints,
force_progression=force_progression, interactive=interactive)() force_progression=force_progression, interactive=interactive)()

View File

@ -689,42 +689,47 @@
"version_regex": "cmake version ([0-9.]+)", "version_regex": "cmake version ([0-9.]+)",
"versions": [ "versions": [
{ {
"linux-amd64": {
"sha256": "f3c654b2e226b9d43369e0bd8487c51618d4dbe5a1af929dd32af7e6ca432d60",
"size": 45998644,
"url": "https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-linux-x86_64.tar.gz"
},
"linux-arm64": { "linux-arm64": {
"sha256": "50c3b8e9d3a3cde850dd1ea143df9d1ae546cbc5e74dc6d223eefc1979189651", "sha256": "74062efddeb935bce3d33694a4db534cef9a650f77a9a153a9f217d9dc385c75",
"size": 48478082, "size": 47458032,
"url": "https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0-linux-aarch64.tar.gz" "url": "https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-linux-aarch64.tar.gz"
}, },
"linux-armel": { "linux-armel": {
"sha256": "7dc787ef968dfef92491a4f191b8739ff70f8a649608b811c7a737b52481beb0", "sha256": "aa6079237e16cc3b389479b2f7279d07e57f6aedad520e2b3014ef97fb906466",
"size": 19811327, "size": 19330381,
"url": "https://dl.espressif.com/dl/cmake/cmake-3.24.0-Linux-armv7l.tar.gz" "url": "https://dl.espressif.com/dl/cmake/cmake-3.23.1-Linux-armv7l.tar.gz"
}, },
"linux-armhf": { "linux-armhf": {
"sha256": "7dc787ef968dfef92491a4f191b8739ff70f8a649608b811c7a737b52481beb0", "sha256": "aa6079237e16cc3b389479b2f7279d07e57f6aedad520e2b3014ef97fb906466",
"size": 19811327, "size": 19330381,
"url": "https://dl.espressif.com/dl/cmake/cmake-3.24.0-Linux-armv7l.tar.gz" "url": "https://dl.espressif.com/dl/cmake/cmake-3.23.1-Linux-armv7l.tar.gz"
}, },
"macos": { "macos": {
"sha256": "3e0cca74a56d9027dabb845a5a26e42ef8e8b33beb1655d6a724187a345145e4", "sha256": "f794ed92ccb4e9b6619a77328f313497d7decf8fb7e047ba35a348b838e0e1e2",
"size": 72801419, "size": 70988516,
"url": "https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0-macos-universal.tar.gz" "url": "https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-macos-universal.tar.gz"
}, },
"macos-arm64": { "macos-arm64": {
"sha256": "3e0cca74a56d9027dabb845a5a26e42ef8e8b33beb1655d6a724187a345145e4", "sha256": "f794ed92ccb4e9b6619a77328f313497d7decf8fb7e047ba35a348b838e0e1e2",
"size": 72801419, "size": 70988516,
"url": "https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0-macos-universal.tar.gz" "url": "https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-macos-universal.tar.gz"
}, },
"name": "3.24.0", "name": "3.23.1",
"status": "recommended", "status": "recommended",
"win32": { "win32": {
"sha256": "b1ad8c2dbf0778e3efcc9fd61cd4a962e5c1af40aabdebee3d5074bcff2e103c", "sha256": "9b509cc4eb7191dc128cfa3f2170036f9cbc7d9d5f93ff7fafc5b2d77b3b40dc",
"size": 40212531, "size": 39070972,
"url": "https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0-windows-x86_64.zip" "url": "https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-windows-x86_64.zip"
}, },
"win64": { "win64": {
"sha256": "b1ad8c2dbf0778e3efcc9fd61cd4a962e5c1af40aabdebee3d5074bcff2e103c", "sha256": "9b509cc4eb7191dc128cfa3f2170036f9cbc7d9d5f93ff7fafc5b2d77b3b40dc",
"size": 40212531, "size": 39070972,
"url": "https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0-windows-x86_64.zip" "url": "https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-windows-x86_64.zip"
} }
}, },
{ {