From: Collin Funk Date: Wed, 6 Mar 2024 04:32:29 +0000 (-0800) Subject: gnulib-tool.py: Follow gnulib-tool changes, part 42. X-Git-Tag: v1.0~328 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=ca739255edb5656b46aa6c990942843e11cf9c41;p=gnulib.git gnulib-tool.py: Follow gnulib-tool changes, part 42. Follow gnulib-tool change 2019-02-15 Bruno Haible 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'. --- diff --git a/ChangeLog b/ChangeLog index 0d11697d3d..5e7ea28e07 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2024-03-06 Collin Funk + + gnulib-tool.py: Follow gnulib-tool changes, part 42. + Follow gnulib-tool change + 2019-02-15 Bruno Haible + 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 gnulib-tool.py: Follow gnulib-tool changes, part 41. diff --git a/gnulib-tool.py.TODO b/gnulib-tool.py.TODO index 2d8719a751..42728ed60d 100644 --- a/gnulib-tool.py.TODO +++ b/gnulib-tool.py.TODO @@ -619,18 +619,6 @@ Date: Mon Nov 18 13:32:46 2019 +0100 -------------------------------------------------------------------------------- -commit dc135c4fd14cdc219d316c61f344e64090cb33fd -Author: Bruno Haible -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 Date: Wed Jan 23 05:11:54 2019 +0100 diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py index 3075dc3e47..ab10d96509 100644 --- a/pygnulib/GLImport.py +++ b/pygnulib/GLImport.py @@ -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 _a_LDFLAGS or _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' diff --git a/pygnulib/GLMakefileTable.py b/pygnulib/GLMakefileTable.py index a63c2d6899..d1e6178880 100644 --- a/pygnulib/GLMakefileTable.py +++ b/pygnulib/GLMakefileTable.py @@ -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'))