diff options
author | Chris Laplante <chris.laplante@agilent.com> | 2025-01-07 16:54:02 -0500 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2025-01-24 07:59:38 -0800 |
commit | c1ed07ecde3eea6dee3f7f0c7862ca85858e840d (patch) | |
tree | 7641434c0e4eaf001544925ed7668b4b1a4d60d8 /bitbake | |
parent | 50556a287872673027e8100604d0ec0944b6d15a (diff) | |
download | poky-c1ed07ecde3eea6dee3f7f0c7862ca85858e840d.tar.gz |
bitbake: ui/knotty: respect NO_COLOR & check for tty; rename print_hyperlink => format_hyperlink
(Bitbake rev: 72a334d5d5763476d5421a902fabb303f3f84bd8)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
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.", |