diff options
author | Chris Laplante <chris.laplante@agilent.com> | 2024-08-19 10:36:13 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-08-23 09:48:48 +0100 |
commit | 18b37cc518b6fbb1a157b1afe84607313467aea2 (patch) | |
tree | 40a8a486e480504365a3b7d26886b47a923b64ea /bitbake | |
parent | ad2365a3df5f516336767758acd2d97bc23fe3a2 (diff) | |
download | poky-18b37cc518b6fbb1a157b1afe84607313467aea2.tar.gz |
bitbake: ui/knotty: respect NO_COLOR & check for tty; rename print_hyperlink => format_hyperlink
(Bitbake rev: 3f6de25a8a4d73dfba864aa6a543c5eafa9b7c7c)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 5956ab177c..3784c93ad8 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
@@ -577,6 +577,8 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
577 | else: | 577 | else: |
578 | log_exec_tty = False | 578 | log_exec_tty = False |
579 | 579 | ||
580 | should_print_hyperlinks = sys.stdout.isatty() and os.environ.get('NO_COLOR', '') == '' | ||
581 | |||
580 | helper = uihelper.BBUIHelper() | 582 | helper = uihelper.BBUIHelper() |
581 | 583 | ||
582 | # Look for the specially designated handlers which need to be passed to the | 584 | # Look for the specially designated handlers which need to be passed to the |
@@ -944,10 +946,12 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
944 | try: | 946 | try: |
945 | termfilter.clearFooter() | 947 | termfilter.clearFooter() |
946 | summary = "" | 948 | summary = "" |
947 | def print_hyperlink(url, link_text): | 949 | def format_hyperlink(url, link_text): |
948 | start = f'\033]8;;{url}\033\\' | 950 | if should_print_hyperlinks: |
949 | end = '\033]8;;\033\\' | 951 | start = f'\033]8;;{url}\033\\' |
950 | return f'{start}{link_text}{end}' | 952 | end = '\033]8;;\033\\' |
953 | return f'{start}{link_text}{end}' | ||
954 | return link_text | ||
951 | 955 | ||
952 | if taskfailures: | 956 | if taskfailures: |
953 | summary += pluralise("\nSummary: %s task failed:", | 957 | summary += pluralise("\nSummary: %s task failed:", |
@@ -955,7 +959,7 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
955 | for (failure, log_file) in taskfailures.items(): | 959 | for (failure, log_file) in taskfailures.items(): |
956 | summary += "\n %s" % failure | 960 | summary += "\n %s" % failure |
957 | if log_file: | 961 | if log_file: |
958 | hyperlink = print_hyperlink(f"file://{log_file}", log_file) | 962 | hyperlink = format_hyperlink(f"file://{log_file}", log_file) |
959 | summary += "\n log: {}".format(hyperlink) | 963 | summary += "\n log: {}".format(hyperlink) |
960 | if warnings: | 964 | if warnings: |
961 | summary += pluralise("\nSummary: There was %s WARNING message.", | 965 | summary += pluralise("\nSummary: There was %s WARNING message.", |