pygnulib/GLModuleSystem.py


Log

Author Commit Date CI Message
Pádraig Brady 7b089321 2025-01-01T09:24:36 maint: run 'make update-copyright'
Bruno Haible ab4cc5f2 2024-12-05T09:43:14 gnulib-tool.py: Fix invalid use of cache. * pygnulib/GLModuleSystem.py (GLModule._getDependents): Make the modules argument mandatory. Don't store the result in self.cache.
Bruno Haible 5efa7c42 2024-12-05T09:28:13 gnulib-tool.py: Refactor. * pygnulib/GLModuleSystem.py (GLModuleSystem.getAllModules): Moved here from GLModule._getAllModules. No need to eliminate empty module names. (GLModule._getDependents, GLModule.getDependentsRecursively): Update.
Bruno Haible d72b2930 2024-12-05T09:14:49 gnulib-tool.py: Remove dead code. * pygnulib/GLModuleSystem.py (GLModule.getDependents): Remove top_level parameter. Use the cached value if present. * pygnulib/main.py: Update accordingly.
Collin Funk ac562bbf 2024-12-04T18:49:45 gnulib-tool.py: Make --extract-dependents quick again. Suggested by Bruno Haible in: <https://lists.gnu.org/archive/html/bug-gnulib/2024-12/msg00012.html>. * pygnulib/GLModuleSystem.py (GLModule.getDependents): Add an optional argument to use the implementation before yesterdays change. * pygnulib/main.py (mode == 'extract-dependents'): Add the optional argument to call of GLModule.getDependents.
Collin Funk 1e0fff5e 2024-12-03T19:17:52 gnulib-tool.py: Optimize --extract-recursive-dependencies. * pygnulib/GLModuleSystem.py (GLModuleSystem.list): Add optional argument to include test modules. (GLModule._getDependents) New function. (GLModule.getDependents): Use it. (GLModule.getDependentsRecursively): Likewise. (GLModule._getAllModules): New function.
Bruno Haible 7b6f844b 2024-08-29T18:32:35 gnulib-tool.py: Allow verifying license compatibility with GPLv2+. * pygnulib/GLInfo.py (GLInfo.usage): Document the --gpl option. * pygnulib/main.py (main): Accept a --gpl option. Pass it to the GLConfig. * pygnulib/GLConfig.py (GLConfig): Add 'gpl' field and constructor argument. Add getGPL, setGPL, resetGPL methods. * m4/gnulib-tool.m4 (gl_GPL): New macro. * doc/gnulib-tool.texi (Modified imports): Document the gl_GPL macro. * pygnulib/GLImport.py (GLImport.__init__): Look for gl_GPL invocations in gnulib-cache.m4. (GLImport.actioncmd): Output --gpl option when option --gpl was given. (GLImport.gnulib_cache): Emit a gl_GPL invocation when option --gpl was given. (GLImport.prepare): Do license compatibility checking when option --gpl was given. * pygnulib/GLModuleSystem.py: Update a comment.
Bruno Haible 5c735437 2024-08-16T18:24:54 gnulib-tool.py: Correct the result of --extract-dependents. * pygnulib/GLModuleSystem.py (GLModule.getDependents): Add the current module's test module, if that exists.
Bruno Haible b254680d 2024-08-16T17:57:02 gnulib-tool.py: Don't treat 'valgrind-tests' as a tests module. Reported by Marc Nieper-Wißkirchen <marc.nieper+gnu@gmail.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2024-08/msg00093.html>. * pygnulib/GLModuleSystem.py (_isTestsModuleName): New function. (GLModuleSystem.list, GLModule.isNonTests, GLModule.getApplicability, GLModule.getDependencies, GLModule.getAutomakeSnippet_Unconditional, GLModule.getLicense): Use it.
Bruno Haible da8e6e13 2024-08-03T17:04:55 gnulib-tool.py: Small refactoring. Suggested by Collin Funk. * pygnulib/GLModuleSystem.py (GLModule.getDependenciesRecursively): Return a set of GLModule. * pygnulib/main.py (main): Convert the result to a string here.
Collin Funk 2f400ffc 2024-08-02T20:52:28 gnulib-tool.py: Correct type hint and doc string. * pygnulib/GLModuleSystem.py (GLModule.getDependentsRecursively): Adjust type hint and doc string to correctly state a set of GLModule's is returned.
Bruno Haible e0de8e47 2024-07-29T01:26:51 gnulib-tool.py: New options --extract-[recursive-]dependents. * pygnulib/GLInfo.py (GLInfo.usage): Document --extract-dependents and --extract-recursive-dependents options. * pygnulib/GLModuleSystem.py (GLModule.getDependenciesRecursively): Move method. (getDependents, getDependentsRecursively): New methods. * pygnulib/main.py (main): Add support for --extract-dependents and --extract-recursive-dependents.
Bruno Haible 8f2cda7d 2024-07-28T23:52:04 gnulib-tool.py: Avoid adding specific modules to a testdir. Reported by Paul Eggert in <https://lists.gnu.org/archive/html/bug-gnulib/2024-07/msg00292.html>. * pygnulib/GLInfo.py (GLInfo.usage): Document --extract-usability-in-testdir option. * pygnulib/GLModuleSystem.py (GLModule.section_label_pattern): Recognize Usable-in-testdir section. (GLModule.getUsabilityInTestdir): New function. * pygnulib/GLTestDir.py (GLTestDir.execute): Invoke it to filter out modules to avoid. Warn if such a module was specified. * pygnulib/main.py (main): Add support for --extract-usability-in-testdir. Provide an error message for error 24. * pygnulib/GLError.py: Likewise. * modules/config-h (Usable-in-testdir): New section. * modules/lib-ignore (Usable-in-testdir): New section. * modules/mountlist (Usable-in-testdir): New section. * modules/non-recursive-gnulib-prefix-hack (Usable-in-testdir): New section. * modules/timevar (Usable-in-testdir): New section. (Files): Remove lib/timevar.def.
Bruno Haible 94046e1c 2024-07-28T23:38:45 gnulib-tool.py: Fix an exception message. * pygnulib/GLModuleSystem.py (GLModuleSystem.find): Raise error 23, not 3. * pygnulib/GLError.py: Provide an error message for error 23. * pygnulib/main.py: Likewise.
Collin Funk 7a99ec18 2024-06-15T05:42:18 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.
Collin Funk 790206bf 2024-06-14T21:55:48 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.
Collin Funk c1cdc5ef 2024-06-03T04:57:14 gnulib-tool.py: Use a set to optimize. * pygnulib/GLModuleSystem.py (GLModule.getAutomakeSnippet_Unconditional): Call set() on the result of _extract_lib_SOURCES() to ensure computing the difference between another set is O(n).
Collin Funk 26d76031 2024-06-02T22:32:39 gnulib-tool.py: Refactor duplicated regular expressions. * pygnulib/GLModuleSystem.py (_LIB_SOURCES_PATTERN): New variable. (_extract_lib_SOURCES): New function. (GLModule.getAutomakeSnippet_Unconditional): Use the new function. (GLModuleTable.add_dummy): Likewise. Add a second break statement to stop unnecessary looping.
Collin Funk 1b74469a 2024-05-29T02:35:02 gnulib-tool.py: Don't emit non-ASCII shell output. Reported by Bruno Haible in <https://lists.gnu.org/archive/html/bug-gnulib/2024-05/msg00441.html>. * pygnulib/GLModuleSystem.py (GLModule.shell_id_chars): Use the re.ASCII flag for the regular expression.
Collin Funk 001302d0 2024-05-28T23:26:19 gnulib-tool.py: Add missing docstring. * pygnulib/GLModuleSystem.py (GLModule.getShellId): Add docstring forgotten in the previous commit.
Collin Funk eacd6153 2024-05-28T21:55:12 gnulib-tool.py: Simplify creation of module shell ids. * pygnulib/GLModuleSystem.py (GLModule.shell_id_chars): Remove class variable. (GLModule.shell_id_pattern): New class variable. (GLModule.getShellId): New function. (GLModule.getShellFunc, GLModule.getShellVar) (GLModule.getConditionalName): Use it.
Collin Funk 6c3614c1 2024-05-11T21:45:12 gnulib-tool.py: Filter out dependencies that cannot be found. Reported by Paul Eggert in <https://lists.gnu.org/archive/html/bug-gnulib/2024-05/msg00136.html>. * pygnulib/GLModuleSystem.py (GLModule.getDependenciesWithConditions): Reorder conditionals to avoid duplicate checks. Filter out None from the gathered dependencies when gathering module dependencies. Let GLModuleSystem.find() warn instead of crashing.
Collin Funk e91650b1 2024-05-07T17:10:23 gnulib-tool.py: Handle module dependencies that cannot be found. * pygnulib/GLModuleSystem.py (GLModule.getDependenciesWithoutConditions): Filter out None from the module dependencies. An appropriate warning will already be printed by GLModuleSystem.find().
Collin Funk ecdab13f 2024-05-01T02:21:43 gnulib-tool.py: Fix mistake in previous commit. * pygnulib/GLModuleSystem.py (GLModuleSystem.exists) (GLModuleSystem.find): Rename 'module' argument to 'module_name' so it is clear they are not a GLModule object. Treat them as such.
Collin Funk ffde9905 2024-05-01T01:12:18 gnulib-tool.py: Use the GLModule's name variable directly. * pygnulib/GLModuleSystem.py (GLModule.getName): Remove function. (GLModule.__str__, GLModule.__repr__, GLModule.isNonTests) (GLModule.repeatModuleInTests, GLModule.getDependenciesRecursively) (GLModule.getShellFunc, GLModule.getShellVar) (GLModule.getConditionalName, GLModule.getApplicability) (GLModule.getDependencies, GLModule.getAutomakeSnippet_Unconditional) (GLModule.getLicense, GLModuleSystem.find) (GLModuleTable.transitive_closure): Use the GLModule's name instance variable instead of using str() or removed getName() function. * pygnulib/GLEmiter.py (GLEmiter.autoconfSnippet) (GLEmiter.preEarlyMacros, GLEmiter.lib_Makefile_am) (GLEmiter.tests_Makefile_am): Likewise. * pygnulib/GLImport.py (GLImport.gnulib_comp, GLImport.prepare): Likewise. * pygnulib/GLTestDir.py (GLTestDir.execute, GLMegaTestDir.execute): Likewise.
Collin Funk 134f6b8a 2024-04-30T01:09:55 gnulib-tool.py: Remove remaining unused instance variables. * pygnulib/GLModuleSystem.py (GLModule.__init__) (GLModuleTable.__init__): Remove the unused GLFileSystem variable. These classes perform lookups with a GLModuleSystem. * pygnulib/GLTestDir.py (GLTestDir.__init__): Remove the unused GLFileAssistant variable. The transformations it performs are not needed in testdirs.
Collin Funk 20061b49 2024-04-29T22:20:31 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.
Collin Funk 379b3a02 2024-04-23T11:28:19 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.
Collin Funk 5b1dcad0 2024-04-20T20:29:44 gnulib-tool.py: Don't fail when given a bad module name. * pygnulib/GLTestDir.py (GLTestDir.execute): Don't include None in the list of GLModule objects. * pygnulib/GLModuleSystem.py (GLModuleSystem.find): Document the meaning of the None return.
Collin Funk 544b6f6e 2024-04-19T23:42:24 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.
Collin Funk b9fa78e2 2024-04-19T12:00:33 gnulib-tool.py: Make use of GLModule's __hash__ method. * pygnulib/GLModuleSystem.py (GLModuleTable.addUnconditional) (GLModuleTable.isConditional): Use the GLModule object instead of the module name directly. (GLModuleTable.addConditional, GLModuleTable.getCondition): Likewise. Use a tuple of two GLModule objects as a key for the conditionals dictionary.
Collin Funk efc1cb63 2024-04-19T11:32:44 gnulib-tool.py: Simplify data structures for dependencies. * pygnulib/GLModuleSystem.py (GLModuleTable.__init__): Use a defaultdict for dependers to remove the base initialization case. (GLModuleTable.addConditional): Use a set to disallow duplicates instead of performing list lookups.
Bruno Haible 344f8683 2024-04-19T18:21:26 gnulib-tool.py: Simplify running some commands in a given directory. * pygnulib/GLImport.py (GLImport.execute): Use sp.call with a cwd argument, instead of calling chdir twice. * pygnulib/GLModuleSystem.py (GLModuleSystem.list): Likewise. * pygnulib/main.py (mode=='find'): Likewise.
Collin Funk 33530824 2024-04-18T10:46:33 gnulib-tool.py: Remove some unused instance variables. * pygnulib/GLModuleSystem.py (GLModuleSystem.__init__) (GLModule.__init__): Remove unused 'args' instance variable.
Collin Funk 5ee99431 2024-04-16T20:21:04 gnulib-tool.py: Fix a pylint 'attribute-defined-outside-init' warning. * pygnulib/GLModuleSystem.py (GLModuleTable.transitive_closure): Don't define a 'modules' attribute since it is never used.
Collin Funk daa21fd2 2024-04-16T12:13:08 gnulib-tool.py: Make GLModule's __eq__ and __hash__ method agree. * pygnulib/GLModuleSystem.py (GLModuleTable.__hash__): Only use the module name in hash computations.
Collin Funk 886f8476 2024-04-16T08:36:55 gnulib-tool.py: Prefer 'not in' over 'not ... in'. * pygnulib/GLEmiter.py (GLEmiter.autoconfSnippet): Change conditional. * pygnulib/GLModuleSystem.py (GLModuleTable.addConditional): Likewise.
Collin Funk 5097cf4b 2024-04-16T08:21:27 gnulib-tool.py: Make data structures more clear. * pygnulib/GLModuleSystem.py (GLModuleTable.__init__): Use a set to represent the unconditional modules instead of a dictionary. Remove redundant comments. (GLModuleTable.addUnconditional): Add the module to a set instead of using it as a key to the dictionary.
Collin Funk cb7e1bb2 2024-04-14T10:31:34 gnulib-tool.py: Write newlines consistently. * pygnulib/constants.py (NL): Remove variable. * pygnulib/GLImport.py (GLImport.gnulib_comp): Use '\n' instead of constants.NL. * pygnulib/GLModuleSystem.py (GLModule.getAutomakeSnippet_Unconditional): Likewise. * pygnulib/main.py (main_with_exception_handling): Likewise.
Collin Funk aaabd2eb 2024-04-14T10:18:03 gnulib-tool.py: Don't perform newline conversions. * pygnulib/constants.py (nlconvert): Remove function. Remove unused platform import. * pygnulib/GLImport.py (GLImport.gnulib_cache): Remove calls to nlconvert(). * pygnulib/GLModuleSystem.py (GLModule.getAutomakeSnippet_Unconditional): Likewise. * pygnulib/GLTestDir.py (GLTestDir.execute, GLMegaTestDir.execute): Likewise.
Collin Funk 3897b2b1 2024-04-14T09:37:17 gnulib-tool.py: Remove some unused variable assignments. * pygnulib/GLEmiter.py (GLEmiter.autoconfSnippets): Remove unused variable. * pygnulib/GLInfo.py (GLInfo.date, GLInfo.version): Remove assignments to variables unconditionally set in try, except blocks. * pygnulib/GLModuleSystem.py (GLModule.getConditionalName) (GLModule.getShellFunc, GLModule.getShellVar): Likewise.
Bruno Haible 3258dcae 2024-04-13T12:55:44 gnulib-tool.py: Stop using codecs.open. * pygnulib/*.py: To open a file, consistently use open(..., mode='[rwa]', newline='\n', encoding='utf-8').
Bruno Haible 40970e22 2024-04-12T18:11:46 gnulib-tool.py: Fix handling of --with-obsolete. * pygnulib/constants.py (TESTS): Remove 'obsolete' category. * pygnulib/GLConfig.py (GLConfig.__init__): Add optional incobsolete parameter. (GLConfig.default): Handle 'incobsolete'. (GLConfig.checkIncObsolete, GLConfig.setIncObsolete, GLConfig.resetIncObsolete): New methods. * pygnulib/GLModuleSystem.py (GLModuleSystem.transitive_closure): For incobsolete, use new GLConfig methods. * pygnulib/GLImport.py (GLImport.__init__, GLImport.actioncmd, GLImport.gnulib_cache): Likewise. * pygnulib/main.py (main): Pass the incobsolete value to the GLConfig constructor.
Bruno Haible f948d181 2024-04-11T21:49:45 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.
Bruno Haible ab3425fa 2024-04-11T01:55:05 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.
Collin Funk 760841f1 2024-04-09T09:11:03 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).
Collin Funk 8bf54d5b 2024-04-09T08:55:02 gnulib-tool.py: Remove unused setter and getter functions. * pygnulib/GLModuleSystem.py (GLModuleTable.getAvoids) (GLModuleTable.setAvoids): Remove these unused functions.
Collin Funk 7166faa4 2024-04-09T00:01:49 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.
Collin Funk 965b5c72 2024-04-08T16:08:50 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>
Collin Funk bc45779c 2024-04-07T22:22:49 gnulib-tool.py: Fix incomplete type hint. * 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.
Collin Funk 0340fb97 2024-04-07T22:00:48 gnulib-tool.py: Remove unnecessary conditional. * pygnulib/GLModuleSystem.py (GLModuleTable.__getitem__): Don't check if the key is valid twice.
Collin Funk 5ac9d876 2024-04-07T18:49:24 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.
Collin Funk 2c49dc45 2024-04-06T06:04:52 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().
Collin Funk 9dd17159 2024-04-04T20:32:55 gnulib-tool.py: Fix 'consider-using-with' pylint warnings. * 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.
Collin Funk 51e46581 2024-04-03T02:56:42 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.
Collin Funk 519a00ed 2024-04-02T11:35:51 gnulib-tool.py: Use [] instead of list() to initialize empty lists. * pygnulib/*.py: Change occurrences of list() to [].
Collin Funk fadccab2 2024-04-02T04:41:22 gnulib-tool.py: Fix determination whether to add the dummy module. * pygnulib/GLModuleSystem.py (GLModuleSystem.add_dummy): Only match the 'lib_SOURCES' variable; stop at end-of-line.
Collin Funk bd7a7a93 2024-04-02T03:58:37 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.
Bruno Haible 52a5f9e3 2024-04-02T13:42:53 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.
Collin Funk a225216d 2024-04-01T01:18:17 gnulib-tool.py: Fix --extract-tests-module with a test module. * pygnulib/GLModuleSystem.py (GLModule.getTestsName): Return the module name with '-tests' appended to it unconditionally.
Collin Funk 5e564e16 2024-03-30T20:51:22 gnulib-tool.py: Fix sorting of modules when --local-dir is used. * pygnulib/GLModuleSystem.py (GLModule.__eq__, GLModule.__ne__) (GLModule.__ge__, GLModule.__gt__, GLModule.__hash__, GLModule.__le__) (GLModule.__lt__): Use module names as identifiers instead of paths.
Bruno Haible b8c1a30f 2024-03-31T14:00:48 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 aa3eb8a6 2024-03-30T03:23:46 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.
Collin Funk 148b623a 2024-03-27T00:56:29 gnulib-tool.py: Add type hints to all functions. * pygnulib/*.py: Add type hints and remove duplicate function signatures from docstrings.
Bruno Haible 50a20932 2024-03-25T00:07:49 gnulib-tool.py: Use Python raw strings for regular expressions. * pygnulib/*.py: Use raw string syntax for regular expression pattern strings and repl strings.
Bruno Haible 63025526 2024-03-24T01:28:49 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 15c5c2f0 2024-03-22T02:15:24 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.
Collin Funk 5fe5043b 2024-03-20T19:07:50 gnulib-tool.py: Fix --extract-recursive-link-directive. * pygnulib/GLModuleSystem.py (GLModule.getLinkDirectiveRecursively): Check the 'Link:' section of each individual module. Use sets instead of lists to remove duplicates.
Collin Funk e8af5902 2024-03-20T17:51:55 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.
Collin Funk 0bfce9c5 2024-03-18T16:26:34 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.
Bruno Haible dd2b72a8 2024-03-18T12:02:01 gnulib-tool.py: Tweak last change. * pygnulib/GLModuleSystem.py (GLModule.isTests, GLModule.isNonTests): Update comments.
Collin Funk 79094b45 2024-03-17T20:09:12 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.
Bruno Haible 2d1da7b3 2024-03-18T00:43:53 gnulib-tool.py: Handle empty lists of lines consistently. * pygnulib/constants.py (lines_to_multiline): New function. (nlremove): Remove unused function. * pygnulib/GLEmiter.py (_eliminate_NMD): Use lines_to_multiline instead of the '\n'.join idiom. (GLEmiter.autoconfSnippet, GLEmiter.autoconfSnippets, GLEmiter.lib_Makefile_am): Likewise. * pygnulib/GLImport.py (GLImport._update_ignorelist_, GLImport.execute): Likewise. * pygnulib/GLModuleSystem.py (GLModule.getDependenciesRecursively, GLModule.getLinkDirectiveRecursively, GLModuleTable.remove_if_blocks): Likewise. * pygnulib/GLTestDir.py (GLTestDir.execute): Likewise. * pygnulib/main.py (main): Likewise.
Collin Funk 64687446 2024-03-17T14:51:18 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.
Collin Funk 53ebed87 2024-03-16T19:56:42 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.
Collin Funk 1859765c 2024-03-16T18:49:35 gnulib-tool.py: Follow gnulib-tool changes, part 60. Follow gnulib-tool change 2019-11-18 Bruno Haible <bruno@clisp.org> gnulib-tool: Fix build error on macOS with --conditional-dependencies. * pygnulib/GLModuleSystem.py (GLModuleTable.add_dummy): Ignore modules that are conditionally enabled.
Collin Funk ed162c19 2024-03-16T07:20:39 gnulib-tool.py: Coding style: Avoid not(). * pygnulib/GLModuleSystem.py (isNonTests): Avoid not(). Write 'not condition' instead of 'not(condition)'.
Bruno Haible e08233e8 2024-03-16T14:19:06 gnulib-tool.py: Coding style: Avoid bool(). * pygnulib/GLModuleSystem.py (GLModule): Write False instead of bool().
Collin Funk d776a13e 2024-03-14T18:41:05 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 35458449 2024-03-02T04:59:04 gnulib-tool.py: Make output of test Makefile.am match gnulib-tool. * pygnulib/GLModuleSystem.py (GLModule.getAutomakeSnippet_Unconditional): Don't sort EXTRA_DIST file names for test modules.
Collin Funk fc43b15e 2024-02-29T15:31:17 gnulib-tool.py: Follow gnulib-tool changes, part 36. Follow gnulib-tool change 2017-03-14 Mathieu Lirzin <mthl@gnu.org> gnulib-tool: don't automatically distribute files from top/ * pygnulib/GLModuleSystem.py (GLModule.getAutomakeSnippet_Unconditional): Don't distribute files from top/ automatically.
Collin Funk d20a1e2d 2024-02-28T19:05:16 gnulib-tool.py: Follow gnulib-tool changes, part 33. Follow gnulib-tool change 2017-03-14 Bruno Haible <bruno@clisp.org> gnulib-tool: Don't produce a tests directory with only snippet .h files. * pygnulib/GLModuleSystem.py (GLModuleTable.transitive_closure_separately): Don't create a test directory if all test related modules have applicability 'all'.
Collin Funk 8badfcce 2024-02-26T21:22:23 gnulib-tool.py: Follow gnulib-tool changes, part 29. Follow gnulib-tool change 2021-03-06 Paul Eggert <eggert@cs.ucla.edu> parse-datetime2: fix licensing * pygnulib/GLModuleSystem.py (GLModule.getLicense): Handle the special licensing case for parse-datetime2 or any other module starting with "parse-datetime". Update comment.
Collin Funk 992d5548 2024-02-22T20:16:18 gnulib-tool.py: Follow gnulib-tool changes, part 27. Follow gnulib-tool changes 2017-03-12 Paul Eggert <eggert@cs.ucla.edu> gnulib-tool: new option --gnu-make 2017-03-13 Paul Eggert <eggert@cs.ucla.edu> gnulib-tool: minor --gnu-make fixups 2017-03-14 Paul Eggert <eggert@cs.ucla.edu> gnulib-tool: fix typo in comment output 2017-05-14 Paul Eggert <eggert@cs.ucla.edu> gnulib-tool: improve GNU Make debugging 2018-07-04 Paul Eggert <eggert@cs.ucla.edu> gnulib-tool: minor tweaks for --gnu-make * gnulib-tool.py (main): Add --gnu-make option. Do not allow --gnu-make in test modes, since they all require Automake. * pygnulib/GLConfig.py: Add gnu_make argument to constructor. (getGnuMake, setGnuMake, resetGnuMake): New methods for accessing the gnu_make instance variable. * pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): Use the "+=" operator with GNU Make and Automake. Transform conditionals to GNU Make syntax if --gnu-make is in use. Use a Autoconf subprocess to define values and check the return code for errors. (GLEmiter.tests_Makefile_am): Likewise. * pygnulib/GLImport.py (GLImport.actioncmd): Add "--gnu-make" to the output comment if it is in use. (GLImport.gnulib_comp): Don't require "AM_PROG_CC_C_O" when using GNU Make. * pygnulib/GLInfo.py (GLInfo.usage): Update help message to reflect addition of --gnu-make. * pygnulib/GLModuleSystem.py (GLModuleTable.transitive_closure): Don't add Automake snippets as unconditional dependencies when using --gnu-make.
Simon Josefsson 5b92dd0a 2024-01-01T10:31:48 maint: run 'make update-copyright'
Bruno Haible 3ad13621 2023-05-18T16:03:00 gnulib-tool: Ignore .orig and .rej files under modules/. * gnulib-tool (func_sanitize_modulelist): Exclude also files whose name ends in .orig or .rej. * pygnulib/GLModuleSystem.py (GLModuleSystem.file_is_module): Likewise.
Simon Josefsson 32a72f45 2023-01-01T01:14:21 maint: run 'make update-copyright'
Bruno Haible 62fa8fc7 2022-08-10T00:51:59 gnulib-tool.py: Finish implementing option --conditional-dependencies. * gnulib-tool.py (main) Accept options --conditional-dependencies, --no-conditional-dependencies. * pygnulib/GLModuleSystem.py (GLModuleTable.addConditional): Use str(module), not module, as key. Fix logic bug. (GLModuleTable.getCondition): Simplify. (GLModuleTable.transitive_closure): Show a warning when there are duplicate dependencies. Fix logic bug. (GLModuleTable.transitive_closure_separately): Simplify. (GLModuleTable.add_dummy): Ignore tests modules. Cope with multiple lib_SOURCES augmentation lines. Cope with comments at the end of a lib_SOURCES augmentation line. Add the dummy module at the end of the modules list. * pygnulib/GLTestDir.py (GLTestDir.execute): Remove the code that forces the dummy module to the end of the list. * pygnulib/GLEmiter.py (GLEmiter.autoconfSnippets): Add code to terminate the shell functions. Add code for the dependencies from the unconditional to the conditional modules. Don't emit AM_CONDITIONAL for unconditional modules.
Bruno Haible 501feeb5 2022-08-08T21:22:15 gnulib-tool.py: Fixes for conditional dependencies. * pygnulib/GLModuleSystem.py (GLModule.shell_id_chars): New constant. (GLModule.getShellFunc): Don't use md5 just because of an '_' character. (GLModule.getShellVar): Likewise. (GLModule.getConditionalName): Include a newline in the md5 input. * pygnulib/constants.py (ALPHANUMERIC): Remove constant.
Bruno Haible d0e09431 2022-08-08T18:42:45 gnulib-tool.py: Refactor. * pygnulib/GLModuleSystem.py (GLModule.getLicense): Separate the warning logic from the result logic.
Bruno Haible 276c20ee 2022-08-08T00:02:59 gnulib-tool.py: Fix --extract-dependencies result. * pygnulib/GLModuleSystem.py (GLModule.getDependencies): Return a snippet, not a list. Implement dependency of ${module}-tests on ${module}. (GLModule.getDependenciesWithoutConditions, GLModule.getDependenciesWithConditions): New methods. (GLModuleTable.transitive_closure): Call getDependenciesWithConditions. * pygnulib/GLEmiter.py (GLEmiter.autoconfSnippets): Call getDependenciesWithoutConditions. * gnulib-tool.py (main) [--extract-dependencies]: Update.
Bruno Haible d528738a 2022-08-07T22:59:08 gnulib-tool.py: Rename a method. * pygnulib/GLModuleSystem.py (GLModule.getAutoconfEarlySnippet): Renamed from GLModule.getAutoconfSnippet_Early. * pygnulib/GLImport.py: Update. * pygnulib/GLTestDir.py: Likewise.
Bruno Haible 81b8c4d5 2022-08-07T22:53:32 gnulib-tool.py: Fix section extraction from module descriptions. The code with self.content.split(section)[-1] was broken because it recognizes an indented section label. Similar code with ('\n' + self.content).split('\n' + section)[-1] would still be broken because it recognizes an indented section label in the first line of the file. The code with section_label_regex was broken because sometimes it returns the second-to-last section with the given label, not the last one. Also, whitespace after the colon was not ignored. * pygnulib/GLModuleSystem.py (GLModule.__init__): Dissect the module description's contents immediately, once only, in a reliable way. (GLModule.getDescription, GLModule.getComment): Simplify. (GLModule.getStatus): Simplify. Return a string. (GLModule.getStatuses): New function. Return a list. (GLModule.getNotice, GLModule.getApplicability, GLModule.getFiles, GLModule.getDependencies, GLModules.getAutoconfSnippet_Early, GLModules.getAutoconfSnippet, GLModule.getAutomakeSnippet_Conditional, GLModule.getInclude, GLModule.getLink, GLModule.getLicense_Raw): Simplify. (GLModule.getLicense): Remove whitespace after calling getLicense_Raw. (GLModule.getMaintainer): Simplify. (GLModuleTable.transitive_closure): Call getStatuses() instead of getStatus(). * pygnulib/GLEmiter.py: Likewise. * gnulib-tool.py (main): For --extract-description, --extract-comment, --extract-status, --extract-notice, --extract-autoconf-snippet, --extract-automake-snippet, --extract-include-directive, --extract-link-directive, --extract-maintainer, don't add an extra newline after the snippet.
Bruno Haible 586000e5 2022-08-07T20:04:56 gnulib-tool.py: Improve field naming. * pygnulib/GLModuleSystem.py (GLModule): Rename field 'module' to 'path'. Fix a typo in a TypeError message.
Bruno Haible 9b2a7c80 2022-08-07T19:26:51 gnulib-tool.py: Simplify. * pygnulib/GLModuleSystem.py (GLModule): Convert Windows newlines right after reading the module description, not in every accessor.
Bruno Haible 8341b4a2 2022-08-07T17:29:16 gnulib-tool.py: Reduce code duplication. * pygnulib/GLModuleSystem.py (GLModule): Declare two regexes are class variables.
Bruno Haible 72ac0235 2022-08-07T17:02:21 gnulib-tool.py: Implement option --find. * pygnulib/GLModuleSystem.py (GLModuleSystem.file_is_module): New method. (GLModuleSystem.list): Filter the listing in memory; don't use a 'sed' subprocess. * gnulib-tool.py (main): Handle mode 'find'.
Bruno Haible 5c087011 2022-08-07T13:46:15 gnulib-tool.py: Fix some regex uses. * pygnulib/GLModuleSystem.py (GLModuleTable.transitive_closure): Match the regex against all lines of the snippet, not only the first line. * pygnulib/GLEmiter.py (GLEmiter.autoconfSnippet): Likewise.
Bruno Haible 9d722ddc 2022-08-07T13:40:07 gnulib-tool.py: Make regex uses more straightforward. * pygnulib/constants.py: Don't use the "minimal matching" *? construct when it makes no difference (because we're matching a single line only and flag re.M is not specified). * pygnulib/GLModuleSystem.py: Likewise.
Bruno Haible 54bf87fe 2022-08-07T13:29:59 gnulib-tool.py: Make regex uses more straightforward. * pygnulib/GLModuleSystem.py: Don't use flag re.S on regular expressions that are meant to match a single line only, and remove the use of the "minimal matching" *? construct whose only purpose was to neutralize the re.S flag. * pygnulib/GLEmiter.py: Likewise. * pygnulib/GLImport.py: Likewise. * pygnulib/GLTestDir.py: Likewise.