Bruno Haible [Fri, 5 Apr 2024 02:11:22 +0000 (04:11 +0200)]
posix-modules: Sync auxiliary functions from gnulib-tool.sh.
* posix-modules (func_exit, func_fatal_error, func_readlink,
func_gnulib_dir): Move before func_usage and func_version. Incorporate
improvements from gnulib-tool.sh.
* pygnulib/.pylintrc: Don't emit warning messages suggesting that
'dict()' be converted to '{}'. This literal can be mistaken for sets,
see discussion here:
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00054.html>
* pygnulib/main.py: Document this convention in coding style section.
* pygnulib/GLFileSystem.py (GLFileAssistant.__init__): Convert an
occurrence of '{}' to 'dict()'.
* pygnulib/*.py: Use explicit exception chaining so that stack trace
messages do not seem like bugs. See examples in:
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00056.html>
quotearg: fix shell-escape quoting with single quotes
With shell-escape quoting, we misquoted strings
where the first and last characters required escaping,
while the string also contained single quotes.
* lib/quotearg.c (quotearg_buffer_restyled): Ensure that
pending_shell_escape_end is reset to the initial state
when reprocessing input due to single quotes.
* tests/test-quotearg-simple.c: Add a minimal test case.
* tests/test-quotearg.c: Likewise.
* tests/test-quotearg.h: Likewise.
Reported by Grisha Levit
* lib/renameatu.c(): Fall back to renameat() when
renameatx_np(RENAME_EXCL) returns "Function not implemented".
This issue was seen with macFUSE.
Reported at https://github.com/coreutils/coreutils/issues/79
gnulib-tool.py: Accept valid make syntax for escaped newlines.
* pygnulib/GLModuleSystem.py (GLModuleTable.add_dummy): Use
combine_lines instead of remove remove_backslash_newline so spaces are
added between each combined line.
* pygnulib/GLTestDir.py (GLTestDir.execute): Likewise.
* pygnulib/constants.py (remove_backslash_newline): Remove unused
function.
gnulib-tool.py: Don't default to 'build-aux' for --auxdir.
* pygnulib/GLConfig.py (GLConfig.__getitem__): Don't map '' to
'build-aux' for the 'auxdir' key.
* pygnulib/GLImport.py (GLImport.__init__): Change conditional to use an
empty string instead of None since this is returned when --auxdir is not
used.
Bruno Haible [Mon, 1 Apr 2024 19:50:51 +0000 (21:50 +0200)]
gnulib-tool.py: Use a standard Python program directory structure.
* pygnulib/main.py (main_with_exception_handling): New function for
existing code.
* .gnulib-tool.py: New file.
* pygnulib/constants.py: Update the computation of APP['root'].
* gnulib-tool.py: Don't set PYTHONPATH.
Bruno Haible [Sun, 31 Mar 2024 12:00:48 +0000 (14:00 +0200)]
gnulib-tool.py: Make a module's name immediately accessible.
* pygnulib/GLModuleSystem.py (GLModuleSystem.find): Pass the module name
to the GLModule constructor.
(GLModule.__init__): Accept the module's name as argument and store it.
(GLModule.getName): Simplify.
Collin Funk [Sat, 30 Mar 2024 10:23:46 +0000 (03:23 -0700)]
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.
Paul Eggert [Fri, 29 Mar 2024 22:56:45 +0000 (15:56 -0700)]
intprops: pacify GCC < 10 -Wsign-compare
Problem reported by Martin Dorey in:
https://savannah.gnu.org/bugs/index.php?65537
* lib/intprops-internal.h (_GL_INT_MULTIPLY_WRAPV):
When working around GCC bug 91450, pacify -Wsign-compare by
casting 0 to the result type.
Bruno Haible [Fri, 29 Mar 2024 21:48:37 +0000 (22:48 +0100)]
gnulib-tool: Use bold output on Linux, NetBSD, OpenBSD, OmniOS consoles.
Reported by Pádraig Brady in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-03/msg00399.html>.
* gnulib-tool.sh (func_show_module_list): Use 'tput' to determine the
"bold" capability of terminal types other than xterm*.
* pygnulib/constants.py (get_terminfo_string, bold_escapes): New
functions.
* pygnulib/GLTestDir.py (GLTestDir.execute): Invoke
constants.bold_escapes.
* pygnulib/GLImport.py (GLImport.prepare): Likewise.
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.