gnulib-tool.py: Don't use mutable default arguments.
* pygnulib/GLFileSystem.py (GLFileAssistant.__init__): Set the default
argument for 'transformers' to None. If it is None then set it to an
empty dictionary in the body.
Bruno Haible [Sat, 13 Apr 2024 23:38:42 +0000 (01:38 +0200)]
bootstrap: Implement phase 1 as documented in the --help output.
Reported by Simon Josefsson as bug #1 in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00152.html>.
* top/bootstrap: Correct indentation.
* top/bootstrap-funclib.sh (prepare_GNULIB_SRCDIR): Implement as
documented:
If GNULIB_SRCDIR and GNULIB_REVISION are set and there is a 'gnulib'
submodule, checkout the revision GNULIB_REVISION.
If GNULIB_SRCDIR and GNULIB_REVISION are set and --no-git is specified,
don't checkout the revision GNULIB_REVISION.
Bruno Haible [Sat, 13 Apr 2024 22:08:50 +0000 (00:08 +0200)]
bootstrap: Simplify git submodule initialization.
* top/bootstrap-funclib.sh (prepare_GNULIB_SRCDIR): Err out if git is
older than version 1.6.4. Remove fallback code for older versions.
* build-aux/bootstrap: Regenerated.
* pygnulib/GLConfig.py (GLConfig.update): Use list-merging for the test
categories.
* pygnulib/GLImport.py (GLImport.__init__): Don't merge back those
values which were already considered by taking the union.
* pygnulib/GLConfig.py (GLConfig.update): Don't test for the unused key
'tests'.
(GLConfig.default): Likewise.
* pygnulib/GLImport.py (GLImport.__init__): Don't merge back those
values which were already considered by taking the union.
* pygnulib/GLConfig.py (GLConfig.update): Don't test for the unused key
'tests'.
* pygnulib/GLImport.py (GLImport.__init__): Don't merge back those
values which were already considered by taking the union.
* pygnulib/GLConfig.py (GLConfig.default): For 'conddeps', return None,
not False.
(GLConfig.checkCondDeps): Update result type.
(resetCondDeps): Reset to return None, not False.
* pygnulib/GLImport.py (GLImport.actioncmd): Update.
* pygnulib/GLConfig.py (GLConfig.default): For 'conddeps', return None,
not False.
(GLConfig.checkCondDeps): Update result type.
(resetCondDeps): Reset to return None, not False.
* pygnulib/GLImport.py (GLImport.actioncmd): Update.
* pygnulib/GLConfig.py (GLConfig.default): For 'libtool', return None,
not False.
(GLConfig.checkLibtool): Update result type.
(resetLibtool): Reset to return None, not False.
* pygnulib/GLImport.py (GLImport.actioncmd): Update.
Bruno Haible [Fri, 12 Apr 2024 14:32:37 +0000 (16:32 +0200)]
gnulib-tool.py: Fix parsing of gnulib-cache.m4.
* pygnulib/GLImport.py (GLImport.__init__): While parsing
gnulib-cache.m4, stop parsing the identifier starting with 'gl_' when
encountering a character that is not a uppercase letter, digit, or
underscore.
Bruno Haible [Thu, 11 Apr 2024 19:49:45 +0000 (21:49 +0200)]
gnulib-tool.py: Optimize module set lookups.
* gnulib-tool.py (profiler_args): New variable.
* pygnulib/GLModuleSystem.py (GLModuleTable.transitive_closure): Turn
handledmodules into a set.
(GLModuleTable.transitive_closure_separately): For the 'in' test, use
a set variable main_modules_set.
gnulib-tool.py: Remove redundant backslashes from regexps.
* pygnulib/GLTestDir.py (GLTestDir.execute): Don't backslash ']' when it
is outside of a set.
* pygnulib/GLImport.py (GLImport.__init__): Don't use a backslash when
']' is at the start of a '[...]' set. Don't backslash special characters
in a '[...]' set since they have their meaning dropped.
* pygnulib/main.py (main): Likewise.
Bruno Haible [Wed, 10 Apr 2024 23:55:05 +0000 (01:55 +0200)]
gnulib-tool.py: Skip nonexistent modules instead of failing.
* pygnulib/GLModuleSystem.py (GLModuleSystem.find): Use the same warning
wording as gnulib-tool.sh.
* pygnulib/GLImport.py (GLImport.gnulib_cache): Print the specified
modules, not the base modules.
(GLImport.prepare): Don't put None elements into base_modules.
gnulib-tool.py: Use function arguments instead of magic numbers.
* pygnulib/GLEmiter.py (GLEmiter.autoconfSnippets): Remove the
'verifier' integer flag argument. Add the 'module_filter' function
argument. Use it to determine if Autoconf snippets should be printed for
each module.
* pygnulib/GLImport.py (GLImport.gnulib_comp): Update call to use a
lambda function.
* pygnulib/GLTestDir.py (GLTestDir.execute): Likewise.
gnulib-tool.py: Change the avoid list to a set for lookups.
* pygnulib/GLModuleSystem.py (GLModuleSystem.__init__): Store the
avoided modules in a set instead of a list. This is used only for
membership checks when computing the transitive closure of the given
modules, therefore prefer the O(1) average case over O(n).
gnulib-tool.py: Simplify use of GLModuleTable accessors.
* pygnulib/GLModuleSystem.py (GLModuleTable.__getitem__): Remove
function.
* pygnulib/GLImport.py (GLImport.gnulib_cache, GLImport.gnulib_comp)
(GLImport.execute): Use function calls on the GLModuleTable to access
module lists instead of using keys to emulate a dictionary.
Bruno Haible [Tue, 9 Apr 2024 11:08:32 +0000 (13:08 +0200)]
totalorder, totalorderf: Fix handling of SNaN on i386 and x86_64 CPUs.
* lib/totalorder.c: Include <string.h>.
(totalorder): Use memcpy to copy the 'double' values into the union.
Drop 'volatile'.
* lib/totalorderf.c: Include <string.h>.
(totalorderf): Use memcpy to copy the 'float' values into the union.
Drop 'volatile'.
gnulib-tool.py: Prefer 'list.append(item)' over 'list += [item]'.
* pygnulib/*.py: Change occurrences '+= [item]' to use '.append(item)'
where item is a single element added to the list.
See discussion here:
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00091.html>
* pygnulib/GLModuleSystem.py (GLModuleTable.getCondition): Add None to
the return type hint. This is the return value when the module is not a
conditional dependency.
gnulib-tool.py: Remove an unused and incorrect function.
* pygnulib/GLFileSystem.py (GLFileAssistant.removeFile): Remove this
unused function. The correct method of removing an element from a list
is to use the remove() function, not pop() which takes an index.
gnulib-tool.py: Omit some unnecessary list() calls around sorted().
* pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): Remove the list()
call in the argument to sorted. The sorted() function works on any
iterable and always returns a list.
* pygnulib/GLImport.py (GLImport.rewrite_old_files)
(GLImport.rewrite_new_files): Likewise.
* pygnulib/GLModuleSystem.py (GLModuleTable.transitive_closure)
(GLModuleTable.transitive_closure_separately): Likewise.
* pygnulib/GLTestDir.py (GLTestDir.rewrite_files): Likewise.
Reported by Collin Funk in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00036.html>.
* m4/pthread_h.m4 (gl_PTHREAD_H_PART1): New macro, extracted from
gl_PTHREAD_H.
(gl_PTHREAD_H): Require it. Define using AC_DEFUN.
* m4/pthread-spin.m4 (gl_PTHREAD_SPIN): Require gl_PTHREAD_H_PART1,
not only gl_PTHREAD_H_DEFAULTS.
gnulib-tool.py: Don't allow path normalization to delete a variable.
* pygnulib/GLModuleSystem.py
(GLModule.getAutomakeSnippet_Unconditional): Use os.path.join() on the
Makefile variable so it isn't deleted by a following '..' from
os.path.norm().
gnulib-tool.py: Use auxdir as given by AC_CONFIG_AUX_DIR.
* pygnulib/GLImport.py (GLImport.__init__): Don't modify the path given
by AC_CONFIG_AUX_DIR by prefixing it with destdir. Use a more strict
regular expression instead of cleaner().
gnulib-tool.py: Locate configure.ac correctly when --dir is given.
* pygnulib/GLConfig.py (GLConfig.setAutoconfFile): Don't combine the
given file name argument with destdir.
* pygnulib/main.py (main): Use os.path.join() instead of joinpath() when
constructing the path to the configure.ac file. The latter normalizes
paths which causes the test suite to fail when printed in files.
Bruno Haible [Sat, 6 Apr 2024 10:01:59 +0000 (12:01 +0200)]
expm1l: Work around a NetBSD 10.0/i386 bug.
* m4/expm1l.m4 (gl_FUNC_EXPM1L): Test the value of
expm1l(2^LDBL_MIN_EXP).
* doc/posix-functions/expm1l.texi: Mention the NetBSD 10.0/i386 bug.
* tests/test-expm1.h (test_function): Allow more deviation on
NetBSD/i386.
Bruno Haible [Fri, 5 Apr 2024 14:04:59 +0000 (16:04 +0200)]
roundl: Fix a link error on Linux/powerpc64le.
* m4/check-math-lib.m4 (gl_CHECK_MATH_LIB): Accept an additional TYPE
argument.
* m4/isfinite.m4 (gl_ISFINITE): Use the type 'double'.
* m4/isinf.m4 (gl_ISINF): Likewise.
* m4/round.m4 (gl_FUNC_ROUND): Likewise.
* m4/roundf.m4 (gl_FUNC_ROUNDF): Use the type 'float'.
* m4/roundl.m4 (gl_FUNC_ROUNDL): Use the type 'long double'.
gnulib-tool.py: Use 'Any' instead of type unions in GLConfig.
* pygnulib/GLConfig.py (GLConfig.__getitem__, GLConfig.dictionary)
(GLConfig.default, GLConfig.isdefault, GLConfig.values): Use 'Any' from
the typing module instead of large type unions. This silences unhelpful
warnings from type checkers.
* pygnulib/GLImport.py (GLImport.prepare): Create a set directly instead
of creating a list and passing it to a call of set().
(GLImport.__init__): Likewise. Use max() instead of getting the last
element of a sorted list.
* pygnulib/GLModuleSystem.py (GLModuleSystem.list): Use run() instead of
Popen() from the subprocess module. This function handles cleanup
internally instead of as a context manager via the 'with' statement.
posix-modules, all-modules: Fix --version output using git options.
* all-modules (func_version): Pass --format and --date options to git
so the output does not depend on the user's configuration. Pass
'-n 1' to speed up the operation, since we only need the first entry.
* posix-modules (func_version): Likewise.
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.