From: Collin Funk <collin.funk1@gmail.com>
To: bug-gnulib@gnu.org
Subject: gnulib-tool.py: Don't discard the 'dummy' module.
Date: Sat, 30 Mar 2024 03:43:11 -0700 [thread overview]
Message-ID: <50027784-b2d2-418d-ab7f-83c1d7d61a77@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1028 bytes --]
In a few of the import tests gnulib-tool.py doesn't add the 'dummy'
module even though gnulib-tool.sh does.
This is because the 'dummy' module was added after GLImport saved the
modules in the GLModuleTable:
# Transmit base_modules, final_modules, main_modules and tests_modules.
self.moduletable.setBaseModules(base_modules)
self.moduletable.setFinalModules(final_modules)
self.moduletable.setMainModules(main_modules)
self.moduletable.setTestsModules(tests_modules)
After reordering these, the output is still incorrect. gnulib-tool.py
places the 'dummy' module at the top of the Makefiles, but
gnulib-tool.sh places them at the bottom.
Changing the moduletable functions to remove the sorting here seems to
fix the issue:
- self.tests_modules = sorted(set(modules))
+ self.tests_modules = modules
This seems to be fine since GLModuleTable.transitive_closure and
GLModuleTable.transitive_closure_separately sort and remove duplicates
before these are called.
Collin
[-- Attachment #2: 0001-gnulib-tool.py-Don-t-discard-the-dummy-module.patch --]
[-- Type: text/x-patch, Size: 4517 bytes --]
From 92e12249d21cd943e438df71ece71a2eb1cadb01 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.funk1@gmail.com>
Date: Sat, 30 Mar 2024 03:23:46 -0700
Subject: [PATCH] gnulib-tool.py: Don't discard the 'dummy' module.
* pygnulib/GLImport.py (GLImport.prepare): Don't set modules stored in
the GLModuleTable until after the 'dummy' module is added.
* pygnulib/GLModuleSystem.py (GLImport.setBaseModules)
(GLImport.setFinalModules, GLImport.setMainModules)
(GLImport.setTestsModules): Don't sort modules since the 'dummy' module
should be placed last in the Makefiles.
---
ChangeLog | 10 ++++++++++
pygnulib/GLImport.py | 12 ++++++------
pygnulib/GLModuleSystem.py | 8 ++++----
3 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6d31a954c7..0c5695231f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-03-30 Collin Funk <collin.funk1@gmail.com>
+
+ gnulib-tool.py: Don't discard the 'dummy' module.
+ * pygnulib/GLImport.py (GLImport.prepare): Don't set modules stored in
+ the GLModuleTable until after the 'dummy' module is added.
+ * pygnulib/GLModuleSystem.py (GLImport.setBaseModules)
+ (GLImport.setFinalModules, GLImport.setMainModules)
+ (GLImport.setTestsModules): Don't sort modules since the 'dummy' module
+ should be placed last in the Makefiles.
+
2024-03-29 Collin Funk <collin.funk1@gmail.com>
gnulib-tool.py: Fix reading of 'gl_VC_FILES' in gnulib-cache.m4.
diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index 81298eeca1..c3a7597d02 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -860,12 +860,6 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
self.moduletable.transitive_closure_separately(base_modules, final_modules)
main_modules, tests_modules = modules
- # Transmit base_modules, final_modules, main_modules and tests_modules.
- self.moduletable.setBaseModules(base_modules)
- self.moduletable.setFinalModules(final_modules)
- self.moduletable.setMainModules(main_modules)
- self.moduletable.setTestsModules(tests_modules)
-
# Print main_modules and tests_modules.
if verbose >= 1:
print('Main module list:')
@@ -892,6 +886,12 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
# Add the dummy module to the tests-related module list if needed.
tests_modules = self.moduletable.add_dummy(tests_modules)
+ # Transmit base_modules, final_modules, main_modules and tests_modules.
+ self.moduletable.setBaseModules(base_modules)
+ self.moduletable.setFinalModules(final_modules)
+ self.moduletable.setMainModules(main_modules)
+ self.moduletable.setTestsModules(tests_modules)
+
# Check license incompatibilities.
listing = list()
compatibilities = dict()
diff --git a/pygnulib/GLModuleSystem.py b/pygnulib/GLModuleSystem.py
index 6ec366eecd..4add195f2a 100644
--- a/pygnulib/GLModuleSystem.py
+++ b/pygnulib/GLModuleSystem.py
@@ -1102,7 +1102,7 @@ class GLModuleTable(object):
for module in modules:
if type(module) is not GLModule:
raise TypeError('each module must be a GLModule instance')
- self.base_modules = sorted(set(modules))
+ self.base_modules = modules
def getFinalModules(self) -> list[GLModule]:
'''Return list of final modules.'''
@@ -1113,7 +1113,7 @@ class GLModuleTable(object):
for module in modules:
if type(module) is not GLModule:
raise TypeError('each module must be a GLModule instance')
- self.final_modules = sorted(set(modules))
+ self.final_modules = modules
def getMainModules(self) -> list[GLModule]:
'''Return list of main modules.'''
@@ -1124,7 +1124,7 @@ class GLModuleTable(object):
for module in modules:
if type(module) is not GLModule:
raise TypeError('each module must be a GLModule instance')
- self.main_modules = sorted(set(modules))
+ self.main_modules = modules
def getTestsModules(self) -> list[GLModule]:
'''Return list of tests modules.'''
@@ -1135,4 +1135,4 @@ class GLModuleTable(object):
for module in modules:
if type(module) is not GLModule:
raise TypeError('each module must be a GLModule instance')
- self.tests_modules = sorted(set(modules))
+ self.tests_modules = modules
--
2.44.0
next reply other threads:[~2024-03-30 10:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-30 10:43 Collin Funk [this message]
2024-03-30 23:29 ` gnulib-tool.py: Don't discard the 'dummy' module Bruno Haible
2024-03-31 0:59 ` Collin Funk
2024-03-31 10:32 ` 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=50027784-b2d2-418d-ab7f-83c1d7d61a77@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).