]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Follow gnulib-tool changes, part 42.
authorCollin Funk <collin.funk1@gmail.com>
Wed, 6 Mar 2024 04:32:29 +0000 (20:32 -0800)
committerBruno Haible <bruno@clisp.org>
Wed, 6 Mar 2024 10:30:42 +0000 (11:30 +0100)
Follow gnulib-tool change
2019-02-15  Bruno Haible  <bruno@clisp.org>
gnulib-tool: Support --import with just a few tests, not --with-tests.

* pygnulib/GLImport.py (GLImport.execute): Use 'gentests' instead of
'inctests' when generating files.
* pygnulib/GLMakefileTable.py (GLMakefileTable.parent): Add 'gentests'
argument and use it instead of 'inctests'.

ChangeLog
gnulib-tool.py.TODO
pygnulib/GLImport.py
pygnulib/GLMakefileTable.py

index 0d11697d3db526640d31054597705a19a71e1507..5e7ea28e071abca63ea78252971798ab8e3566dc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-03-06  Collin Funk  <collin.funk1@gmail.com>
+
+       gnulib-tool.py: Follow gnulib-tool changes, part 42.
+       Follow gnulib-tool change
+       2019-02-15  Bruno Haible  <bruno@clisp.org>
+       gnulib-tool: Support --import with just a few tests, not --with-tests.
+       * pygnulib/GLImport.py (GLImport.execute): Use 'gentests' instead of
+       'inctests' when generating files.
+       * pygnulib/GLMakefileTable.py (GLMakefileTable.parent): Add 'gentests'
+       argument and use it instead of 'inctests'.
+
 2024-03-05  Collin Funk  <collin.funk1@gmail.com>
 
        gnulib-tool.py: Follow gnulib-tool changes, part 41.
index 2d8719a751d161c07493ae5753611103e155e99c..42728ed60df5167f359d79c966e0329324d7ab26 100644 (file)
@@ -619,18 +619,6 @@ Date:   Mon Nov 18 13:32:46 2019 +0100
 
 --------------------------------------------------------------------------------
 
-commit dc135c4fd14cdc219d316c61f344e64090cb33fd
-Author: Bruno Haible <bruno@clisp.org>
-Date:   Fri Feb 15 21:27:44 2019 +0100
-
-    gnulib-tool: Support --import with just a few tests, not --with-tests.
-
-    * gnulib-tool (func_import): New variable 'gentests'. Use it instead of
-    'inctests' when generating files; use 'inctests' only for computing the
-    transitive closure.
-
---------------------------------------------------------------------------------
-
 commit 425ee42259b04956aae20afc5204775ae6e79744
 Author: Bruno Haible <bruno@clisp.org>
 Date:   Wed Jan 23 05:11:54 2019 +0100
index 3075dc3e47ef5091455b6c9c7e5891b844e8824b..ab10d965096c2bc9701916a7b88e6c9cd9e374e7 100644 (file)
@@ -983,6 +983,12 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
         verbose = self.config['verbosity']
         actioncmd = self.actioncmd()
 
+        # Determine whether to put anything into $testsbase.
+        testsfiles = [ file
+                       for file in filetable['all']
+                       if file.startswith('tests/') or file.startswith('tests=lib/') ]
+        gentests = len(testsfiles) > 0
+
         # Create all necessary directories.
         dirs = list()
         if pobase:
@@ -991,6 +997,8 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
              for file in filetable['all']
              if file.startswith('doc/') ]:
             dirs += [docbase]
+        if gentests:
+            dirs += [testsbase]
         dirs += [sourcebase, m4base, auxdir]
         dirs += [ os.path.dirname(pair[0])
                   for pair in filetable['new'] ]
@@ -1095,7 +1103,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
                 testsbase_base = os.path.basename(testsbase)
                 self.makefiletable.editor(testsbase_dir, 'SUBDIRS', testsbase_base, True)
         self.makefiletable.editor('', 'ACLOCAL_AMFLAGS', '-I %s' % m4base)
-        self.makefiletable.parent()
+        self.makefiletable.parent(gentests)
 
         # Create library makefile.
         basename = joinpath(sourcebase, makefile_am)
@@ -1275,8 +1283,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
             os.remove(tmpfile)
 
         # Create tests Makefile.
-        inctests = self.config.checkInclTestCategory(TESTS['tests'])
-        if inctests:
+        if gentests:
             basename = joinpath(testsbase, makefile_am)
             tmpfile = self.assistant.tmpfilename(basename)
             emit, uses_subdirs = self.emitter.tests_Makefile_am(basename,
@@ -1386,7 +1393,7 @@ in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library.''')
             print('  - "include %s" from within "%s/Makefile.am",' % (makefile_name, sourcebase))
         if pobase:
             print('  - add "%s/Makefile.in to AC_CONFIG_FILES in %s,' % (pobase, configure_ac))
-        if inctests:
+        if gentests:
             if makefile_am == 'Makefile.am':
                 print('  - add "%s/Makefile" to AC_CONFIG_FILES in %s,' % (testsbase, configure_ac))
             else:  # if makefile_am != 'Makefile.am'
index a63c2d68990fdd7726a4786287f1c9247237809d..d1e6178880ff06a672bb4cd817ddb9644ed5c2d9 100644 (file)
@@ -80,13 +80,16 @@ class GLMakefileTable(object):
         dictionary = {'dir': dir, 'var': var, 'val': val, 'dotfirst': dotfirst}
         self.table += [dictionary]
 
-    def parent(self):
-        '''GLMakefileTable.parent()
+    def parent(self, gentests):
+        '''GLMakefileTable.parent(gentests)
 
         Add a special row to Makefile.am table with the first parent directory
         which contains or will contain Makefile.am file.
         GLConfig: sourcebase, m4base, testsbase, incl_test_categories,
-        excl_test_categories, makefile_name.'''
+        excl_test_categories, makefile_name.
+        gentests is a bool that is True if files are placed in $testsbase.'''
+        if type(gentests) is not bool:
+            raise TypeError('gentests must be a bool, not %s' % (type(gentests).__name__))
         m4base = self.config['m4base']
         sourcebase = self.config['sourcebase']
         testsbase = self.config['testsbase']
@@ -102,7 +105,7 @@ class GLMakefileTable(object):
         while (dir1
                and (joinpath(self.config['destdir'], dir1, mfd)
                     or joinpath(dir1, mfd) == joinpath(sourcebase, mfx)
-                    or (inctests and joinpath(dir1, mfd) == joinpath(testsbase, mfx)))):
+                    or (gentests and joinpath(dir1, mfd) == joinpath(testsbase, mfx)))):
             dir2 = joinpath(os.path.basename(dir1), dir2)
             dir1 = os.path.dirname(dir1)
         self.editor(dir1, 'EXTRA_DIST', joinpath(dir2, 'gnulib-cache.m4'))