Hi Bruno,

On 3/2/24 2:18 AM, Bruno Haible wrote:
> The output needs to be deterministic; the natural order from the module
> description is perfectly fine. Therefore the sorting in the Python code should
> go away.

I've attached a patch if you haven't changed it yet.

> is not only to sort, but also to remove duplicates. But this is not needed 
> either.

I didn't see any sorting or removal of duplicates in
func_filter_filelist so I assumed sorted() and set() would be wrong.
Thanks for the extra testing and explanations.

Since sets are unordered, before I found out duplicates weren't
removed, I was wondering what the fastest way to remove duplicates
from a list in Python would be while preserving order. Turns out an
implementation detail in Python 3.7+ allows for this to be done
quickly in one line. Might be come in handy later.

[1] https://stackoverflow.com/a/17016257

Collin
From ec9b5cd9d3132fe35c8b8c1c947bcc143403d0a3 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Sat, 2 Mar 2024 04:59:04 -0800
Subject: [PATCH] gnulib-tool.py: Make output of test Makefile.am match
 gnulib-tool.

* pygnulib/GLModuleSystem.py
(GLModule.getAutomakeSnippet_Unconditional): Don't sort EXTRA_DIST file
names for test modules.
---
 ChangeLog                  | 7 +++++++
 pygnulib/GLModuleSystem.py | 1 -
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index adb87082e3..3ba80e7c39 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-03-02  Collin Funk  <collin.fu...@gmail.com>
+
+	gnulib-tool.py: Make output of test Makefile.am match gnulib-tool.
+	* pygnulib/GLModuleSystem.py
+	(GLModule.getAutomakeSnippet_Unconditional): Don't sort EXTRA_DIST file
+	names for test modules.
+
 2024-03-01  Collin Funk  <collin.fu...@gmail.com>
 
 	gnulib-tool.py: Follow gnulib-tool changes, part 38.
diff --git a/pygnulib/GLModuleSystem.py b/pygnulib/GLModuleSystem.py
index 3672474fa1..86794cf80e 100644
--- a/pygnulib/GLModuleSystem.py
+++ b/pygnulib/GLModuleSystem.py
@@ -571,7 +571,6 @@ class GLModule(object):
                 files = self.getFiles()
                 extra_files = filter_filelist(constants.NL, files,
                                               'tests/', '', 'tests/', '').split(constants.NL)
-                extra_files = sorted(set(extra_files))
                 if extra_files:
                     result += 'EXTRA_DIST += %s' % ' '.join(extra_files)
                     result += constants.NL * 2
-- 
2.44.0

Reply via email to