summaryrefslogtreecommitdiff
path: root/pygnulib
Commit message (Collapse)AuthorAgeFilesLines
* gnulib-tool: For conditional dependencies, generate portable sh code.Po Lu2023-04-261-1/+1
| | | | | | * gnulib-tool (func_emit_autoconf_snippets): Avoid sh syntax 'if ! variable', that does not work with Solaris /bin/sh. * pygnulib/GLEmiter.py (GLEmiter.autoconfSnippets): Likewise.
* maint: run 'make update-copyright'Simon Josefsson2023-01-0112-12/+12
|
* gnulib-tool.py: Fix some code generation details.Bruno Haible2022-08-131-38/+26
| | | | | | | | | | * pygnulib/GLEmiter.py: Don't produce Windows CR-LFs on Windows. (GLEmiter.po_Makevars): Emit a definition of top_builddir, not top_subdir. (GLEmiter.po_POTFILES_in): Fix result when sourcebase is 'tests' or something like that. (GLEmiter.initmacro_start): Add two more newlines (mistake from 2021-04-11).
* gnulib-tool.py: Reduce code duplication.Bruno Haible2022-08-133-24/+21
| | | | | | | * pygnulib/constants.py (relinverse): New function. * pygnulib/GLEmiter.py (GLEmiter.po_Makevars, GLEmiter.tests_Makefile_am): Use it. * pygnulib/GLTestDir.py (GLTestDir.execute): Likewise.
* gnulib-tool.py: Finish implementing option --conditional-dependencies.Bruno Haible2022-08-104-55/+116
| | | | | | | | | | | | | | | | | | | | | * 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.
* gnulib-tool.py: Don't do license replacements in the autoconf snippets.Bruno Haible2022-08-093-44/+21
| | | | | | | | | * pygnulib/GLEmiter.py (GLEmiter.autoconfSnippet): Remove fileassistant argument. Don't invoke the 'aux' transformer here. Don't produce Windows CR-LFs on Windows. (GLEmiter.autoconfSnippets): Remove fileassistant argument. * pygnulib/GLImport.py (GLImport.gnulib_comp): Update all callers. * pygnulib/GLTestDir.py (GLTestDir.execute): Likewise.
* gnulib-tool.py: Fix some code generation details.Bruno Haible2022-08-092-114/+105
| | | | | | | | | | | | | | | | | | | | | * pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): When removing a lib_LDFLAGS line, remove also the newline. Fix regex that matches lib_SOMETHING. Add a newline after each '## begin gnulib module' line. Don't emit 'endif' lines without corresponding 'if'. When emitting a '+=' augmentation, make sure it does not get emitted a second time. Don't emit a blank line when there is no AM_CPPFLAGS augmentation. Update after getLink() changed. In the value of DEFAULT_TEXT_DOMAIN, backslash-escape the double-quotes. Don't produce Windows CR-LFs on Windows. Simplify. (GLEmiter.tests_Makefile_am): When removing a lib_LDFLAGS line, remove also the newline. Fix regex that matches lib_SOMETHING. Don't remove a blank line before EXTRA_DIST. Add a newline after each '## begin gnulib module' line. Set uses_subdirs also when there is a .c file in a subdir of tests/. When emitting a '+=' augmentation, make sure it does not get emitted a second time. Don't produce Windows CR-LFs on Windows. Simplify. * pygnulib/GLImport.py (GLImport.execute): Update after getLink() changed.
* gnulib-tool.py: Fixes for conditional dependencies.Bruno Haible2022-08-092-36/+37
| | | | | | | | * 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.
* gnulib-tool.py: Refactor.Bruno Haible2022-08-091-10/+11
| | | | | * pygnulib/GLModuleSystem.py (GLModule.getLicense): Separate the warning logic from the result logic.
* gnulib-tool.py: Fix --extract-dependencies result.Bruno Haible2022-08-082-24/+63
| | | | | | | | | | | | * 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.
* gnulib-tool.py: Rename a method.Bruno Haible2022-08-073-5/+5
| | | | | | | * pygnulib/GLModuleSystem.py (GLModule.getAutoconfEarlySnippet): Renamed from GLModule.getAutoconfSnippet_Early. * pygnulib/GLImport.py: Update. * pygnulib/GLTestDir.py: Likewise.
* gnulib-tool.py: Fix section extraction from module descriptions.Bruno Haible2022-08-072-291/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* gnulib-tool.py: Improve field naming.Bruno Haible2022-08-071-20/+18
| | | | | * pygnulib/GLModuleSystem.py (GLModule): Rename field 'module' to 'path'. Fix a typo in a TypeError message.
* gnulib-tool.py: Simplify.Bruno Haible2022-08-071-12/+1
| | | | | * pygnulib/GLModuleSystem.py (GLModule): Convert Windows newlines right after reading the module description, not in every accessor.
* gnulib-tool.py: Reduce code duplication.Bruno Haible2022-08-071-61/+23
| | | | | * pygnulib/GLModuleSystem.py (GLModule): Declare two regexes are class variables.
* gnulib-tool.py: Implement option --find.Bruno Haible2022-08-071-32/+27
| | | | | | | | * 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'.
* gnulib-tool.py: Fix some regexes.Bruno Haible2022-08-072-3/+3
| | | | | | * pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): Use an equivalent regex as gnulib-tool. * pygnulib/GLTestDir.py (GLTestDir.execute): Likewise.
* gnulib-tool.py: Fix some regex uses.Bruno Haible2022-08-072-2/+2
| | | | | | * 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.
* gnulib-tool.py: Make regex uses more straightforward.Bruno Haible2022-08-072-2/+2
| | | | | | | * 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.
* gnulib-tool.py: Make regex uses more straightforward.Bruno Haible2022-08-074-24/+24
| | | | | | | | | | * 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.
* gnulib-tool.py: Make regex uses more straightforward.Bruno Haible2022-08-072-5/+5
| | | | | | * pygnulib/GLEmiter.py: Don't use flag re.S on regular expressions on regular expressions with no '.'. * pygnulib/GLImport.py: Likewise.
* gnulib-tool: In the VC files messages, omit the destination directory.Bruno Haible2022-08-061-7/+7
| | | | | | | | | This makes these messages consistent with the other "Copying ..." and "Creating ..." messages. * gnulib-tool (func_import): Omit $destdir/ from the "Updating"/ "Creating" messages regarding .gitignore files. * pygnulib/GLImport.py (GLImport._update_ignorelist_): Likewise.
* gnulib-tool.py: Fix output in --dry-run mode.Bruno Haible2022-08-061-1/+1
| | | | | * pygnulib/GLImport.py (GLImport._update_ignorelist_): In dry-run mode, say "Update", not "Updating".
* gnulib-tool.py: Finish implementing options --vc-files, --no-vc-files.Bruno Haible2022-08-062-32/+32
| | | | | | | | | * gnulib-tool.py (main): Accept options --vc-files, --no-vc-files. * pygnulib/GLImport.py (GLImport.__init__): Correct parsing of gl_VC_FILES directive. (GLImport.gnulib_cache): Don't treat the value False like None. (GLImport.execute): Skip the .gitignore file manipulations if vc_files is False.
* gnulib-tool.py: Finish implementing option --witness-c-macro.Bruno Haible2022-08-061-8/+1
| | | | | | * gnulib-tool.py (main): Accept option --witness-c-macro. * pygnulib/GLConfig.py (GLConfig.__init__): Remove wrong type check of witness_c_macro argument.
* gnulib-tool.py: Finish implementing option --po-domain.Bruno Haible2022-08-062-6/+8
| | | | | | | | | * gnulib-tool.py (main): Accept option --po-domain. * pygnulib/GLEmiter.py (GLEmiter.po_POTFILES_in): Fix variable reference. * pygnulib/GLImport.py (GLImport.execute): Don't delete Makefile.in.in from the gnulib directory. Don't require a shell when invoking wget. After invoking wget, restore the current directory.
* gnulib-tool.py: Remove redundant type checks.Bruno Haible2022-08-051-53/+18
| | | | | | | * pygnulib/GLConfig.py (GLConfig.__init__): Remove redundant type checks, left over from 2022-08-04. (GLConfig.getIncludeGuardPrefix): Improve comment. (GLConfig.resetMacroPrefix): Optimize.
* gnulib-tool.py: Refactor --makefile-name option.Bruno Haible2022-08-055-51/+50
| | | | | | | | | * 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.
* gnulib-tool.py: Fix link_if_changed function.Bruno Haible2022-08-051-15/+27
| | | | | | | | * pygnulib/constants.py (joinpath): Fix comment. (as_link_value_at_dest): New function, extracted from link_relative. (link_relative): Use it. (link_if_changed): Really don't replace the symbolic link if it does not need to change.
* gnulib-tool.py: Fix 'Unused import' warnings.Bruno Haible2022-08-058-33/+0
| | | | | * gnulib-tool.py: Remove unused imports. * pygnulib/*.py: Likewise.
* gnulib-tool.py: Fix 'Undefined variable' errors.Bruno Haible2022-08-055-5/+9
| | | | | | | | | | | * 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.
* gnulib-tool.py: Make option --version work.Bruno Haible2022-08-052-32/+60
| | | | | | | | | | | | | | | * pygnulib/constants.py (__copyright__): Bump copyright year. * pygnulib/GLInfo.py (GLInfo.authors): Add a comma after the second-to-last author. (GLInfo.copyright): Show only the last modification year. (GLInfo.date): Check whether git and GNU date are available. Use 'git log ChangeLog', not 'git log'. Run 'git log' in the gnulib directory, not in the current directory. Search for 'Date:' only at the beginning of a line. As a fallback, look at the first ChangeLog entry. (GLInfo.version): Check whether git is available. Run git-version-gen in the gnulib directory, not in the current directory. Replace '-dirty' with '-modified'. As a fallback, return the empty string. * gnulib-tool.py (main) [--version]: Add a space before the version.
* gnulib-tool.py: Simplify.Bruno Haible2022-08-055-63/+53
| | | | | | * pygnulib/constants.py (compiler): Remove function. * gnulib-tool.py: Use re.compile directly instead. * pygnulib/*.py: Likewise.
* gnulib-tool.py: Fix typo.Bruno Haible2022-08-041-1/+1
| | | | | * pygnulib/GLImport.py (GLImport.execute): Actually handle file removals.
* gnulib-tool.py: Coding style: Revisit line breaks.Bruno Haible2022-08-048-277/+336
| | | | | | * gnulib-tool.py: Avoid line breaks at arbitrary points inside expressions. Use line breaks to clarify [... for ...] iterations. * pygnulib/*.py: Likewise.
* gnulib-tool.py: Simplify boolean setters.Bruno Haible2022-08-043-113/+84
| | | | | | | | | | | | | | | | | | * pygnulib/GLConfig.py (setLibtool): New method, replaces enableLibtool and disableLibtool. (setCondDeps): New method, replaces enableCondDeps and disableCondDeps. (setVCFiles): New method, replaces enableVCFiles and disableVCFiles. (setSymbolic): New method, replaces enableSymbolic and disableSymbolic. (setLSymbolic): New method, replaces enableLSymbolic and disableLSymbolic. (setLibtests): New method, replaces enableLibtests and disableLibtests. (setSingleConfigure): New method, replaces enableSingleConfigure and disableSingleConfigure. (setDryRun): New method, replaces enableDryRun and disableDryRun. (setErrors): New method, replaces enableErrors and disableErrors. (__init__): Update. * pygnulib/GLImport.py: Likewise. * pygnulib/GLTestDir.py: Likewise.
* gnulib-tool.py: Implement options --cache-modules, --no-cache-modules.Bruno Haible2022-08-043-35/+3
| | | | | | | | * gnulib-tool.py (main): Accept options --cache-modules, --no-cache-modules. * pygnulib/GLConfig.py: Remove modcache property and constructor argument. * pygnulib/GLInfo.py (GLInfo.usage): Don't document these no-op options.
* gnulib-tool.py: Use mainstream/GNU coding style.Bruno Haible2022-08-048-272/+239
| | | | | | * gnulib-tool.py: Break lines before the % operator, not after. * pygnulib/*.py: Likewise. Avoid line breaks when the resulting lines are not too long.
* gnulib-tool.py: Follow gnulib-tool changes, part 24.Bruno Haible2022-08-041-23/+27
| | | | | | | | | | | Follow gnulib-tool change 2017-02-19 Bruno Haible <bruno@clisp.org> gnulib-tool: Avoid conflict of havelib-tests with --single-configure. * pygnulib/GLTestDir.py (GLTestDir.__init__): Don't allocate the GLModuleTable here. (GLTestDir.execute): Do it here. Avoid havelib-tests when --with-tests --single-configure is specified.
* gnulib-tool.py: Respect the specified module list.Bruno Haible2022-08-041-18/+19
| | | | | * pygnulib/GLTestDir.py (GLTestDir.execute): Don't remove specific modules (ftruncate, mountlist, etc.) from the specified module list.
* gnulib-tool.py: Implement option --avoid.Bruno Haible2022-08-042-73/+72
| | | | | | | | | | | * pygnulib/GLModuleSystem.py (GLModuleTable.__init__): Compute the effective avoids list here. (GLModuleTable.transitive_closure, GLModuleTable.add_dummy): Consider the avoids list. * pygnulib/GLImport.py (GLImport.gnulib_cache): Use the avoids list from GLConfig directly. (GLImport.prepare): No need any more to set the avoids list in the GLModuleTable.
* gnulib-tool.py: Make --with/--without-*-tests handling a little safer.Bruno Haible2022-08-041-2/+6
| | | | | | * pygnulib/GLConfig.py (__init__): Fix reset* invocations. setInclTestCategories, setExclTestCategories): Revert to old value if the new value is invalid.
* gnulib-tool.py: Implement option --single-configure.Bruno Haible2022-08-041-1/+0
| | | | | | * gnulib-tool.py (main): Accept option --single-configure. Pass its value to the GLConfig constructor. * pygnulib/GLTestDir.py (GLTestDir.execute): Remove debugging output.
* gnulib-tool.py: Implement options --without-c++-tests etc.Bruno Haible2022-08-046-142/+206
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * gnulib-tool.py (main): Accept options --without-c++-tests, --without-longrunning-tests, --without-privileged-tests, --without-unportable-tests. Improve error message for --copy-file with invalid number of arguments. Check for invalid options given in --import, --add-import, --remove-import, --update modes. Pass both sets of test categories to the GLConfig constructor. * pygnulib/GLConfig.py (GLConfig.__init__): Accept incl_test_categories and excl_test_categories instead of testflags. (checkInclTestCategory): Renamed from checkTestFlag. (enableInclTestCategory): Renamed from enableTestFlag. (disableInclTestCategory): Renamed from disableTestFlag. (getInclTestCategories): Renamed from getTestFlags. (setInclTestCategories): Renamed from setTestFlags. (resetInclTestCategories): Renamed from resetTestFlags. (setInclTestCategory, checkExclTestCategory, enableExclTestCategory, disableExclTestCategory, getExclTestCategories, setExclTestCategories, resetExclTestCategories): New methods. * pygnulib/GLModuleSystem.py (GLModuleTable.__init__): Accept two booleans as second and third constructor arguments. (transitive_closure): Correct the determination of whether to include each module, depending on the with-* and without-* options. (transitive_closure_separately): Update. * pygnulib/GLMakefileTable.py: Update. * pygnulib/GLImport.py (__init__, actioncmd, gnulib_cache, execute): Update. * pygnulib/GLTestDir.py (GLTestDir.__init__, GLTestDir.execute, GLMegaTestDir.__init__): Update.
* gnulib-tool.py: Fix broken 'for' loop.Bruno Haible2022-08-031-1/+0
| | | | | | * gnulib-tool.py (main): Canonicalize inctests before creating the GLConfig. Rewrite a broken 'for' loop. * pygnulib/GLConfig.py (GLConfig.setTestFlags): Remove unused statement.
* gnulib-tool.py: Follow gnulib-tool changes, part 23.Bruno Haible2022-08-034-29/+54
| | | | | | | | | | | | | | | | | | | | Follow gnulib-tool changes 2016-11-11 Bruno Haible <bruno@clisp.org> gnulib-tool: Support for the dual "LGPLv3+ or GPLv2" license. 2016-12-02 Nikos Mavrogiannopoulos <nmav@gnutls.org> gnulib-tool (func_import): Adhere to the license guideline ... 2016-12-02 Daiki Ueno <ueno@gnu.org> gnulib-tool (func_import): Relax the regex ... * gnulib-tool.py: For --lgpl, accept value 3orGPLv2. * pygnulib/GLInfo.py (GLInfo.usage): Update. * pygnulib/GLConfig.py (GLConfig.setLGPL): Update argument check. * pygnulib/GLImport.py (GLImport.__init__, GLImport.gnulib_cache): Update gl_LGPL handling. (GLImport.prepare): Update license compatibility checks and license header rewriting. * pygnulib/GLTestDir.py (GLTestDir.execute): Update license compatibility checks. Handle also the licenses GPLv3+, GPL, LGPLv3+.
* gnulib-tool.py: Fix unjustified "incompatible license" warnings.Bruno Haible2022-08-031-16/+19
| | | | | | * pygnulib/GLTestDir.py (GLTestDir.execute): Don't emit a warning when the dependency module has a license such as "public domain" or "unlimited".
* gnulib-tool.py: Follow gnulib-tool changes, part 22.Bruno Haible2022-08-031-9/+15
| | | | | | | | | Follow gnulib-tool change 2016-10-15 Bruno Haible <bruno@clisp.org> Avoid gnulib-tool warnings about the dependencies of 'parse-datetime'. * pygnulib/GLModuleSystem.py (GLModule.getLicense): Special-case the 'parse-datetime' module.
* gnulib-tool.py: Follow gnulib-tool changes, part 21.Bruno Haible2022-08-031-2/+5
| | | | | | | | | Follow gnulib-tool change 2016-10-16 Bruno Haible <bruno@clisp.org> gnulib-tool: Make --create-testdir on all modules work again. * pygnulib/GLTestDir.py (GLTestDir.execute): Don't include the non-recursive-gnulib-prefix-hack module.
* gnulib-tool.py: Follow gnulib-tool changes, part 20.Bruno Haible2022-08-031-3/+23
| | | | | | | | | | | | | Follow gnulib-tool changes 2016-01-15 Paul Eggert <eggert@cs.ucla.edu> gnulib-tool: don't assume ln -s works 2016-01-24 Paul Eggert <eggert@cs.ucla.edu> gnulib-tool: don't give up on ln -s so easily 2017-06-08 Bruno Haible <bruno@clisp.org> gnulib-tool: Fix bug in func_ln_s, from 2016-01-15. * pygnulib/constants.py (symlink_relative): New function. (link_relative): Use it instead of os.symlink.