This patch *should* fix one item in the gnulib-tool.py.TODO file. I am
unsure of a good way to test it at the moment so I am trusting that I
read the original commit correctly. It was a simple addition of a
conditional so I am 99% sure it is correct.

The issue I am having with testing is that the use of
--conditional-dependencies will always result in lots of lines in the
diff. These appear to be related to the changes made in gnulib-common.m4
in this commit:

commit 4bf9c96497946ce6f7b84f6527ed0291657cf728
Author: Bruno Haible <br...@clisp.org>
Date:   Sun Jan 9 15:38:51 2022 +0100

    Remove influence of Automake conditionals on conditional dependencies.

So, once that is done things should work properly. Hopefully.

Collin

>From 4baa360e2d7d3ddb2584f4e7a45a97e0e9c293fb Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Sat, 16 Mar 2024 18:49:35 -0700
Subject: [PATCH] gnulib-tool.py: Follow gnulib-tool changes, part 60.

Follow gnulib-tool change
2019-11-18  Bruno Haible  <br...@clisp.org>
gnulib-tool: Fix build error on macOS with --conditional-dependencies.

* pygnulib/GLModuleSystem.py (GLModuleTable.add_dummy): Ignore modules
that are conditionally enabled.
---
 ChangeLog                  |  9 +++++++++
 gnulib-tool.py.TODO        | 11 -----------
 pygnulib/GLModuleSystem.py | 30 ++++++++++++++++++------------
 3 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 258691d551..58363b10a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-03-16  Collin Funk  <collin.fu...@gmail.com>
+
+	gnulib-tool.py: Follow gnulib-tool changes, part 60.
+	Follow gnulib-tool change
+	2019-11-18  Bruno Haible  <br...@clisp.org>
+	gnulib-tool: Fix build error on macOS with --conditional-dependencies.
+	* pygnulib/GLModuleSystem.py (GLModuleTable.add_dummy): Ignore modules
+	that are conditionally enabled.
+
 2024-03-16  Collin Funk  <collin.fu...@gmail.com>
 
 	gnulib-tool.py: Follow gnulib-tool changes, part 59.
diff --git a/gnulib-tool.py.TODO b/gnulib-tool.py.TODO
index 8d76b38cd9..c02c9d1918 100644
--- a/gnulib-tool.py.TODO
+++ b/gnulib-tool.py.TODO
@@ -161,17 +161,6 @@ Date:   Sat Feb 22 15:15:01 2020 +0100
 
 --------------------------------------------------------------------------------
 
-commit 0d41dbc7c88b10d16751466ec91efa75951426bb
-Author: Bruno Haible <br...@clisp.org>
-Date:   Mon Nov 18 13:32:46 2019 +0100
-
-    gnulib-tool: Fix build error on macOS with --conditional-dependencies.
-
-    * gnulib-tool (func_modules_add_dummy): Ignore modules that are
-    conditionally enabled.
-
---------------------------------------------------------------------------------
-
 commit 30459fe101541698ec704acb224946d73676750e
 Author: Bruno Haible <br...@clisp.org>
 Date:   Thu Jun 8 15:09:31 2017 +0200
diff --git a/pygnulib/GLModuleSystem.py b/pygnulib/GLModuleSystem.py
index cbe2534c72..9f3a3a79d7 100644
--- a/pygnulib/GLModuleSystem.py
+++ b/pygnulib/GLModuleSystem.py
@@ -1066,9 +1066,10 @@ class GLModuleTable(object):
 
         Add dummy package to list of modules if dummy package is needed. If not,
         return original list of modules.
-        GLConfig: auxdir, ac_version.'''
+        GLConfig: auxdir, ac_version, conddeps.'''
         auxdir = self.config['auxdir']
         ac_version = self.config['ac_version']
+        conddeps = self.config['conddeps']
         for module in modules:
             if type(module) is not GLModule:
                 raise TypeError('each module must be a GLModule instance')
@@ -1076,17 +1077,22 @@ class GLModuleTable(object):
         have_lib_sources = False
         for module in modules:
             if not module.isTests():
-                snippet = module.getAutomakeSnippet()
-                # Extract the value of "lib_SOURCES += ...".
-                snippet = constants.remove_backslash_newline(snippet)
-                pattern = re.compile('^lib_SOURCES[\t ]*\\+=([^#]*).*$', re.M)
-                for matching_rhs in pattern.findall(snippet):
-                    files = matching_rhs.split(' ')
-                    for file in files:
-                        # Ignore .h files since they are not compiled.
-                        if not file.endswith('.h'):
-                            have_lib_sources = True
-                            break
+                if conddeps and self.isConditional(module):
+                    # Ignore conditional modules, since they are not guaranteed to
+                    # contribute to lib_SOURCES.
+                    pass
+                else:
+                    snippet = module.getAutomakeSnippet()
+                    # Extract the value of "lib_SOURCES += ...".
+                    snippet = constants.remove_backslash_newline(snippet)
+                    pattern = re.compile('^lib_SOURCES[\t ]*\\+=([^#]*).*$', re.M)
+                    for matching_rhs in pattern.findall(snippet):
+                        files = matching_rhs.split(' ')
+                        for file in files:
+                            # Ignore .h files since they are not compiled.
+                            if not file.endswith('.h'):
+                                have_lib_sources = True
+                                break
         # Add the dummy module, to make sure the library will be non-empty.
         if not have_lib_sources:
             dummy = self.modulesystem.find('dummy')
-- 
2.44.0

Reply via email to