Bruno Haible [Fri, 29 Mar 2024 11:14:21 +0000 (12:14 +0100)]
gnulib-tool.py: Don't print Makefile.am edits that are already done.
* pygnulib/GLMakefileTable.py (GLMakefileTable): Improve comments.
(GLMakefileTable.__getitem__): Do not clone the result.
* pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am, tests_Makefile_am):
Avoid a KeyError when testing for 'var'.
Use 'del' to remove a dictionary entry.
* pygnulib/GLImport.py (GLImport.execute): Avoid a KeyError when
testing for 'var'. Simplify loop over makefiletable.
Collin Funk [Thu, 28 Mar 2024 00:39:58 +0000 (17:39 -0700)]
gnulib-tool.py: Inline 'sed' invocations used on library files.
* pygnulib/GLFileSystem.py (GLFileAssistant.__init__): Update type hints
and docstrings to reflect changes necessary for using re.sub() instead
of 'sed'.
(GLFileAssistant.add_or_update): Use re.sub() instead of invoking 'sed'.
* pygnulib/GLImport.py (GLImport.prepare): Update transformation
variables to reflect changes to GLFileAssistant.
Collin Funk [Tue, 26 Mar 2024 22:43:21 +0000 (15:43 -0700)]
gnulib-tool.py: Allow the use of both configure.ac and configure.in.
* pygnulib/GLImport.py (GLImport.__init__): Remove redundant checks for
configure.ac and configure.in.
* pygnulib/main.py (main): Check for configure.ac and configure.in
before reading it. Pass it to GLImport using the GLConfig object.
Collin Funk [Mon, 25 Mar 2024 08:56:24 +0000 (01:56 -0700)]
gnulib-tool.py: Fix output of #include directive advice.
* pygnulib/GLImport.py (GLImport.execute): Copy comment from
gnulib-tool.sh with modified variable names. Search the 'Include:' as a
whole instead of each individual line.
Bruno Haible [Sun, 24 Mar 2024 18:23:47 +0000 (19:23 +0100)]
nstrtime, c-nstrftime: Fix %c directive's result on glibc ≤ 2.30.
* lib/strftime.c (__strftime_internal): On glibc ≤ 2.30, like on NetBSD
and Solaris, remove the last word of the %c directive's result if it
looks like a time zone.
* doc/posix-functions/strftime.texi: Update platforms list.
Bruno Haible [Sun, 24 Mar 2024 11:06:50 +0000 (12:06 +0100)]
gnulib-tool.py: Fix output of notices.
* pygnulib/GLTestDir.py (GLTestDir.execute): Don't print notices if the
verbosity is < -1. Strip newlines from each notice.
* pygnulib/GLImport.py (GLImport.prepare): Don't print notices if the
verbosity is < -1. Strip only newlines, not spaces.
Bruno Haible [Sun, 24 Mar 2024 00:28:49 +0000 (01:28 +0100)]
gnulib-tool.py: Don't unnecessarily sort an EXTRA_DIST augmentation.
* pygnulib/GLModuleSystem.py
(GLModule.getAutomakeSnippet_Unconditional): Don't remove duplicates or
sort the filenames in the EXTRA_lib_SOURCES augmentation or the
EXTRA_DIST augmentation for build-aux.
Collin Funk [Sat, 23 Mar 2024 02:43:41 +0000 (19:43 -0700)]
gnulib-tool.py: Follow gnulib-tool changes, part 69.
Follow gnulib-tool change
2012-08-19 Bruno Haible <bruno@clisp.org>
gnulib-tool: Remove old file names from .cvsignore, .gitignore.
* pygnulib/GLImport.py (GLImport._update_ignorelist_): Add
gnulib-comp.m4 to the added file list.
(GLImport.execute): Remove unused variables. Use sets to match the
'join' invocations in gnulib-tool.sh.
Collin Funk [Fri, 22 Mar 2024 09:15:24 +0000 (02:15 -0700)]
gnulib-tool.py: Fix unconditional Automake snippets for non-tests.
* pygnulib/GLModuleSystem.py
(GLModule.getAutomakeSnippet_Unconditional): Fix the file lookups used
to determine the EXTRA_DIST and EXTRA_lib_SOURCES Automake variables.
Update comment to match gnulib-tool.sh.
* pygnulib/constants.py (filter_filelist): Fix misleading return type in
docstring. Return an empty string if no files were found.
Bruno Haible [Fri, 22 Mar 2024 15:10:29 +0000 (16:10 +0100)]
gnulib-tool: Remove test-driver.{orig,rej} if patching succeeded.
* gnulib-tool.sh (func_create_testdir, func_create_megatestdir): After
a 'patch' command failed, remove the leftover files test-driver.orig and
test-driver.rej.
* pygnulib/GLTestDir.py (_patch_test_driver): Likewise.
* pygnulib/GLModuleSystem.py (GLModule.getLinkDirectiveRecursively):
Check the 'Link:' section of each individual module. Use sets instead of
lists to remove duplicates.
Collin Funk [Thu, 21 Mar 2024 00:51:55 +0000 (17:51 -0700)]
gnulib-tool.py: Make --extract-filelist match gnulib-tool.sh.
* pygnulib/GLModuleSystem.py (GLModule.getFiles_Raw): New function which
returns the 'Files:' section from a module unchanged.
(GLModule.getFiles): Use it.
* pygnulib/main.py (main): Use it and match the output of gnulib-tool.sh
for --extract-filelist.
Bruno Haible [Thu, 21 Mar 2024 14:45:42 +0000 (15:45 +0100)]
gnulib-tool: Make the .gitignore files handling more consistent.
* gnulib-tool.sh (func_done_dir): Ignore the presence or absence of a
.git directory if there is a .gitignore file in the same place.
* pygnulib/GLImport.py (GLImport._done_dir_): Likewise.
Bruno Haible [Wed, 20 Mar 2024 10:13:54 +0000 (11:13 +0100)]
gnulib-tool.sh: Undocument the --[no-]cache-modules options.
Reported by Collin Funk in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-03/msg00234.html>.
Rationale:
<https://lists.gnu.org/archive/html/bug-gnulib/2024-03/msg00243.html>.
Collin Funk [Tue, 19 Mar 2024 19:09:57 +0000 (12:09 -0700)]
gnulib-tool.py: Follow gnulib-tool changes, part 68.
Follow gnulib-tool change
2022-07-31 Akim Demaille <akim@lrde.epita.fr>
gnulib-tool: add support for --automake-subdir-tests
* pygnulib/main.py (main): Add support for --automake-subdir-tests.
* pygnulib/GLInfo.py (GLInfo.usage): Add --automake-subdir-tests to the
help message.
* pygnulib/GLConfig.py (GLConfig.__init__): Add 'automake_subdir_tests'
to the parameter list. Initialize it.
(GLConfig.default): Default --automake-subdir-tests to False.
(GLConfig.resetAutomakeSubdir): Fix misleading docstring.
(GLConfig.getAutomakeSubdirTests, GLConfig.setAutomakeSubdirTests)
(GLConfig.resetAutomakeSubdirTests): New functions to manipulate and
access whether --automake-subdir-tests is in use.
* pygnulib/GLEmiter.py (GLEmiter.shellvars_init)
(GLEmiter.initmacro_end): Use sourcebase when handling tests and
--automake-subdir-tests is given.
* pygnulib/GLError.py (GLError.__repr__): Update error message to
include --automake-subdir-tests.
* pygnulib/GLImport.py (GLImport.__init__): Check for the
'subdir-objects' Automake option when --automake-subdir-tests is in use.
(GLImport.actioncmd): Add --automake-subdir-tests to the actioncmd
printed in generated files.
Bruno Haible [Tue, 19 Mar 2024 23:27:27 +0000 (00:27 +0100)]
gnulib-tool: Make it work in the test suite.
* gnulib-tool.sh (gnulib_dir): Make absolute.
(func_create_megatestdir): If .git/refs/heads/master does not exist, use
ChangeLog instead.
* pygnulib/main.py (main): Make gnulib_dir absolute.
* pygnulib/GLTestDir.py (GLMegaTestDir.execute): If
.git/refs/heads/master does not exist, use ChangeLog instead.
Collin Funk [Mon, 18 Mar 2024 23:26:34 +0000 (16:26 -0700)]
gnulib-tool.py: Follow gnulib-tool changes, part 66.
Follow gnulib-tool change
2021-12-25 Bruno Haible <bruno@clisp.org>
gnulib-tool: Fix handling of module libtextstyle-optional.
* pygnulib/GLModuleSystem.py (GLModule.repeatModuleInTests): New function.
* pygnulib/GLEmiter.py (GLEmiter.tests_Makefile_am): Use it for creating
the tests/Makefile.am.
* pygnulib/GLTestDir.py (GLTestDir.execute): Use it when creating the
file list.
Collin Funk [Mon, 18 Mar 2024 19:23:46 +0000 (12:23 -0700)]
gnulib-tool.py: Follow gnulib-tool changes, part 65.
Follow gnulib-tool change
2021-12-19 Bruno Haible <bruno@clisp.org>
gnulib-tool: Don't insist on ACLOCAL_AMFLAGS.
* pygnulib/GLImport.py (GLImport.execute): Don't add extra '-I' before
m4 directory in ACLOCAL_AMFLAGS. Prefer '0' instead of 'int()'. Mention
the use of AC_CONFIG_MACRO_DIRS in configure.ac as an alternative to
augmenting ACLOCAL_AMFLAGS.
* pygnulib/main.py (main): To find the m4 directories, look also for
AC_CONFIG_MACRO_DIR and AC_CONFIG_MACRO_DIRS invocations in
configure.ac. Remove unnecessary call to 'joinpath' since it accepts a
variable length of arguments.
Collin Funk [Mon, 18 Mar 2024 03:09:12 +0000 (20:09 -0700)]
gnulib-tool.py: Follow gnulib-tool changes, part 64.
Follow gnulib-tool change
2021-12-25 Bruno Haible <bruno@clisp.org>
gnulib-tool: Respect applicability 'all' without --single-configure.
* pygnulib/GLModuleSystem.py (GLModule.isTests): Treat modules with
applicability 'all' like 'tests' modules, not like 'main' modules.
(GLModule.isNonTests): Treat all modules not ending in '-tests' as
non-test modules.
(GLModule.getApplicability): Don't use GLModule.isTests(). Because it
depends on the result of this function, using it would cause a
RecursionError exception.
(GLModule.getDependencies): Respect the difference between
module.isTests(), module.isNonTests(), and
module.getName().endswith('-tests').
(GLModule.getAutomakeSnippet_Unconditional, GLModule.getLicense)
(GLModuleTable.add_dummy): Likewise.
* pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): Likewise.
Collin Funk [Sun, 17 Mar 2024 21:51:18 +0000 (14:51 -0700)]
gnulib-tool.py: Follow gnulib-tool changes, part 63.
Follow gnulib-tool change
2020-12-28 Bruno Haible <bruno@clisp.org>
gnulib-tool: Fix logic whether to add a dummy.c.
* pygnulib/GLModuleSystem.py (GLModuleTable.remove_if_blocks): New
function.
(GLModuleTable.add_dummy): Use it to eliminate all conditional
statements from the automake snippet.
* gnulib-tool.sh: Accept --gnulib-dir=... option.
* pygnulib/constants.py (init_DIRS): New function.
* pygnulib/main.py (main): Accept --gnulib-dir=... option. Invoke
init_DIRS. Expect .git directory to be present in DIRS['root'], not
APP['root'].
* pygnulib/GLImport.py (GLImport.execute): Use DIRS['root'], not
APP['root'].
Collin Funk [Sun, 17 Mar 2024 02:56:42 +0000 (19:56 -0700)]
gnulib-tool.py: Follow gnulib-tool changes, part 61.
Follow gnulib-tool change
2022-01-09 Bruno Haible <bruno@clisp.org>
Remove influence of Automake conditionals on conditional dependencies.
* pygnulib/GLModuleSystem.py (GLModuleTable.transitive_closure): Don't
inhibit conditional dependencies processing on a module that uses an
Automake conditional.
Paul Eggert [Sun, 17 Mar 2024 05:27:48 +0000 (22:27 -0700)]
renameatu: support RENAME_EXCHANGE on macOS
* lib/renameatu.c (renameat2ish, renameatu) [RENAME_SWAP]:
Use macOS RENAME_SWAP to implement GNU/Linux RENAME_EXCHANGE.
* tests/test-renameatu.c (main): Add a test for RENAME_EXCHANGE.
Collin Funk [Sat, 16 Mar 2024 18:47:05 +0000 (11:47 -0700)]
gnulib-tool.py: Fix 'git update-index' call when using hard links.
* pygnulib/main.py: Fix conditional used to check whether 'git
update-index' should be called. Only catch FileNotFoundError exceptions
thrown when no 'git' program exists.
Collin Funk [Sat, 16 Mar 2024 02:58:27 +0000 (19:58 -0700)]
gnulib-tool.py: Follow gnulib-tool changes, part 58.
Follow gnulib-tool change
2017-05-21 Bruno Haible <bruno@clisp.org>
gnulib-tool: Add options to create hard links.
* pygnulib/GLConfig.py (GLConfig.__init__): Add 'copymode' and
'lcopymode' to the parameter list. Initialize them.
(GLConfig.default): Don't use symbolic or hard links by default.
(GLConfig.checkCopyMode, GLConfig.setCopyMode, GLConfig.resetCopyMode):
New functions to modify and check the method for copying non --local-dir
files.
(GLConfig.checkLCopyMode, GLConfig.setLCopyMode)
(GLConfig.resetLCopyMode): New functions to modify and check the method
for copying --local-dir files.
(GLConfig.checkSymbolic, GLConfig.resetSymbolic, GLConfig.setSymbolic)
(GLConfig.checkLSymbolic, GLConfig.resetLSymbolic)
(GLConfig.setLSymbolic): Remove unused functions. The functionality of
these are now implemented in the *CopyMode() and *LCopyMode() variants.
* pygnulib/GLFileSystem.py (CopyAction.Hardlink): New Enum value to
describe hard links.
(GLFileSystem.shouldLink): Check if hard links should be used.
(GLFileAssistant.add, GLFileAssistant.update): Try to hard link if
enabled. Copy the file if linking fails.
(GLFileAssistant.add_or_update): Remove temporary files unconditionally.
* pygnulib/GLInfo.py (GLInfo.usage): Document new options in the usage
message.
* pygnulib/GLTestDir.py (GLTestDir.execute): Try to hard link if
enabled. Copy the file if linking fails.
* pygnulib/classes.py: Importy the CopyAction Enum.
* pygnulib/constants.py (hardlink): New function based on
symlink_relative.
* pygnulib/main.py (main): Add new options --hardlink and
--local-hardlink. Invoke 'git update-index --refresh' to mitigate the
effects of the hard links on git.
Collin Funk [Fri, 15 Mar 2024 01:41:05 +0000 (18:41 -0700)]
gnulib-tool.py: Follow gnulib-tool changes, part 57.
Follow gnulib-tool change
2019-01-04 Bruno Haible <bruno@clisp.org>
gnulib-tool: New option --extract-recursive-link-directive.
* pygnulib/GLModuleSystem.py (GLModule.getDependenciesRecursively): New
function. Implements the --extract-recursive-dependencies option.
(GLModule.getLinkDirectiveRecursively): New function. Implements the
--extract-recursive-link-directive.
* pygnulib/main.py (main): Add the --extract-recursive-dependencies and
--extract-recursive-link-directive options.
* pygnulib/GLInfo.py (GLInfo.usage): Add new options to help message.
Collin Funk [Thu, 14 Mar 2024 02:21:44 +0000 (19:21 -0700)]
gnulib-tool.py: Fix write failure due to bad sourcebase.
* pygnulib/constants.py (cleaner): Only call strip() on string objects.
* pygnulib/main.py (main): Fix parsing of AMLOCAL_AMFLAGS from
Makefile.am. Add some comments from gnulib-tool.
Collin Funk [Tue, 12 Mar 2024 20:01:50 +0000 (13:01 -0700)]
gnulib-tool.py: Follow gnulib-tool changes, part 56.
Follow gnulib-tool change
2021-04-26 Paul Eggert <eggert@cs.ucla.edu>
gnulib-tool: port better to current Autoconf
* pygnulib/GLImport.py (GLImport.execute): Remove exit() call before
printing reminders. Suggest replacing AC_PROG_CC_STDC and
AC_PROG_CC_C99, as per current Autoconf.
Collin Funk [Tue, 12 Mar 2024 18:45:53 +0000 (11:45 -0700)]
gnulib-tool.py: Fix last commit.
* pygnulib/GLEmiter.py (GLEmiter.initmacro_end): Silence Python
warnings about invalid escape. Make sure to escape the backslash
character we want to print.
Collin Funk [Tue, 12 Mar 2024 01:50:28 +0000 (18:50 -0700)]
gnulib-tool.py: Follow gnulib-tool changes, part 55.
Follow gnulib-tool changes
2022-01-05 Bruno Haible <bruno@clisp.org>
gnulib-tool: Avoid known warnings that reflect Gnulib's coding style.
2022-01-08 Bruno Haible <bruno@clisp.org>
gnulib-tool: Remove all *.Po files upon distclean (regr. 2022-01-05).
* pygnulib/GLEmiter.py (GLEmiter.initmacro_end): Collect the *.Po or
*.Plo files to remove into an AC_SUBSTed variable gl_LIBOBJDEPS. Use
Python f-strings instead of string replacements.
(GLEmiter.lib_Makefile_am): Add the GL_CFLAG_GNULIB_WARNINGS to the
CFLAGS of all the compilation units of the library. Extend the distclean
and maintainer-clean rules.
(GLEmiter.tests_Makefile_am): Add the GL_CFLAG_GNULIB_WARNINGS to the
CFLAGS.
* pygnulib/GLImport.py (GLImport.gnulib_comp): Emit an invocation of
gl_CC_GNULIB_WARNINGS.
* pygnulib/GLEmiter.py (_eliminate_NMD_from_line): New private function
to remove @NMD@ occurrences from the line of an Automake snippet.
(_eliminate_NMD): New private function which uses
_eliminate_NMD_from_line on each line of the Automake snippet.
(GLEmiter.lib_Makefile_am, GLEmiter.tests_Makefile_am): Use
_eliminate_NMD on the Automake snippet.
Bruno Haible [Sun, 10 Mar 2024 22:47:58 +0000 (23:47 +0100)]
gnulib-tool.py: Tweak last commit.
* pygnulib/GLEmiter.py (GLEmiter.initmacro_end): Avoid an implicit str
to bool conversion.
* pygnulib/GLImport.py (GLImport.__init__): Add a comment. Don't allow
a '|' in place of whitespace. Don't emit redundant gl_source_base
assignments.
Collin Funk [Sun, 10 Mar 2024 21:07:35 +0000 (14:07 -0700)]
gnulib-tool.py: Follow gnulib-tool changes, part 51.
Follow gnulib-tool change
2021-12-15 Bruno Haible <bruno@clisp.org>
Accommodate non-recursive Automake in a less hacky way.
* pygnulib/GLConfig.py (GLConfig.__init__): Add 'automake_subdir' to the
parameter list.
(GLConfig.default): Set the default value of automake_subdir to a
boolean False.
(GLConfig.getAutomakeSubdir, GLConfig.setAutomakeSubdir)
(GLConfig.resetAutomakeSubdir): New functions to access and manipulate
the automake_subdir option.
* pygnulib/GLEmiter.py (GLEmiter.shellvars_init): New function.
(GLEmiter.initmacro_end): Add second parameter 'gentests'. Use it to prefix each
object file name in *_LIBOBJS and *_LTLIBOBJS.
* pygnulib/GLError.py (GLError.__init__, GLError.__repr__): Add new
error for if --automake-subdir is used without the 'subdir-objects'
Automake option.
* pygnulib/GLImport.py (GLImport.__init__): Check for 'subdir-objects'
in Makefile.am.
(GLImport.actioncmd): Emit --automake-subdir in actioncmd.
(GLImport.gnulib_cache): Add gl_AUTOMAKE_SUBDIR to gnulib-cache.m4 if
--automake-subdir is used.
(GLImport.gnulib_comp): Update calls to GLEmiter.initmacro_end. Call
GLEmiter.shellvars_init.
(GLImport.execute): Likewise. Use the build-aux/prefix-gnulib-mk script.
* pygnulib/GLInfo.py (GLInfo.usage): Add --automake-subdir to the usage
message.
* pygnulib/GLTestDir.py (GLTestDir.execute): Update calls to
GLEmiter.initmacro_end. Call GLEmiter.shellvars_init.
* pygnulib/main.py (main): Add support for --automake-subdir.
Collin Funk [Sat, 9 Mar 2024 09:41:02 +0000 (01:41 -0800)]
gnulib-tool.py: Follow gnulib-tool changes, part 50.
Follow gnulib-tool changes
2021-12-12 Bruno Haible <bruno@clisp.org>
gnulib-tool: Try to support non-recursive-gnulib-prefix-hack with tests.
2021-12-13 Bruno Haible <bruno@clisp.org>
gnulib-tool: Fix mistake in last commit.
* pygnulib/GLImport.py (GLImport.gnulib_comp): Expect the filetable as a
parameter instead of a list of all files. Add type checks. Invoke
AC_CONFIG_LIBOBJ_DIR based on the location of alloca.c.
(GLImport.execute): Adjust call to GLImport.gnulib_comp to reflect
parameter changes.