bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Collin Funk <collin.funk1@gmail.com>
To: bug-gnulib@gnu.org
Subject: gnulib-tool.py: Display specified modules in bold.
Date: Fri, 29 Mar 2024 06:12:02 -0700	[thread overview]
Message-ID: <48bf998c-d21c-49f3-b635-17aa0bf494a7@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 102 bytes --]

I noticed that the bold printing was missing. One of the most important
changes I've made yet.

Collin

[-- Attachment #2: 0001-gnulib-tool.py-Display-specified-modules-in-bold.patch --]
[-- Type: text/x-patch, Size: 2740 bytes --]

From 95e3bf4e2d912ffc87889c72cff7119523bf081b Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.funk1@gmail.com>
Date: Fri, 29 Mar 2024 06:09:20 -0700
Subject: [PATCH] gnulib-tool.py: Display specified modules in bold.

* pygnulib/GLImport.py (GLImport.prepare): Detect terminals starting
with 'xterm'. Change hexadecimal numbers to octal, matching
gnulib-tool.sh.
* pygnulib/GLTestDir.py (GLTestDir.execute): Likewise.
---
 ChangeLog             | 8 ++++++++
 pygnulib/GLImport.py  | 8 ++++----
 pygnulib/GLTestDir.py | 8 ++++----
 3 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 84a33eecb7..c6ac9f13a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-03-29  Collin Funk  <collin.funk1@gmail.com>
+
+	gnulib-tool.py: Display specified modules in bold.
+	* pygnulib/GLImport.py (GLImport.prepare): Detect terminals starting
+	with 'xterm'. Change hexadecimal numbers to octal, matching
+	gnulib-tool.sh.
+	* pygnulib/GLTestDir.py (GLTestDir.execute): Likewise.
+
 2024-03-29  Bruno Haible  <bruno@clisp.org>
 
 	gnulib-tool.py: Don't print Makefile.am edits that are already done.
diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index afe751dbd3..84e1c08689 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -849,10 +849,10 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
         if verbose >= 0:
             bold_on = ''
             bold_off = ''
-            term = os.getenv('TERM')
-            if term == 'xterm':
-                bold_on = '\x1b[1m'
-                bold_off = '\x1b[0m'
+            term = os.getenv('TERM', '')
+            if term.startswith('xterm') and os.isatty(1):
+                bold_on = '\033[1m'
+                bold_off = '\033[0m'
             print('Module list with included dependencies (indented):')
             for module in final_modules:
                 if str(module) in self.config.getModules():
diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py
index 57fbef7b06..e395090b83 100644
--- a/pygnulib/GLTestDir.py
+++ b/pygnulib/GLTestDir.py
@@ -260,10 +260,10 @@ class GLTestDir(object):
         if verbose >= 0:
             bold_on = ''
             bold_off = ''
-            term = os.getenv('TERM')
-            if term == 'xterm':
-                bold_on = '\x1b[1m'
-                bold_off = '\x1b[0m'
+            term = os.getenv('TERM', '')
+            if term.startswith('xterm') and os.isatty(1):
+                bold_on = '\033[1m'
+                bold_off = '\033[0m'
             print('Module list with included dependencies (indented):')
             specified_modules_set = { str(module)
                                       for module in specified_modules }
-- 
2.44.0


             reply	other threads:[~2024-03-29 13:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-29 13:12 Collin Funk [this message]
2024-03-29 13:34 ` gnulib-tool.py: Display specified modules in bold Pádraig Brady
2024-03-29 14:44   ` Bruno Haible
2024-03-29 21:59     ` Bruno Haible
2024-03-30 11:38       ` Pádraig Brady
2024-03-30 23:38         ` Bruno Haible
2024-03-31 11:00           ` Pádraig Brady
2024-03-30  0:22   ` Collin Funk
2024-03-29 14:13 ` Bruno Haible

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48bf998c-d21c-49f3-b635-17aa0bf494a7@gmail.com \
    --to=collin.funk1@gmail.com \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).