bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Collin Funk <collin.funk1@gmail.com>
To: Bruno Haible <bruno@clisp.org>, bug-gnulib@gnu.org
Subject: Re: gnulib-tool.py: Follow gnulib-tool changes, part 28.
Date: Wed, 28 Feb 2024 03:51:52 -0800	[thread overview]
Message-ID: <02828a71-3d97-4452-94e0-1d1b4a3cf651@gmail.com> (raw)
In-Reply-To: <6010822.iZASKD2KPV@nimes>

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

On 2/26/24 12:51 PM, Bruno Haible wrote:
> Well, GLConfig applies to all modes (not just 'import', but also
> 'create-testdir' etc.). Since on the bash side, you found that the
> sorting is specifically in the func_import(), the right place to do it
> is in GLImport.py, not GLConfig.py.

I think that this patch should be correct. The sorting of modules is
done only for mode == 'import' in GLImport.__init__. Looking at the
path from main, this would make the sorting happen right before
performing the transitive closure, like gnulib-tool.

Also this comment from gnulib-tool:
    # In 'import' mode, the new set of specified modules overrides the cached
    # set of modules. Ignore the cached settings.

So we only care about self.config.getModules().

I've also removed the sorted() calls in actioncmd. The sorting in
__init__ works correctly so gnulib-tool and gnulib-tool.py output the
same actioncmd (at least with Emac's merge-gnulib). Let me know if I
missed anything.

Collin

[-- Attachment #2: 0001-gnulib-tool.py-Make-module-sorting-more-similar-to-g.patch --]
[-- Type: text/x-patch, Size: 2279 bytes --]

From 3a7cbd5c95b2d24341865bf101fe8b1a93f83737 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.funk1@gmail.com>
Date: Wed, 28 Feb 2024 03:33:15 -0800
Subject: [PATCH] gnulib-tool.py: Make module sorting more similar to
 gnulib-tool.

* pygnulib/GLImport.py (GLImport.__init__): Sort modules when mode is
'import'.
(GLImport.actioncmd): Don't sort modules while creating actioncmd. Use
preferred quoting style.
---
 ChangeLog            | 8 ++++++++
 pygnulib/GLImport.py | 8 +++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 330727e02e..8cfe498940 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-02-28  Collin Funk  <collin.funk1@gmail.com>
+
+	gnulib-tool.py: Make module sorting more similar to gnulib-tool.
+	* pygnulib/GLImport.py (GLImport.__init__): Sort modules when mode is
+	'import'.
+	(GLImport.actioncmd): Don't sort modules while creating actioncmd. Use
+	preferred quoting style.
+
 2024-02-28  Bruno Haible  <bruno@clisp.org>
 
 	gnulib-tool: Make --version output independent of git's configuration.
diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index 0f0f463add..fca2333ec5 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -221,7 +221,9 @@ class GLImport(object):
                               for localdir in self.cache['localpath'] ]
                 self.config.setLocalPath(localpath)
 
-        if self.mode != MODES['import']:
+        if self.mode == MODES['import']:
+            self.config.setModules(sorted(self.config.getModules()))
+        else:
             if self.cache['m4base'] and (self.config['m4base'] != self.cache['m4base']):
                 raise GLError(5, m4base)
 
@@ -438,9 +440,9 @@ class GLImport(object):
         elif vc_files == False:
             actioncmd += ' \\\n#  --no-vc-files'
         if len(avoids) > 0:
-            actioncmd += ''.join([f" \\\n#  --avoid={x}" for x in sorted(avoids)])
+            actioncmd += ''.join([f' \\\n#  --avoid={x}' for x in avoids])
         if len(modules) > 0:
-            actioncmd += ''.join([f" \\\n#  {x}" for x in sorted(modules)])
+            actioncmd += ''.join([f' \\\n#  {x}' for x in modules])
         return actioncmd
 
     def relative_to_destdir(self, dir):
-- 
2.39.2


  reply	other threads:[~2024-02-28 11:52 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-23  5:23 [PATCH] gnulib-tool.py: Follow gnulib-tool changes, part 27 Collin Funk
2024-02-23 13:08 ` Bruno Haible
2024-02-23 22:20   ` Collin Funk
2024-02-23 23:51     ` Bruno Haible
2024-02-24  2:36       ` Collin Funk
2024-02-24  5:49         ` gnulib-tool.py: Follow gnulib-tool changes, part 28 Collin Funk
2024-02-24 23:25           ` gnulib-tool.py: Follow gnulib-tool changes, part 27 Bruno Haible
2024-02-25  0:03             ` Dima Pasechnik
2024-02-25 11:57               ` Python != None Bruno Haible
2024-02-25 19:29                 ` Collin Funk
2024-02-25 20:07                   ` Collin Funk
2024-02-26 20:38                     ` pycodestyle configuration Bruno Haible
2024-02-26 21:31                       ` Collin Funk
2024-02-26 22:54                         ` Bruno Haible
2024-02-27  0:51                           ` Collin Funk
2024-02-27  2:38                             ` Bruno Haible
2024-02-27  4:22                               ` Collin Funk
2024-02-25 20:55                   ` Python != None Dima Pasechnik
2024-02-25 12:02             ` Python 'strings' Bruno Haible
2024-02-25 19:05               ` Collin Funk
2024-02-24 23:42           ` gnulib-tool.py: Follow gnulib-tool changes, part 28 Bruno Haible
2024-02-25  0:47             ` Collin Funk
2024-02-25  1:18               ` Collin Funk
2024-02-25  1:25                 ` Bruno Haible
2024-02-25  3:32                   ` Collin Funk
2024-02-26 20:51                     ` Bruno Haible
2024-02-28 11:51                       ` Collin Funk [this message]
2024-02-28 12:14                         ` 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=02828a71-3d97-4452-94e0-1d1b4a3cf651@gmail.com \
    --to=collin.funk1@gmail.com \
    --cc=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).