1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2026-10-24 00:48:56 +03:00
Commit Graph

49 Commits

Author SHA1 Message Date
Bruno Haible
11d02ecc71 gnulib-tool.py: Fix default handling for --local-{symlink,hardlink}.
* pygnulib/GLConfig.py (GLConfig.__init__): Allow lcopymode to remain
None.
(GLConfig.default): Change lcopymode's default to be None.
(GLConfig.checkLCopyMode): Update signature.
(GLConfig.resetLCopyMode): Change default value to None.
* pygnulib/GLFileSystem.py (GLFileSystem.shouldLink): Update.
2026-03-06 09:47:50 +01:00
Collin Funk
a8482ceecf maint: run 'make update-copyright' 2026-01-01 10:37:05 -08:00
Pádraig Brady
7b08932179 maint: run 'make update-copyright' 2025-01-01 09:25:10 +00:00
Collin Funk
7a99ec181a gnulib-tool.py: Revert previous change.
* pygnulib/constants.py (joinpath): Restore function and remove unused
local variable.
(relativize, symlink_relative, as_link_value_at_dest, hardlink): Use it.
* pygnulib/GLConfig.py (resetAutoconfFile): Likewise.
* pygnulib/GLEmiter.py (lib_Makefile_am, tests_Makefile_am): Likewise.
* pygnulib/GLFileSystem.py (lookup, shouldLink, tmpfilename, add)
(update, add_or_update, super_update): Likewise.
* pygnulib/GLImport.py (__init__, relative_to_currdir)
(_done_dir_, _update_ignorelist_, prepare, execute): Likewise.
* pygnulib/GLInfo.py (version): Likewise.
* pygnulib/GLMakefileTable.py (parent): Likewise.
* pygnulib/GLModuleSystem.py (exists, find, getFiles)
(getAutomakeSnippet_Unconditional): Likewise.
* pygnulib/GLTestDir.py (_patch_test_driver, execute): Likewise.
* pygnulib/main.py (main): Likewise.
2024-06-15 05:42:18 -07:00
Collin Funk
790206bfe7 gnulib-tool.py: Simplify joining paths.
* pygnulib/constants.py (joinpath): Remove function. It is equivalent to
os.path.normpath(os.path.join(...)) where the os.path.normpath is
typically not needed.
(relativize, symlink_relative, as_link_value_at_dest, hardlink): Use
os.path.join instead of joinpath.
* pygnulib/GLConfig.py (resetAutoconfFile): Likewise.
* pygnulib/GLEmiter.py (lib_Makefile_am, tests_Makefile_am): Likewise.
* pygnulib/GLFileSystem.py (lookup, shouldLink, tmpfilename, add)
(update, add_or_update, super_update): Likewise.
* pygnulib/GLInfo.py (version): Likewise.
* pygnulib/GLMakefileTable.py (parent): Likewise.
* pygnulib/GLTestDir.py (_patch_test_driver, execute): Likewise.
* pygnulib/main.py (main): Likewise.
* pygnulib/GLModuleSystem.py (exists, find, getFiles): Likewise.
* pygnulib/GLImport.py (__init__, relative_to_currdir)
(_done_dir_, _update_ignorelist_, prepare, execute): Likewise.
(getAutomakeSnippet_Unconditional): Likewise. Add a comment about not
using os.path.normpath() to protect a Make variable.
2024-06-14 21:55:48 -07:00
Collin Funk
adc6d632af gnulib-tool.py: Quote file names passed to 'patch'.
* pygnulib/GLTestDir.py (_patch_test_driver): Import shlex and cleanup
unused imports. Use shlex.quote() on the file names passed to 'patch'.
* pygnulib/GLFileSystem.py (GLFileSystem.lookup): Likewise. Perform
redirection using sp.call() arguments instead of using the shell.
2024-05-01 21:26:34 -07:00
Collin Funk
20061b4960 gnulib-tool.py: Add type hints to classes.
* pygnulib/*.py: Add type hints for all instance and class variables.
* pygnulib/GLMakefileTable.py (GLMakefileTable.__getitem__): Fix return
type hint since the dictionary has str values.
2024-04-29 22:20:31 -07:00
Collin Funk
379b3a0271 gnulib-tool.py: Make better use of imports.
* pygnulib/*.py: Import functions from constants.py directly instead of
assigning them to module-specific variable. Keep the module prefix for
standard library functions.
2024-04-23 11:28:19 -07:00
Collin Funk
544b6f6e1b gnulib-tool.py: Remove duplicate per-module definitions.
* pygnulib/constants.py: Remove duplicate __authors__, __license__, and
__copyright__ definitions.
* pygnulib/GLInfo.py: Use the value of __authors__ and __copyright__
from __init__.py for output.
* pygnulib/*.py: Remove unused references to the constant.py
definitions.
2024-04-20 23:59:29 +02:00
Collin Funk
f67b0b14dd 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.
2024-04-14 08:10:50 +02:00
Bruno Haible
3258dcae2d gnulib-tool.py: Stop using codecs.open.
* pygnulib/*.py: To open a file, consistently use
open(..., mode='[rwa]', newline='\n', encoding='utf-8').
2024-04-13 12:55:44 +02:00
Collin Funk
f41781a97f gnulib-tool.py: Use single-quotes for strings.
* pygnulib/*.py: Change double-quoted strings to use single-quotes
unless doing so would require adding backslashes.
2024-04-09 03:26:34 +02:00
Collin Funk
965b5c72cb 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>
2024-04-09 03:21:20 +02:00
Collin Funk
f2a22fc726 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.
2024-04-08 20:37:06 +02:00
Collin Funk
a4b2df9d5a gnulib-tool.py: Ignore 'use-dict-literal' warnings.
* 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()'.
2024-04-05 02:57:44 +02:00
Collin Funk
6b97d9047a gnulib-tool.py: Fix pylint 'raise-missing-from' warnings.
* 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>
2024-04-05 02:57:44 +02:00
Collin Funk
51e4658149 gnulib-tool.py: Modernize class declarations to Python 3.
* pygnulib/GLConfig.py: Remove the explicit object inheritance from
class declarations. This is previously required in Python 2.
* pygnulib/GLEmiter.py: Likewise.
* pygnulib/GLFileSystem.py: Likewise.
* pygnulib/GLImport.py: Likewise.
* pygnulib/GLInfo.py: Likewise.
* pygnulib/GLMakefileTable.py: Likewise.
* pygnulib/GLModuleSystem.py: Likewise.
* pygnulib/GLTestDir.py: Likewise.
2024-04-04 01:11:56 +02:00
Collin Funk
519a00edc9 gnulib-tool.py: Use [] instead of list() to initialize empty lists.
* pygnulib/*.py: Change occurrences of list() to [].
2024-04-02 21:18:16 +02:00
Bruno Haible
52a5f9e36e gnulib-tool: Remove unused variables.
* pygnulib/GLConfig.py: Remove unused variables.
* pygnulib/GLEmiter.py: Likewise.
* pygnulib/GLFileSystem.py: Likewise.
* pygnulib/GLImport.py: Likewise.
* pygnulib/GLInfo.py: Likewise.
* pygnulib/GLModuleSystem.py: Likewise.
* pygnulib/GLTestDir.py: Likewise.
* pygnulib/main.py: Likewise.
* gnulib-tool.sh (func_emit_tests_Makefile_am): Remove unused variable
perhapsLT.
2024-04-02 13:42:53 +02:00
Bruno Haible
e3274bb212 gnulib-tool.py: Remove unused imports.
* pygnulib/GLFileSystem.py: Remove unused imports.
* pygnulib/GLEmiter.py: Likewise.
(GLEmiter.autoconfSnippets): Fix type assertion message.
2024-04-02 13:39:26 +02:00
Bruno Haible
bf2f566269 gnulib-tool.py: Simplify imports.
* pygnulib/enums.py: New file, extracted from pygnulib/GLFileSystem.py.
* pygnulib/classes.py: Remove file.
* pygnulib/GLFileSystem.py: Remove class CopyAction. Update imports.
* pygnulib/GLTestDir.py: Update imports.
* pygnulib/GLConfig.py: Update imports and remove 'classes.' prefix.
* pygnulib/main.py: Likewise.
2024-04-02 01:06:15 +02:00
Bruno Haible
142fec3cb2 gnulib-tool.py: Fix breakage that I introduced with Collin's last patch.
* pygnulib/GLFileSystem.py (GLFileAssistant.add_or_update): Correct the
open calls.
2024-03-28 03:21:52 +01:00
Collin Funk
d6d189fd1c 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.
2024-03-28 02:19:27 +01:00
Collin Funk
148b623a3f gnulib-tool.py: Add type hints to all functions.
* pygnulib/*.py: Add type hints and remove duplicate function signatures
from docstrings.
2024-03-27 17:21:34 +01:00
Collin Funk
d64fd23bdc gnulib-tool.py: Follow gnulib-tool changes, part 62.
Follow gnulib-tool change
2020-02-22  Bruno Haible  <bruno@clisp.org>
gnulib-tool: Ensure copied files are writable.

* pygnulib/constants.py (ensure_writable): New function. Make sure files
are writable.
(symlink_relative, hardlink): Use it.
* pygnulib/GLFileSystem.py (GLFileSystem.lookup)
(GLFileAssistant.add_or_update): Likewise.
* pygnulib/GLTestDir.py (GLTestDir.execute): Likewise.
* pygnulib/main.py (main): Likewise.
2024-03-17 18:34:45 +01:00
Collin Funk
dc22237603 gnulib-tool.py: Don't try to remove files that don't exist.
* pygnulib/GLFileSystem.py (GLFileSystem.add_or_update): Check if the
temporary file exists before trying to remove it.
2024-03-17 12:01:03 +01:00
Collin Funk
cb62687680 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.
2024-03-16 14:01:37 +01:00
Simon Josefsson
5b92dd0a45 maint: run 'make update-copyright' 2024-01-01 10:31:48 +01:00
Simon Josefsson
32a72f4537 maint: run 'make update-copyright' 2023-01-01 01:14:21 +01:00
Bruno Haible
ad534101bd gnulib-tool.py: Refactor --makefile-name option.
* gnulib-tool.py (main): Rename variable 'makefile' to 'makefile_name'.
* pygnulib/GLConfig.py: Rename attribute 'makefile' to 'makefile_name'.
* pygnulib/GLMakefileTable.py: Update.
* pygnulib/GLEmiter.py: Likewise.
* pygnulib/GLImport.py: Likewise.
* pygnulib/GLFileSystem.py (GLFileAssistant): Remove unused assignment.
2022-08-05 23:15:39 +02:00
Bruno Haible
45b3978734 gnulib-tool.py: Fix 'Unused import' warnings.
* gnulib-tool.py: Remove unused imports.
* pygnulib/*.py: Likewise.
2022-08-05 17:15:20 +02:00
Bruno Haible
eb194fa7a5 gnulib-tool.py: Fix 'Undefined variable' errors.
* pygnulib/constants.py: Import codecs.
* pygnulib/GLConfig.py (GLConfig.setLibName): Fix local variable
reference.
* pygnulib/GLFileSystem.py (GLFileSystem.lookup,
GLFileAssistant.update): Fix local variable references.
* pygnulib/GLEmiter.py (GLEmiter.po_POTFILES_in): Fix reference.
* pygnulib/GLTestDir.py (GLMegaTestDir.execute): Define missing local
variables.
2022-08-05 15:15:16 +02:00
Bruno Haible
362f779b9d gnulib-tool.py: Coding style: Revisit line breaks.
* gnulib-tool.py: Avoid line breaks at arbitrary points inside
expressions. Use line breaks to clarify [... for ...] iterations.
* pygnulib/*.py: Likewise.
2022-08-04 22:19:36 +02:00
Bruno Haible
2a33db9653 gnulib-tool.py: Use mainstream/GNU coding style.
* gnulib-tool.py: Break lines before the % operator, not after.
* pygnulib/*.py: Likewise. Avoid line breaks when the resulting lines
are not too long.
2022-08-04 18:26:08 +02:00
Bruno Haible
ed7b3d9bb8 gnulib-tool.py: Avoid errors when writing to a VFAT file system, part 2.
* pygnulib/constants.py (movefile): New function.
* pygnulib/*.py: Use it instead of shutil.
2022-08-03 14:27:51 +02:00
Bruno Haible
dbc9a4b304 gnulib-tool.py: Avoid errors when writing to a VFAT file system.
* pygnulib/constants.py (copyfile, copyfile2): New functions.
* gnulib-tool.py: Use them instead of shutil.
* pygnulib/*.py: Likewise.
2022-08-03 11:27:21 +02:00
Bruno Haible
6bdf668e57 gnulib-tool.py: Follow gnulib-tool changes, part 19.
Follow gnulib-tool changes
2015-12-09  Pavel Raiskup  <praiskup@redhat.com>
gnulib-tool: allow multiple --local-dir usage
2019-02-14  Bruno Haible  <bruno@clisp.org>
gnulib-tool: Improve handling of multiple --local-dir options.

* gnulib-tool (func_reconstruct_cached_dir): When the argument is
absolute, return it unmodified.
(func_compute_relative_local_gnulib_path): Renamed from
func_count_relative_local_gnulib_path. Add comment.
* gnulib-tool.py: Accept multiple --local-dir options and collect the
values into localpath.
* pygnulib/GLConfig.py: Take a localpath argument instead of a localdir
argument.
(getLocalDir, setLocalDir, resetLocalDir): Remove methods.
(getLocalPath, setLocalPath, resetLocalPath): New methods.
* pygnulib/GLFileSystem.py (CopyAction): New class.
(GLFileSystem.lookup): Consider all dirs in localpath.
(GLFileSystem.shouldLink): New method.
(GLFileAssistant): Use shouldLink.
* pygnulib/GLModuleSystem.py (GLModuleSystem.exists): Iterate over all
dirs in localpath.
(GLModuleSystem.list): Likewise.
* pygnulib/GLEmiter.py: Update.
* pygnulib/GLImport.py (GLImport.__init__): Put the argument of
gl_LOCAL_DIR into localpath, not localdir.
(GLImport.actioncmd): Consider all dirs in localpath.
(GLImport.relative_to_destdir, GLImport.relative_to_currdir): New
methods.
(GLImport.gnulib_cache): Combine all dirs in localpath. Use
self.relative_to_destdir.
* pygnulib/GLTestDir.py (GLTestDir.execute): Use shouldLink.
2022-07-31 23:52:27 +02:00
Bruno Haible
dd7b332f80 gnulib-tool.py: Clean up imports.
* gnulib-tool.py: Remove unused constants.
* pygnulib/*.py: Likewise.
2022-07-31 07:07:43 +02:00
Bruno Haible
0a624ee7dc gnulib-tool.py: Assume Python 3.
* gnulib-tool.py: Don't allow 'bytes' as an alternative to 'str'.
* pygnulib/*.py: Likewise.
2022-07-31 07:07:40 +02:00
Bruno Haible
d2abfb903c gnulib-tool.py: Assume Python 3.
* gnulib-tool.py: Don't set PYTHON3, string. Use str instead of string.
* pygnulib/*.py: Likewise.
2022-07-31 07:07:32 +02:00
Bruno Haible
5d39cdb46a gnulib-tool.py: Modernize coding style.
* pygnulib/*.py: Remove parentheses around raise value expressions.
2022-07-31 07:07:24 +02:00
Bruno Haible
0bc144f966 gnulib-tool.py: Modernize coding style.
* pygnulib/*.py: Remove parentheses around return value expressions.
2022-07-29 18:45:33 +02:00
Bruno Haible
3e44e3bb0c gnulib-tool.py: Modernize the file headers.
* pygnulib/*.py: Remove '#!/usr/bin/python' (not needed) and
'encoding: UTF-8' lines (default in Python 3). Add copyright notice.
2022-07-29 16:42:14 +02:00
Bruno Haible
07a187be7f gnulib-tool.py: follow gnulib-tool changes, part 14
Follow gnulib-tool change
2015-08-20  Daiki Ueno  <ueno@gnu.org>
gnulib-tool: don't transform binary files with sed
2017-09-09 17:28:03 +02:00
Bruno Haible
e321e9c303 gnulib-tool.py: follow gnulib-tool changes, part 12
Follow gnulib-tool change
2015-02-03  Pádraig Brady  <P@draigBrady.com>
gnulib-tool: fix handling of patch(1) diagnostics
2017-09-09 16:29:00 +02:00
Bruno Haible
f0e4c4b6f6 gnulib-tool.py: follow gnulib-tool changes, part 3
Follow gnulib-tool change
2012-08-26  Bruno Haible  <bruno@clisp.org>
gnulib-tool: Remove no-op option --no-changelog.

* pygnulib/constants.py: Remove FILES dictionary.
* pygnulib/*: Update.
2017-09-09 16:28:52 +02:00
Dmitry Selyutin
21c52a8244 [pygnulib] autopep8 (fixing indentation, style, etc.) 2017-09-08 18:34:58 +03:00
Dmitry Selyutin
3df6660534 gnulib-tool.py: fix errors on building wget2; use UTF-8 in subprocess 2017-09-08 17:27:55 +03:00
Dmitry Selyutin
02a1f93ea2 [pygnulib] initial merge (including some small bug fixes) 2017-09-08 17:27:55 +03:00