bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Subject: gnulib-tool.py: Sort file lists case-sensitively
Date: Sat, 20 Apr 2024 23:05:56 +0200	[thread overview]
Message-ID: <6113379.oCs69inPJz@nimes> (raw)

When computing the list of old and new file, gnulib-tool.sh sorts them in
ASCII order, i.e. case-sensitively. (gnulib.tool.sh lines 5507 and 5513.)
gnulib-tool.py needs to be consistent with that.


2024-04-20  Bruno Haible  <bruno@clisp.org>

	gnulib-tool.py: Sort file lists case-sensitively.
	* pygnulib/GLImport.py (GLImport.prepare, GLImport.execute): Omit
	.lower() call in sort key computation.

diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index b38808a353..e65e3e1235 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -943,11 +943,14 @@ def prepare(self) -> tuple[dict[str, list[str]], dict[str, str]]:
 
         # Prepare basic filelist and basic old_files/new_files variables.
         filelist = sorted(set(filelist))
+        # Add m4/gnulib-tool.m4 to the file list. It is not part of any module.
         new_files = filelist + ['m4/gnulib-tool.m4']
         old_files = list(self.cache['files'])
         path = joinpath(destdir, m4base, 'gnulib-tool.m4')
         if isfile(path):
             old_files.append(joinpath('m4', 'gnulib-tool.m4'))
+        # old_files is the list of files according to the last gnulib-tool invocation.
+        # new_files is the list of files after this gnulib-tool invocation.
 
         # Construct tables and transformers.
         transformers = dict()
@@ -965,14 +968,18 @@ def prepare(self) -> tuple[dict[str, list[str]], dict[str, str]]:
             new_table.append(tuple([dest, src]))
         old_table = sorted(set(old_table))
         new_table = sorted(set(new_table))
+        # old_table is a table with two columns: (rewritten-file-name original-file-name),
+        # representing the files according to the last gnulib-tool invocation.
+        # new_table is a table with two columns: (rewritten-file-name original-file-name),
+        # representing the files after this gnulib-tool invocation.
 
         # Prepare the filetable.
         filetable = dict()
         filetable['all'] = sorted(set(filelist))
         filetable['old'] = \
-            sorted(set(old_table), key=lambda t: tuple(t[0].lower()))
+            sorted(set(old_table), key=lambda pair: pair[0])
         filetable['new'] = \
-            sorted(set(new_table), key=lambda t: tuple(t[0].lower()))
+            sorted(set(new_table), key=lambda pair: pair[0])
         filetable['added'] = []
         filetable['removed'] = []
 
@@ -1046,7 +1053,7 @@ def execute(self, filetable: dict[str, list[str]], transformers: dict[str, str])
         pairs = [ f
                   for f in filetable['old']
                   if f not in filetable['new'] ]
-        pairs = sorted(set(pairs), key=lambda t: tuple(t[0].lower()))
+        pairs = sorted(set(pairs), key=lambda pair: pair[0])
         files = sorted(set(pair[0] for pair in pairs))
         for file in files:
             path = joinpath(destdir, file)





                 reply	other threads:[~2024-04-20 21:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=6113379.oCs69inPJz@nimes \
    --to=bruno@clisp.org \
    --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).