Today's changes:
2022-08-05 Bruno Haible <[email protected]>
gnulib-tool.py: Don't initialize local variables too early.
* gnulib-tool.py (main): Initialize each local variable in one place.
I prefer to have pylint tell me about uninitialized variables than to
get the value None at runtime.
gnulib-tool.py: Finish implementing option --po-domain.
* 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: Finish implementing option --macro-prefix.
* gnulib-tool.py (main): Accept option --macro-prefix.
gnulib-tool.py: Refactor --makefile-name option.
* gnulib-tool.py (main): Handle option --makefile-name like all other
string-valued options.
gnulib-tool.py: Implement option --no-libtool.
* gnulib-tool.py (main): Accept option --no-libtool.
gnulib-tool.py: Remove redundant type checks.
* 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.
* 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.
* 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.
* gnulib-tool.py: Remove unused imports.
* pygnulib/*.py: Likewise.
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.
gnulib-tool.py: Make option --version work.
* 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.
* pygnulib/constants.py (compiler): Remove function.
* gnulib-tool.py: Use re.compile directly instead.
* pygnulib/*.py: Likewise.
>From 276725c4e2c8e06e3cec36472adb0be7d99b709d Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Fri, 5 Aug 2022 04:05:04 +0200
Subject: [PATCH 01/12] gnulib-tool.py: Simplify.
* pygnulib/constants.py (compiler): Remove function.
* gnulib-tool.py: Use re.compile directly instead.
* pygnulib/*.py: Likewise.
---
ChangeLog | 7 +++++++
gnulib-tool.py | 3 +--
pygnulib/GLEmiter.py | 25 ++++++++++++------------
pygnulib/GLImport.py | 17 ++++++++---------
pygnulib/GLModuleSystem.py | 39 +++++++++++++++++++-------------------
pygnulib/GLTestDir.py | 25 ++++++++++++------------
pygnulib/constants.py | 10 ++--------
7 files changed, 61 insertions(+), 65 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1abeb15271..e504d85215 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-08-05 Bruno Haible <[email protected]>
+
+ gnulib-tool.py: Simplify.
+ * pygnulib/constants.py (compiler): Remove function.
+ * gnulib-tool.py: Use re.compile directly instead.
+ * pygnulib/*.py: Likewise.
+
2022-08-04 Bruno Haible <[email protected]>
gnulib-tool.py: Fix typo.
diff --git a/gnulib-tool.py b/gnulib-tool.py
index 21c6789ba9..1a6bd9e948 100755
--- a/gnulib-tool.py
+++ b/gnulib-tool.py
@@ -55,7 +55,6 @@ ENCS = constants.ENCS
UTILS = constants.UTILS
MODES = constants.MODES
TESTS = constants.TESTS
-compiler = constants.compiler
joinpath = constants.joinpath
copyfile = constants.copyfile
isabs = os.path.isabs
@@ -745,7 +744,7 @@ def main():
else: # if not isfile(filepath)
filepath = joinpath(destdir, 'aclocal.m4')
if isfile(filepath):
- pattern = constants.compiler(r'm4_include\(\[(.*?)\]\)')
+ pattern = re.compile(r'm4_include\(\[(.*?)\]\)')
with codecs.open(filepath, 'rb', 'UTF-8') as file:
m4dirs = pattern.findall(file.read())
m4dirs = [ os.path.dirname(m4dir)
diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py
index c95d109423..b56e551f1d 100644
--- a/pygnulib/GLEmiter.py
+++ b/pygnulib/GLEmiter.py
@@ -45,7 +45,6 @@ __copyright__ = constants.__copyright__
# Define global constants
#===============================================================================
TESTS = constants.TESTS
-compiler = constants.compiler
joinpath = constants.joinpath
isfile = os.path.isfile
normpath = os.path.normpath
@@ -158,7 +157,7 @@ class GLEmiter(object):
if line.strip() ]
snippet = '%s\n' % '\n'.join(lines)
transformer = fileassistant.transformers.get('aux', '')
- pattern = compiler('(^.*?$)', re.S | re.M)
+ pattern = re.compile('(^.*?$)', re.S | re.M)
snippet = pattern.sub('%s\\1' % indentation, snippet)
if transformer:
args = ['sed', '-e', transformer]
@@ -179,7 +178,7 @@ class GLEmiter(object):
else:
# Don't indent AM_GNU_GETTEXT_VERSION line, as that confuses
# autopoint through at least GNU gettext version 0.18.2.
- snippet = compiler('^ *AM_GNU_GETTEXT_VERSION').sub('AM_GNU_GETTEXT_VERSION', snippet)
+ snippet = re.compile('^ *AM_GNU_GETTEXT_VERSION').sub('AM_GNU_GETTEXT_VERSION', snippet)
emit += snippet
if str(module) == 'alloca' and libtool and not disable_libtool:
emit += 'changequote(,)dnl\n'
@@ -189,7 +188,7 @@ class GLEmiter(object):
if replace_auxdir:
regex = 'AC_CONFIG_FILES\\(\\[(.*?)\\:build-aux/(.*?)\\]\\)'
repl = 'AC_CONFIG_FILES([\\1:%s/\\2])' % auxdir
- pattern = compiler(regex, re.S | re.M)
+ pattern = re.compile(regex, re.S | re.M)
emit = pattern.sub(repl, emit)
lines = [ line
for line in emit.split('\n')
@@ -694,9 +693,9 @@ AC_DEFUN([%V1%_LIBSOURCES], [
amsnippet1 = amsnippet1.replace('lib_LIBRARIES', 'lib%_LIBRARIES')
amsnippet1 = amsnippet1.replace('lib_LTLIBRARIES', 'lib%_LTLIBRARIES')
if LD_flags:
- pattern = compiler('lib_LDFLAGS[\t ]*\\+=(.*?)$', re.S | re.M)
+ pattern = re.compile('lib_LDFLAGS[\t ]*\\+=(.*?)$', re.S | re.M)
amsnippet1 = pattern.sub('', amsnippet1)
- pattern = compiler('lib_([A-Z][A-Z](?:.*?))', re.S | re.M)
+ pattern = re.compile('lib_([A-Z][A-Z](?:.*?))', re.S | re.M)
amsnippet1 = pattern.sub('%s_%s_\\1' % (libname, libext),
amsnippet1)
amsnippet1 = amsnippet1.replace('$(GNULIB_', '$(' + module_indicator_prefix + '_GNULIB_')
@@ -709,12 +708,12 @@ AC_DEFUN([%V1%_LIBSOURCES], [
if str(module) == 'alloca':
amsnippet1 += '%s_%s_LIBADD += @%sALLOCA@\n' % (libname, libext, perhapsLT)
amsnippet1 += '%s_%s_DEPENDENCIES += @%sALLOCA@\n' % (libname, libext, perhapsLT)
- amsnippet1 = constants.combine_lines_matching(compiler('%s_%s_SOURCES' % (libname, libext)),
+ amsnippet1 = constants.combine_lines_matching(re.compile('%s_%s_SOURCES' % (libname, libext)),
amsnippet1)
# Get unconditional snippet, edit it and save to amsnippet2.
amsnippet2 = module.getAutomakeSnippet_Unconditional()
- pattern = compiler('lib_([A-Z][A-Z](?:.*?))', re.S | re.M)
+ pattern = re.compile('lib_([A-Z][A-Z](?:.*?))', re.S | re.M)
amsnippet2 = pattern.sub('%s_%s_\\1' % (libname, libext),
amsnippet2)
amsnippet2 = amsnippet2.replace('$(GNULIB_',
@@ -756,7 +755,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
# * https://debbugs.gnu.org/10997
# * https://debbugs.gnu.org/11030
# So we need this workaround.
- pattern = compiler('^pkgdata_DATA *\\+=', re.S | re.M)
+ pattern = re.compile('^pkgdata_DATA *\\+=', re.S | re.M)
if pattern.findall(allsnippets):
emit += 'pkgdata_DATA =\n'
emit += 'EXTRA_DIST =\n'
@@ -808,7 +807,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
insnippets = False
inmakefile = False
regex = '^[a-zA-Z0-9_]*_%sLIBRARIES *\\+{0,1}= *%s.%s' % (perhapsLT, libname, libext)
- pattern = compiler(regex, re.S | re.M)
+ pattern = re.compile(regex, re.S | re.M)
insnippets = bool(pattern.findall(allsnippets))
# Then test if $sourcebase/Makefile.am (if it exists) specifies it.
path = joinpath(sourcebase, 'Makefile.am')
@@ -961,9 +960,9 @@ AC_DEFUN([%V1%_LIBSOURCES], [
snippet = snippet.replace('lib_LIBRARIES', 'lib%_LIBRARIES')
snippet = snippet.replace('lib_LTLIBRARIES', 'lib%_LTLIBRARIES')
if LD_flags:
- pattern = compiler('lib_LDFLAGS[\t ]*\\+=(.*?)$', re.S | re.M)
+ pattern = re.compile('lib_LDFLAGS[\t ]*\\+=(.*?)$', re.S | re.M)
snippet = pattern.sub('', snippet)
- pattern = compiler('lib_([A-Z][A-Z](?:.*?))', re.S | re.M)
+ pattern = re.compile('lib_([A-Z][A-Z](?:.*?))', re.S | re.M)
snippet = pattern.sub('libtests_a_\\1', snippet)
snippet = snippet.replace('$(GNULIB_', '$(' + module_indicator_prefix + '_GNULIB_')
snippet = snippet.replace('lib%_LIBRARIES', 'lib_LIBRARIES')
@@ -1038,7 +1037,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
# * https://debbugs.gnu.org/10997
# * https://debbugs.gnu.org/11030
# So we need this workaround.
- pattern = compiler('^pkgdata_DATA *\\+=', re.S | re.M)
+ pattern = re.compile('^pkgdata_DATA *\\+=', re.S | re.M)
if bool(pattern.findall(main_snippets)) or bool(pattern.findall(longrun_snippets)):
emit += 'pkgdata_DATA =\n'
diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index 9dff29a6b3..3b2b14eb4b 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -49,7 +49,6 @@ __copyright__ = constants.__copyright__
#===============================================================================
MODES = constants.MODES
TESTS = constants.TESTS
-compiler = constants.compiler
joinpath = constants.joinpath
cleaner = constants.cleaner
copyfile2 = constants.copyfile2
@@ -99,18 +98,18 @@ class GLImport(object):
self.config.setAutoconfFile(path)
with codecs.open(path, 'rb', 'UTF-8') as file:
data = file.read()
- pattern = compiler(r'^AC_CONFIG_AUX_DIR\((.*?)\)$', re.S | re.M)
+ pattern = re.compile(r'^AC_CONFIG_AUX_DIR\((.*?)\)$', re.S | re.M)
match = pattern.findall(data)
if match:
result = cleaner(match)[0]
self.cache.setAuxDir(joinpath(self.config['destdir'], result))
- pattern = compiler(r'A[CM]_PROG_LIBTOOL', re.S | re.M)
+ pattern = re.compile(r'A[CM]_PROG_LIBTOOL', re.S | re.M)
guessed_libtool = bool(pattern.findall(data))
if self.config['auxdir'] == None:
self.config.setAuxDir(self.cache['auxdir'])
# Guess autoconf version.
- pattern = compiler(r'.*AC_PREREQ\((.*?)\)', re.S | re.M)
+ pattern = re.compile(r'.*AC_PREREQ\((.*?)\)', re.S | re.M)
versions = cleaner(pattern.findall(data))
if versions:
version = sorted(set([ float(version)
@@ -126,7 +125,7 @@ class GLImport(object):
data = file.read()
# Create regex object and keys.
- pattern = compiler('^(gl_.*?)\\((.*?)\\)$', re.S | re.M)
+ pattern = re.compile('^(gl_.*?)\\((.*?)\\)$', re.S | re.M)
keys = \
[
'gl_LOCAL_DIR', 'gl_MODULES', 'gl_AVOID', 'gl_SOURCE_BASE',
@@ -214,7 +213,7 @@ class GLImport(object):
with codecs.open(path, 'rb', 'UTF-8') as file:
data = file.read()
regex = 'AC_DEFUN\\(\\[%s_FILE_LIST\\], \\[(.*?)\\]\\)' % self.cache['macro_prefix']
- pattern = compiler(regex, re.S | re.M)
+ pattern = re.compile(regex, re.S | re.M)
self.cache.setFiles(pattern.findall(data)[-1].strip().split())
# The self.config['localpath'] defaults to the cached one. Recall that
@@ -870,7 +869,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
notice = notice.strip()
if notice:
print('Notice from module %s:' % str(module))
- pattern = compiler('^(.*?)$', re.S | re.M)
+ pattern = re.compile('^(.*?)$', re.S | re.M)
notice = pattern.sub(' \\1', notice)
print(notice)
@@ -1442,9 +1441,9 @@ in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library.''')
with codecs.open(configure_ac, 'rb', 'UTF-8') as file:
data = file.read()
match_result1 = \
- bool(compiler('^ *AC_PROG_CC_STDC', re.S | re.M).findall(data))
+ bool(re.compile('^ *AC_PROG_CC_STDC', re.S | re.M).findall(data))
match_result2 = \
- bool(compiler('^ *AC_PROG_CC_C99', re.S | re.M).findall(data))
+ bool(re.compile('^ *AC_PROG_CC_C99', re.S | re.M).findall(data))
if match_result1:
position_early_after = 'AC_PROG_CC_STDC'
elif match_result2:
diff --git a/pygnulib/GLModuleSystem.py b/pygnulib/GLModuleSystem.py
index eb5b544594..6b8f20e54f 100644
--- a/pygnulib/GLModuleSystem.py
+++ b/pygnulib/GLModuleSystem.py
@@ -42,7 +42,6 @@ __copyright__ = constants.__copyright__
DIRS = constants.DIRS
ENCS = constants.ENCS
TESTS = constants.TESTS
-compiler = constants.compiler
joinpath = constants.joinpath
isdir = os.path.isdir
isfile = os.path.isfile
@@ -281,7 +280,7 @@ Include:|Link:|License:|Maintainer:)'
'''GLModule.getName() -> str
Return the name of the module.'''
- pattern = compiler(joinpath('modules', '(.*?)$'))
+ pattern = re.compile(joinpath('modules', '(.*?)$'))
result = pattern.findall(self.module)[0]
return result
@@ -386,7 +385,7 @@ Include:|Link:|License:|Maintainer:)'
result = ''
else: # if section in self.content
pattern = '^%s[\t ]*(.*?)%s' % (section, self.regex)
- pattern = compiler(pattern, re.S | re.M)
+ pattern = re.compile(pattern, re.S | re.M)
result = pattern.findall(self.content)
if type(result) is list:
if not result:
@@ -407,7 +406,7 @@ Include:|Link:|License:|Maintainer:)'
result = ''
else: # if section in self.content
pattern = '^%s[\t ]*(.*?)%s' % (section, self.regex)
- pattern = compiler(pattern, re.S | re.M)
+ pattern = re.compile(pattern, re.S | re.M)
result = pattern.findall(self.content)
if type(result) is list:
if not result:
@@ -436,7 +435,7 @@ Include:|Link:|License:|Maintainer:)'
regex = '^(Description|Comment|Status|Notice|Applicability|'
regex += 'Files|Depends-on|configure\\.ac-early|configure\\.ac|'
regex += 'Makefile\\.am|Include|Link|License|Maintainer):$'
- pattern = compiler(regex)
+ pattern = re.compile(regex)
findflag = pattern.findall(line)
if findflag:
break
@@ -465,7 +464,7 @@ Include:|Link:|License:|Maintainer:)'
regex = '^(Description|Comment|Status|Notice|Applicability|'
regex += 'Files|Depends-on|configure\\.ac-early|configure\\.ac|'
regex += 'Makefile\\.am|Include|Link|License|Maintainer):$'
- pattern = compiler(regex)
+ pattern = re.compile(regex)
findflag = pattern.findall(line)
if findflag:
break
@@ -492,7 +491,7 @@ Include:|Link:|License:|Maintainer:)'
regex = '^(Description|Comment|Status|Notice|Applicability|'
regex += 'Files|Depends-on|configure\\.ac-early|configure\\.ac|'
regex += 'Makefile\\.am|Include|Link|License|Maintainer):$'
- pattern = compiler(regex)
+ pattern = re.compile(regex)
findflag = pattern.findall(line)
if findflag:
break
@@ -530,7 +529,7 @@ Include:|Link:|License:|Maintainer:)'
regex = '^(Description|Comment|Status|Notice|Applicability|'
regex += 'Files|Depends-on|configure\\.ac-early|configure\\.ac|'
regex += 'Makefile\\.am|Include|Link|License|Maintainer):$'
- pattern = compiler(regex)
+ pattern = re.compile(regex)
findflag = pattern.findall(line)
if findflag:
break
@@ -564,7 +563,7 @@ Include:|Link:|License:|Maintainer:)'
regex = '^(Description|Comment|Status|Notice|Applicability|'
regex += 'Files|Depends-on|configure\\.ac-early|configure\\.ac|'
regex += 'Makefile\\.am|Include|Link|License|Maintainer):$'
- pattern = compiler(regex)
+ pattern = re.compile(regex)
findflag = pattern.findall(line)
if findflag:
break
@@ -608,7 +607,7 @@ Include:|Link:|License:|Maintainer:)'
regex = '^(Description|Comment|Status|Notice|Applicability|'
regex += 'Files|Depends-on|configure\\.ac-early|configure\\.ac|'
regex += 'Makefile\\.am|Include|Link|License|Maintainer):$'
- pattern = compiler(regex)
+ pattern = re.compile(regex)
findflag = pattern.findall(line)
if findflag:
break
@@ -635,7 +634,7 @@ Include:|Link:|License:|Maintainer:)'
regex = '^(Description|Comment|Status|Notice|Applicability|'
regex += 'Files|Depends-on|configure\\.ac-early|configure\\.ac|'
regex += 'Makefile\\.am|Include|Link|License|Maintainer):$'
- pattern = compiler(regex)
+ pattern = re.compile(regex)
findflag = pattern.findall(line)
if findflag:
break
@@ -676,7 +675,7 @@ Include:|Link:|License:|Maintainer:)'
regex = '^(Description|Comment|Status|Notice|Applicability|'
regex += 'Files|Depends-on|configure\\.ac-early|configure\\.ac|'
regex += 'Makefile\\.am|Include|Link|License|Maintainer):$'
- pattern = compiler(regex)
+ pattern = re.compile(regex)
findflag = pattern.findall(line)
if findflag:
break
@@ -706,7 +705,7 @@ Include:|Link:|License:|Maintainer:)'
# TODO: unconditional automake snippet for nontests modules
snippet = self.getAutomakeSnippet_Conditional()
snippet = constants.combine_lines(snippet)
- pattern = compiler('^lib_SOURCES[\t ]*\\+=[\t ]*(.*?)$', re.S | re.M)
+ pattern = re.compile('^lib_SOURCES[\t ]*\\+=[\t ]*(.*?)$', re.S | re.M)
mentioned_files = pattern.findall(snippet)
if mentioned_files != list():
mentioned_files = mentioned_files[-1].split(' ')
@@ -774,14 +773,14 @@ Include:|Link:|License:|Maintainer:)'
regex = '^(Description|Comment|Status|Notice|Applicability|'
regex += 'Files|Depends-on|configure\\.ac-early|configure\\.ac|'
regex += 'Makefile\\.am|Include|Link|License|Maintainer):$'
- pattern = compiler(regex)
+ pattern = re.compile(regex)
findflag = pattern.findall(line)
if findflag:
break
parts += [line]
result = ''.join(parts)
result = result.strip()
- pattern = compiler('^(["<].*?[>"])', re.S | re.M)
+ pattern = re.compile('^(["<].*?[>"])', re.S | re.M)
result = pattern.sub('#include \\1', result)
self.cache['include'] = result
return self.cache['include']
@@ -802,7 +801,7 @@ Include:|Link:|License:|Maintainer:)'
regex = '^(Description|Comment|Status|Notice|Applicability|'
regex += 'Files|Depends-on|configure\\.ac-early|configure\\.ac|'
regex += 'Makefile\\.am|Include|Link|License|Maintainer):$'
- pattern = compiler(regex)
+ pattern = re.compile(regex)
findflag = pattern.findall(line)
if findflag:
break
@@ -845,7 +844,7 @@ Include:|Link:|License:|Maintainer:)'
result = ''
else: # if section in self.content
pattern = '^%s[\t ]*(.*?)%s' % (section, self.regex)
- pattern = compiler(pattern, re.S | re.M)
+ pattern = re.compile(pattern, re.S | re.M)
result = pattern.findall(self.content)
if type(result) is list:
if not result:
@@ -874,7 +873,7 @@ Include:|Link:|License:|Maintainer:)'
regex = '^(Description|Comment|Status|Notice|Applicability|'
regex += 'Files|Depends-on|configure\\.ac-early|configure\\.ac|'
regex += 'Makefile\\.am|Include|Link|License|Maintainer):$'
- pattern = compiler(regex)
+ pattern = re.compile(regex)
findflag = pattern.findall(line)
if findflag:
break
@@ -1042,7 +1041,7 @@ class GLModuleTable(object):
if self.config['conddeps']:
automake_snippet = \
module.getAutomakeSnippet_Conditional()
- pattern = compiler('^if')
+ pattern = re.compile('^if')
if not pattern.findall(automake_snippet):
self.addUnconditional(module)
conditional = self.isConditional(module)
@@ -1165,7 +1164,7 @@ class GLModuleTable(object):
raise TypeError('each module must be a GLModule instance')
snippet = module.getAutomakeSnippet()
snippet = constants.remove_backslash_newline(snippet)
- pattern = compiler('^lib_SOURCES[\t ]*\\+=[\t ]*(.*?)$', re.S | re.M)
+ pattern = re.compile('^lib_SOURCES[\t ]*\\+=[\t ]*(.*?)$', re.S | re.M)
files = pattern.findall(snippet)
if files: # if source files were found
files = files[-1].split(' ')
diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py
index 732a0590df..624a38317e 100644
--- a/pygnulib/GLTestDir.py
+++ b/pygnulib/GLTestDir.py
@@ -51,7 +51,6 @@ __copyright__ = constants.__copyright__
DIRS = constants.DIRS
UTILS = constants.UTILS
TESTS = constants.TESTS
-compiler = constants.compiler
joinpath = constants.joinpath
copyfile = constants.copyfile
movefile = constants.movefile
@@ -304,7 +303,7 @@ class GLTestDir(object):
notice = module.getNotice()
if notice:
print('Notice from module %s:' % str(module))
- pattern = compiler('^(.*?)$', re.S | re.M)
+ pattern = re.compile('^(.*?)$', re.S | re.M)
notice = pattern.sub(' \\1', notice)
print(notice)
else: # if not single_configure
@@ -312,7 +311,7 @@ class GLTestDir(object):
notice = module.getNotice()
if notice:
print('Notice from module %s:' % str(module))
- pattern = compiler('^(.*?)$', re.S | re.M)
+ pattern = re.compile('^(.*?)$', re.S | re.M)
notice = pattern.sub(' \\1', notice)
print(notice)
@@ -466,7 +465,7 @@ class GLTestDir(object):
for line in snippet.split('\n')
if line.strip() ]
snippet = '\n'.join(lines)
- pattern = compiler('AC_REQUIRE\\(\\[([^()].*?)\\]\\)', re.S | re.M)
+ pattern = re.compile('AC_REQUIRE\\(\\[([^()].*?)\\]\\)', re.S | re.M)
snippet = pattern.sub('\\1', snippet)
snippet = snippet.strip()
snippets += [snippet]
@@ -583,7 +582,7 @@ class GLTestDir(object):
for line in snippet.split('\n')
if line.strip() ]
snippet = '\n'.join(lines)
- pattern = compiler('AC_REQUIRE\\(\\[([^()].*?)\\]\\)', re.S | re.M)
+ pattern = re.compile('AC_REQUIRE\\(\\[([^()].*?)\\]\\)', re.S | re.M)
snippet = pattern.sub('\\1', snippet)
snippet = snippet.strip()
snippets += [snippet]
@@ -754,9 +753,9 @@ class GLTestDir(object):
# Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
regex_find = list()
- pattern = compiler('^CLEANFILES[\t ]*\\+=(.*?)$', re.S | re.M)
+ pattern = re.compile('^CLEANFILES[\t ]*\\+=(.*?)$', re.S | re.M)
regex_find += pattern.findall(snippet)
- pattern = compiler('^MOSTLYCLEANFILES[\t ]*\\+=(.*?)$', re.S | re.M)
+ pattern = re.compile('^MOSTLYCLEANFILES[\t ]*\\+=(.*?)$', re.S | re.M)
regex_find += pattern.findall(snippet)
regex_find = [ line.strip()
for line in regex_find
@@ -770,7 +769,7 @@ class GLTestDir(object):
# Extract the value of "BUILT_SOURCES += ...". Remove variable references
# such $(FOO_H) because they don't refer to distributed files.
regex_find = list()
- pattern = compiler('^BUILT_SOURCES[\t ]*\\+=(.*?)$', re.S | re.M)
+ pattern = re.compile('^BUILT_SOURCES[\t ]*\\+=(.*?)$', re.S | re.M)
regex_find += pattern.findall(snippet)
regex_find = [ line.strip()
for line in regex_find
@@ -782,7 +781,7 @@ class GLTestDir(object):
if line.strip()]
built_sources = [ line
for line in built_sources
- if not bool(compiler('[$]\\([A-Za-z0-9_]*\\)$').findall(line)) ]
+ if not bool(re.compile('[$]\\([A-Za-z0-9_]*\\)$').findall(line)) ]
distributed_built_sources = [ file
for file in built_sources
if file not in cleaned_files ]
@@ -796,9 +795,9 @@ class GLTestDir(object):
# Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
regex_find = list()
- pattern = compiler('^CLEANFILES[\t ]*\\+=(.*?)$', re.S | re.M)
+ pattern = re.compile('^CLEANFILES[\t ]*\\+=(.*?)$', re.S | re.M)
regex_find += pattern.findall(snippet)
- pattern = compiler('^MOSTLYCLEANFILES[\t ]*\\+=(.*?)$', re.S | re.M)
+ pattern = re.compile('^MOSTLYCLEANFILES[\t ]*\\+=(.*?)$', re.S | re.M)
regex_find += pattern.findall(snippet)
regex_find = [ line.strip()
for line in regex_find
@@ -813,7 +812,7 @@ class GLTestDir(object):
# such $(FOO_H) because they don't refer to distributed files.
regex_find = list()
tests_built_sources = list()
- pattern = compiler('^BUILT_SOURCES[\t ]*\\+=(.*?)$', re.S | re.M)
+ pattern = re.compile('^BUILT_SOURCES[\t ]*\\+=(.*?)$', re.S | re.M)
regex_find += pattern.findall(snippet)
regex_find = [ line.strip()
for line in regex_find
@@ -825,7 +824,7 @@ class GLTestDir(object):
if line.strip() ]
tests_built_sources = [ line
for line in tests_built_sources
- if not bool(compiler('[$]\\([A-Za-z0-9_]*\\)$').findall(line)) ]
+ if not bool(re.compile('[$]\\([A-Za-z0-9_]*\\)$').findall(line)) ]
tests_distributed_built_sources = [ file
for file in tests_built_sources
if file not in cleaned_files]
diff --git a/pygnulib/constants.py b/pygnulib/constants.py
index 7d59235007..4eff6da8bc 100644
--- a/pygnulib/constants.py
+++ b/pygnulib/constants.py
@@ -237,12 +237,6 @@ def execute(args, verbose):
sys.exit(retcode)
-def compiler(pattern, flags=0):
- '''Compile regex pattern depending on version of Python.'''
- pattern = re.compile(pattern, flags)
- return pattern
-
-
def cleaner(sequence):
'''Clean string or list of strings after using regex.'''
if type(sequence) is str:
@@ -405,8 +399,8 @@ def filter_filelist(separator, filelist,
listing = list()
for filename in filelist:
if filename.startswith(prefix) and filename.endswith(suffix):
- pattern = compiler('^%s(.*?)%s$'
- % (removed_prefix, removed_suffix))
+ pattern = re.compile('^%s(.*?)%s$'
+ % (removed_prefix, removed_suffix))
result = pattern.sub('%s\\1%s'
% (added_prefix, added_suffix), filename)
listing += [result]
--
2.34.1
>From 1f0e03e5a3e83d271c4aef05dbbb4850f66cee42 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Fri, 5 Aug 2022 14:17:35 +0200
Subject: [PATCH 02/12] gnulib-tool.py: Make option --version work.
* 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.
---
ChangeLog | 14 +++++++
gnulib-tool.py | 5 ++-
gnulib-tool.py.TODO | 1 -
pygnulib/GLInfo.py | 90 ++++++++++++++++++++++++++++---------------
pygnulib/constants.py | 2 +-
5 files changed, 78 insertions(+), 34 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e504d85215..81871735d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2022-08-05 Bruno Haible <[email protected]>
+ gnulib-tool.py: Make option --version work.
+ * 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.
* pygnulib/constants.py (compiler): Remove function.
* gnulib-tool.py: Use re.compile directly instead.
diff --git a/gnulib-tool.py b/gnulib-tool.py
index 1a6bd9e948..c4386133a6 100755
--- a/gnulib-tool.py
+++ b/gnulib-tool.py
@@ -397,8 +397,11 @@ def main():
print(info.usage())
sys.exit(0)
if cmdargs.version != None:
+ version = info.version()
+ if version != '':
+ version = ' ' + version
message = '''gnulib-tool (%s %s)%s\n%s\n%s\n\nWritten by %s.''' \
- % (info.package(), info.date(), info.version(), info.copyright(),
+ % (info.package(), info.date(), version, info.copyright(),
info.license(), info.authors())
print(message)
sys.exit(0)
diff --git a/gnulib-tool.py.TODO b/gnulib-tool.py.TODO
index 7170268b0e..de3a90dc37 100644
--- a/gnulib-tool.py.TODO
+++ b/gnulib-tool.py.TODO
@@ -40,7 +40,6 @@ Implement the options:
-S | --more-symlinks
-H | --more-hardlinks
--help (same output)
- --version
--------------------------------------------------------------------------------
diff --git a/pygnulib/GLInfo.py b/pygnulib/GLInfo.py
index 34b38db7eb..5e386e7c34 100644
--- a/pygnulib/GLInfo.py
+++ b/pygnulib/GLInfo.py
@@ -65,9 +65,7 @@ class GLInfo(object):
The special __author__ variable is used (type is list).'''
result = ''
for item in __author__:
- if item == __author__[-2]:
- result += '%s ' % item
- elif item == __author__[-1]:
+ if item == __author__[-1]:
result += 'and %s' % item
else:
result += '%s, ' % item
@@ -75,38 +73,58 @@ class GLInfo(object):
def license(self):
'''Return formatted string which contains license and its description.'''
- result = 'License GPLv3+: GNU GPL version 3 or later'
- result += ' <https://gnu.org/licenses/gpl.html>\n'
- result += 'This is free software: you are free'
- result += ' to change and redistribute it.\n'
+ result = 'License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>\n'
+ result += 'This is free software: you are free to change and redistribute it.\n'
result += 'There is NO WARRANTY, to the extent permitted by law.'
return result
def copyright(self):
'''Return formatted string which contains copyright.
The special __copyright__ variable is used (type is str).'''
- result = 'Copyright (C) %s' % __copyright__
+ copyright = __copyright__
+ # Per the GNU Coding Standards, show only the last year.
+ copyright = re.compile('^[0-9]*-').sub('', copyright)
+ result = 'Copyright (C) %s' % copyright
return result
def date(self):
'''Return formatted string which contains date and time in GMT format.'''
if isdir(DIRS['git']):
- counter = int() # Create counter
- result = '' # Create string
- args = ['git', 'log']
- result = sp.check_output(args).decode("UTF-8")
- # Get date as "Fri Mar 21 07:16:51 2008 -0600" from string
- pattern = re.compile('Date:[\t ]*(.*?)$', re.S | re.M)
- result = pattern.findall(result)[0]
- # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600"
- pattern = re.compile('^[^ ]* ([^ ]*) ([0-9]*) ([0-9:]*) ([0-9]*) ')
- result = pattern.sub('\\1 \\2 \\4 \\3 ', result)
- # Use GNU date to compute the time in GMT
- args = ['date', '-d', result, '-u', '+%Y-%m-%d %H:%M:%S']
- proc = sp.check_output(args)
- result = str(proc, "UTF-8")
- result = result.rstrip(os.linesep)
- return result
+ have_git = None
+ try:
+ sp.check_call(['git', '--version'], stdout=sp.DEVNULL)
+ have_git = True
+ except:
+ have_git = False
+ if have_git:
+ have_GNU_date = None
+ try:
+ sp.check_call(['date', '--version'], stdout=sp.DEVNULL)
+ have_GNU_date = True
+ except:
+ have_GNU_date = False
+ if have_GNU_date:
+ args = ['git', 'log', '-n', '1', 'ChangeLog']
+ result = sp.check_output(args, cwd=DIRS['root']).decode("UTF-8")
+ # Get date as "Fri Mar 21 07:16:51 2008 -0600" from string
+ pattern = re.compile('^Date:[\t ]*(.*?)$', re.M)
+ result = pattern.findall(result)[0]
+ # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600"
+ pattern = re.compile('^[^ ]* ([^ ]*) ([0-9]*) ([0-9:]*) ([0-9]*) ')
+ result = pattern.sub('\\1 \\2 \\4 \\3 ', result)
+ # Use GNU date to compute the time in GMT
+ args = ['date', '-d', result, '-u', '+%Y-%m-%d %H:%M:%S']
+ proc = sp.check_output(args)
+ result = str(proc, "UTF-8")
+ result = result.rstrip(os.linesep)
+ return result
+ # gnulib copy without versioning information.
+ first_changelog_line = None
+ with codecs.open(os.path.join(DIRS['root'], 'ChangeLog'), 'rb', 'UTF-8') as file:
+ line = file.readline()
+ first_changelog_line = line.rstrip()
+ result = re.compile(' .*').sub('', first_changelog_line)
+ return result
def usage(self):
'''Show help message.'''
@@ -289,10 +307,20 @@ Report bugs to <[email protected]>.'''
def version(self):
'''Return formatted string which contains git version.'''
if isdir(DIRS['git']):
- version_gen = joinpath(DIRS['build-aux'], 'git-version-gen')
- args = [version_gen, DIRS['root']]
- result = sp.check_output(args).decode("UTF-8")
- result = result.strip()
- if result == 'UNKNOWN':
- result = ''
- return result
+ have_git = None
+ try:
+ sp.check_call(['git', '--version'], stdout=sp.DEVNULL)
+ have_git = True
+ except:
+ have_git = False
+ if have_git:
+ version_gen = joinpath(DIRS['build-aux'], 'git-version-gen')
+ args = [version_gen, '/dev/null']
+ result = sp.check_output(args, cwd=DIRS['root']).decode("UTF-8")
+ result = result.strip()
+ result = result.replace('-dirty', '-modified')
+ if result == 'UNKNOWN':
+ result = ''
+ return result
+ # gnulib copy without versioning information.
+ return ''
diff --git a/pygnulib/constants.py b/pygnulib/constants.py
index 4eff6da8bc..ffee05846e 100644
--- a/pygnulib/constants.py
+++ b/pygnulib/constants.py
@@ -41,7 +41,7 @@ __author__ = \
'Dmitriy Selyutin',
]
__license__ = 'GNU GPLv3+'
-__copyright__ = '2002-2017 Free Software Foundation, Inc.'
+__copyright__ = '2002-2022 Free Software Foundation, Inc.'
#===============================================================================
--
2.34.1
>From eb194fa7a5c8abc2e79ca608466b04dc89a7c67d Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Fri, 5 Aug 2022 15:15:16 +0200
Subject: [PATCH 03/12] 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.
---
ChangeLog | 10 ++++++++++
pygnulib/GLConfig.py | 2 +-
pygnulib/GLEmiter.py | 2 +-
pygnulib/GLFileSystem.py | 6 +++---
pygnulib/GLTestDir.py | 3 +++
pygnulib/constants.py | 1 +
6 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 81871735d2..1d3630beea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2022-08-05 Bruno Haible <[email protected]>
+ 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.
+
gnulib-tool.py: Make option --version work.
* pygnulib/constants.py (__copyright__): Bump copyright year.
* pygnulib/GLInfo.py (GLInfo.authors): Add a comma after the
diff --git a/pygnulib/GLConfig.py b/pygnulib/GLConfig.py
index 039b4f012d..cda218e423 100644
--- a/pygnulib/GLConfig.py
+++ b/pygnulib/GLConfig.py
@@ -764,7 +764,7 @@ class GLConfig(object):
self.table['libname'] = libname
else: # if type of libname is not str
raise TypeError('libname must be a string, not %s'
- % type(module).__name__)
+ % type(libname).__name__)
def resetLibName(self):
'''Reset the library name to 'libgnu'.'''
diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py
index b56e551f1d..b547fde7e7 100644
--- a/pygnulib/GLEmiter.py
+++ b/pygnulib/GLEmiter.py
@@ -450,7 +450,7 @@ USE_MSGCTXT = no\n"""
emit = ''
sourcebase = self.config['sourcebase']
sourcebase = '%s%s' % (self.sourcebase, os.path.sep)
- files = [ substart('lib/', sourcebase, file)
+ files = [ constants.substart('lib/', sourcebase, file)
for file in files ]
files = [ file
for file in files
diff --git a/pygnulib/GLFileSystem.py b/pygnulib/GLFileSystem.py
index 7bec0f9e6e..9e6161a24d 100644
--- a/pygnulib/GLFileSystem.py
+++ b/pygnulib/GLFileSystem.py
@@ -88,7 +88,7 @@ class GLFileSystem(object):
GLConfig: localpath.'''
if type(name) is not str:
raise TypeError('name must be a string, not %s'
- % type(module).__name__)
+ % type(name).__name__)
localpath = self.config['localpath']
# Each element in localpath is a directory whose contents overrides
# or amends the result of the lookup in the rest of localpath and
@@ -322,9 +322,9 @@ class GLFileAssistant(object):
raise GLError(17, original)
else: # if self.config['dryrun']
if already_present:
- print('Update file %s (backup in %s)' % (rewritten, backup))
+ print('Update file %s (backup in %s)' % (rewritten, backupname))
else: # if not already_present
- print('Replace file %s (backup in %s)' % (rewritten, backup))
+ print('Replace file %s (backup in %s)' % (rewritten, backupname))
def add_or_update(self, already_present):
'''GLFileAssistant.add_or_update(already_present)
diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py
index 624a38317e..db74b9b4e3 100644
--- a/pygnulib/GLTestDir.py
+++ b/pygnulib/GLTestDir.py
@@ -906,6 +906,9 @@ class GLMegaTestDir(object):
Create a mega scratch package with the given modules one by one and all
together.'''
+ auxdir = self.config['auxdir']
+ verbose = self.config['verbosity']
+
megasubdirs = list()
modules = [ self.modulesystem.find(m)
for m in self.config['modules'] ]
diff --git a/pygnulib/constants.py b/pygnulib/constants.py
index ffee05846e..313aac94a1 100644
--- a/pygnulib/constants.py
+++ b/pygnulib/constants.py
@@ -25,6 +25,7 @@ import sys
import platform
import shutil
import tempfile
+import codecs
import subprocess as sp
import __main__ as interpreter
--
2.34.1
>From 45b3978734eb20b5d7642dba5560c660782916c4 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Fri, 5 Aug 2022 17:13:20 +0200
Subject: [PATCH 04/12] gnulib-tool.py: Fix 'Unused import' warnings.
* gnulib-tool.py: Remove unused imports.
* pygnulib/*.py: Likewise.
---
ChangeLog | 4 ++++
gnulib-tool.py | 5 +++--
pygnulib/GLConfig.py | 4 ----
pygnulib/GLEmiter.py | 4 ----
pygnulib/GLError.py | 4 ----
pygnulib/GLFileSystem.py | 3 ---
pygnulib/GLImport.py | 5 -----
pygnulib/GLInfo.py | 2 --
pygnulib/GLMakefileTable.py | 7 -------
pygnulib/GLTestDir.py | 4 ----
10 files changed, 7 insertions(+), 35 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1d3630beea..e838c4610c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2022-08-05 Bruno Haible <[email protected]>
+ gnulib-tool.py: Fix 'Unused import' warnings.
+ * gnulib-tool.py: Remove unused imports.
+ * pygnulib/*.py: Likewise.
+
gnulib-tool.py: Fix 'Undefined variable' errors.
* pygnulib/constants.py: Import codecs.
* pygnulib/GLConfig.py (GLConfig.setLibName): Fix local variable
diff --git a/gnulib-tool.py b/gnulib-tool.py
index c4386133a6..4e5a87d4f2 100755
--- a/gnulib-tool.py
+++ b/gnulib-tool.py
@@ -29,6 +29,9 @@
# You can use this command to check the style:
# $ pycodestyle --max-line-length=136 --ignore=E265,W503,E241,E711,E712,E201,E202,E221 gnulib-tool.py pygnulib/*.py
+# You can use this command to check for mistakes:
+# $ pylint --disable=C0103,C0114,C0121,C0209,C0301,C0302,R0902,R0912,R0913,R0914,R0915,R1705,R1702,R1720 gnulib-tool.py pygnulib/*.py
+
#===============================================================================
# Define global imports
@@ -38,11 +41,9 @@ import re
import sys
import codecs
import random
-import shutil
import argparse
import subprocess as sp
from tempfile import mktemp
-from pprint import pprint
from pygnulib import constants
from pygnulib import classes
diff --git a/pygnulib/GLConfig.py b/pygnulib/GLConfig.py
index cda218e423..baf61029c9 100644
--- a/pygnulib/GLConfig.py
+++ b/pygnulib/GLConfig.py
@@ -17,12 +17,8 @@
# Define global imports
#===============================================================================
import os
-import re
-import sys
import copy
-import codecs
import tempfile
-import subprocess as sp
from . import constants
from .GLError import GLError
diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py
index b547fde7e7..97bb585e3f 100644
--- a/pygnulib/GLEmiter.py
+++ b/pygnulib/GLEmiter.py
@@ -18,19 +18,15 @@
#===============================================================================
import os
import re
-import sys
import codecs
-import shutil
import subprocess as sp
from . import constants
from .GLInfo import GLInfo
-from .GLError import GLError
from .GLConfig import GLConfig
from .GLModuleSystem import GLModule
from .GLModuleSystem import GLModuleTable
from .GLMakefileTable import GLMakefileTable
from .GLFileSystem import GLFileAssistant
-from pprint import pprint
#===============================================================================
diff --git a/pygnulib/GLError.py b/pygnulib/GLError.py
index a366da5b1a..c736e423af 100644
--- a/pygnulib/GLError.py
+++ b/pygnulib/GLError.py
@@ -17,10 +17,6 @@
# Define global imports
#===============================================================================
import os
-import re
-import sys
-import locale
-import codecs
from . import constants
diff --git a/pygnulib/GLFileSystem.py b/pygnulib/GLFileSystem.py
index 9e6161a24d..bee38223d5 100644
--- a/pygnulib/GLFileSystem.py
+++ b/pygnulib/GLFileSystem.py
@@ -17,10 +17,7 @@
# Define global imports
#===============================================================================
import os
-import re
-import sys
import codecs
-import shutil
import filecmp
import subprocess as sp
from enum import Enum
diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index 3b2b14eb4b..bf8171ea6b 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -18,16 +18,11 @@
#===============================================================================
import os
import re
-import sys
-import locale
import codecs
-import shutil
-import filecmp
import subprocess as sp
from . import constants
from .GLError import GLError
from .GLConfig import GLConfig
-from .GLModuleSystem import GLModule
from .GLModuleSystem import GLModuleTable
from .GLModuleSystem import GLModuleSystem
from .GLFileSystem import GLFileSystem
diff --git a/pygnulib/GLInfo.py b/pygnulib/GLInfo.py
index 5e386e7c34..b2d4457a5f 100644
--- a/pygnulib/GLInfo.py
+++ b/pygnulib/GLInfo.py
@@ -18,8 +18,6 @@
#===============================================================================
import os
import re
-import sys
-import locale
import codecs
import subprocess as sp
from . import constants
diff --git a/pygnulib/GLMakefileTable.py b/pygnulib/GLMakefileTable.py
index c4fb6d195a..abaeaf9d2e 100644
--- a/pygnulib/GLMakefileTable.py
+++ b/pygnulib/GLMakefileTable.py
@@ -17,15 +17,8 @@
# Define global imports
#===============================================================================
import os
-import re
-import sys
-import codecs
-import hashlib
-import subprocess as sp
from . import constants
-from .GLError import GLError
from .GLConfig import GLConfig
-from .GLFileSystem import GLFileSystem
#===============================================================================
diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py
index db74b9b4e3..757c494011 100644
--- a/pygnulib/GLTestDir.py
+++ b/pygnulib/GLTestDir.py
@@ -19,15 +19,11 @@
import os
import re
import sys
-import locale
import codecs
-import shutil
-import filecmp
import subprocess as sp
from . import constants
from .GLError import GLError
from .GLConfig import GLConfig
-from .GLModuleSystem import GLModule
from .GLModuleSystem import GLModuleTable
from .GLModuleSystem import GLModuleSystem
from .GLFileSystem import CopyAction
--
2.34.1
>From 7a106efa3268cad77c6b21b798296284923b4a2f Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Fri, 5 Aug 2022 19:24:14 +0200
Subject: [PATCH 05/12] gnulib-tool.py: Fix link_if_changed function.
* 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.
---
ChangeLog | 7 +++++++
pygnulib/constants.py | 42 +++++++++++++++++++++++++++---------------
2 files changed, 34 insertions(+), 15 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e838c4610c..c48eabe254 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2022-08-05 Bruno Haible <[email protected]>
+ gnulib-tool.py: Fix link_if_changed function.
+ * 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.
* gnulib-tool.py: Remove unused imports.
* pygnulib/*.py: Likewise.
diff --git a/pygnulib/constants.py b/pygnulib/constants.py
index 313aac94a1..46c0cbc152 100644
--- a/pygnulib/constants.py
+++ b/pygnulib/constants.py
@@ -244,10 +244,10 @@ def cleaner(sequence):
sequence = sequence.replace('[', '')
sequence = sequence.replace(']', '')
elif type(sequence) is list:
- sequence = [value.replace('[', '').replace(']', '')
- for value in sequence]
- sequence = [value.replace('(', '').replace(')', '')
- for value in sequence]
+ sequence = [ value.replace('[', '').replace(']', '')
+ for value in sequence]
+ sequence = [ value.replace('(', '').replace(')', '')
+ for value in sequence]
sequence = [ False if value == 'false' else value
for value in sequence ]
sequence = [ True if value == 'true' else value
@@ -262,7 +262,7 @@ def joinpath(head, *tail):
Join two or more pathname components, inserting '/' as needed. If any
component is an absolute path, all previous path components will be
- discarded. The second argument may be string or list of strings.'''
+ discarded.'''
newtail = list()
for item in tail:
newtail += [item]
@@ -356,36 +356,48 @@ def symlink_relative(src, dest):
copyfile2(cp_src, dest)
-def link_relative(src, dest):
- '''Like ln -s, except that src is given relative to the current directory
- (or absolute), not given relative to the directory of dest.'''
+def as_link_value_at_dest(src, dest):
+ '''Compute the symbolic link value to place at dest, such that the
+ resulting symbolic link points to src. src is given relative to the
+ current directory (or absolute).'''
if type(src) is not str:
raise TypeError('src must be a string, not %s' % (type(src).__name__))
if type(dest) is not str:
raise TypeError('dest must be a string, not %s' % (type(dest).__name__))
if src.startswith('/') or (len(src) >= 2 and src[1] == ':'):
- symlink_relative(src, dest)
+ return src
else: # if src is not absolute
if dest.startswith('/') or (len(dest) >= 2 and dest[1] == ':'):
cwd = os.getcwd()
- symlink_relative(joinpath(cwd, src), dest)
+ return joinpath(cwd, src)
else: # if dest is not absolute
destdir = os.path.dirname(dest)
if not destdir:
destdir = '.'
- src = relativize(destdir, src)
- symlink_relative(src, dest)
+ return relativize(destdir, src)
+
+
+def link_relative(src, dest):
+ '''Like ln -s, except that src is given relative to the current directory
+ (or absolute), not given relative to the directory of dest.'''
+ if type(src) is not str:
+ raise TypeError('src must be a string, not %s' % (type(src).__name__))
+ if type(dest) is not str:
+ raise TypeError('dest must be a string, not %s' % (type(dest).__name__))
+ link_value = as_link_value_at_dest(src, dest)
+ symlink_relative(link_value, dest)
def link_if_changed(src, dest):
'''Create a symlink, but avoids munging timestamps if the link is correct.'''
- ln_target = os.path.realpath(src)
- if not (os.path.islink(dest) and src == ln_target):
+ link_value = as_link_value_at_dest(src, dest)
+ if not (os.path.islink(dest) and os.readlink(dest) == link_value):
try:
os.remove(dest)
except FileNotFoundError:
pass
- link_relative(src, dest)
+ # Equivalent to link_relative(src, dest):
+ symlink_relative(link_value, dest)
def filter_filelist(separator, filelist,
--
2.34.1
>From ad534101bdf0b188babd525c4d54c9bf250763f7 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Fri, 5 Aug 2022 23:15:39 +0200
Subject: [PATCH 06/12] 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.
---
ChangeLog | 8 ++++++++
gnulib-tool.py | 12 ++++++------
pygnulib/GLConfig.py | 38 ++++++++++++++++++-------------------
pygnulib/GLEmiter.py | 24 +++++++++++------------
pygnulib/GLFileSystem.py | 1 -
pygnulib/GLImport.py | 28 +++++++++++++--------------
pygnulib/GLMakefileTable.py | 10 +++++-----
7 files changed, 64 insertions(+), 57 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c48eabe254..85938bb76f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2022-08-05 Bruno Haible <[email protected]>
+ 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.
+
gnulib-tool.py: Fix link_if_changed function.
* pygnulib/constants.py (joinpath): Fix comment.
(as_link_value_at_dest): New function, extracted from link_relative.
diff --git a/gnulib-tool.py b/gnulib-tool.py
index 4e5a87d4f2..9c63f6147f 100755
--- a/gnulib-tool.py
+++ b/gnulib-tool.py
@@ -83,7 +83,7 @@ def main():
tests = None
libname = None
lgpl = None
- makefile = None
+ makefile_name = None
libtool = None
conddeps = None
macro_prefix = None
@@ -365,9 +365,9 @@ def main():
action='append',
choices=['2', '3orGPLv2', '3'],
nargs='?')
- # makefile
+ # makefile-name
parser.add_argument("--makefile-name",
- dest="makefile",
+ dest="makefile_name",
default=None,
type=str)
# single-configure
@@ -555,7 +555,7 @@ def main():
or cmdargs.excl_privileged_tests != None
or cmdargs.excl_unportable_tests != None
or cmdargs.avoids != None or cmdargs.lgpl != None
- or cmdargs.makefile != None))):
+ or cmdargs.makefile_name != None))):
message = '%s: *** ' % constants.APP['name']
message += 'invalid options for --%s mode\n' % mode
message += 'Try \'gnulib-tool --help\' for more information.\n'
@@ -629,7 +629,7 @@ def main():
if lgpl == None:
lgpl = True
libtool = cmdargs.libtool
- makefile = cmdargs.makefile
+ makefile_name = cmdargs.makefile_name
avoids = cmdargs.avoids
if avoids != None:
avoids = [ module
@@ -655,7 +655,7 @@ def main():
excl_test_categories=excl_test_categories,
libname=libname,
lgpl=lgpl,
- makefile=makefile,
+ makefile_name=makefile_name,
libtool=libtool,
conddeps=conddeps,
macro_prefix=macro_prefix,
diff --git a/pygnulib/GLConfig.py b/pygnulib/GLConfig.py
index baf61029c9..34788f0f74 100644
--- a/pygnulib/GLConfig.py
+++ b/pygnulib/GLConfig.py
@@ -56,7 +56,7 @@ class GLConfig(object):
sourcebase=None, m4base=None, pobase=None, docbase=None, testsbase=None,
modules=None, avoids=None, files=None,
incl_test_categories=None, excl_test_categories=None, libname=None,
- lgpl=None, makefile=None, libtool=None, conddeps=None, macro_prefix=None,
+ lgpl=None, makefile_name=None, libtool=None, conddeps=None, macro_prefix=None,
podomain=None, witness_c_macro=None, vc_files=None, symbolic=None,
lsymbolic=None, configure_ac=None, ac_version=None,
libtests=None, single_configure=None, verbose=None, dryrun=None,
@@ -130,10 +130,10 @@ class GLConfig(object):
self.resetLGPL()
if lgpl != None:
self.setLGPL(lgpl)
- # makefile
- self.resetMakefile()
- if makefile != None:
- self.setMakefile(makefile)
+ # makefile_name
+ self.resetMakefileName()
+ if makefile_name != None:
+ self.setMakefileName(makefile_name)
# libtool
self.resetLibtool()
if libtool != None:
@@ -671,7 +671,7 @@ class GLConfig(object):
def setInclTestCategory(self, category, enable):
'''Enable or disable the given test category.'''
- if (enable):
+ if enable:
self.enableInclTestCategory(category)
else:
self.disableInclTestCategory(category)
@@ -855,26 +855,26 @@ class GLConfig(object):
include_guard_prefix = 'GL'
self.table['include_guard_prefix'] = include_guard_prefix
- # Define makefile methods.
- def getMakefile(self):
+ # Define makefile_name methods.
+ def getMakefileName(self):
'''Return the name of makefile in automake syntax in the source-base and
tests-base directories. Default is 'Makefile.am'.'''
- return self.table['makefile']
+ return self.table['makefile_name']
- def setMakefile(self, makefile):
+ def setMakefileName(self, makefile_name):
'''Specify the name of makefile in automake syntax in the source-base and
tests-base directories. Default is 'Makefile.am'.'''
- if type(makefile) is str:
- if makefile:
- self.table['makefile'] = makefile
- else: # if type of makefile is not str
- raise TypeError('makefile must be a string, not %s'
- % type(makefile).__name__)
-
- def resetMakefile(self):
+ if type(makefile_name) is str:
+ if makefile_name:
+ self.table['makefile_name'] = makefile_name
+ else: # if type of makefile_name is not str
+ raise TypeError('makefile_name must be a string, not %s'
+ % type(makefile_name).__name__)
+
+ def resetMakefileName(self):
'''Reset the name of makefile in automake syntax in the source-base and
tests-base directories. Default is 'Makefile.am'.'''
- self.table['makefile'] = ''
+ self.table['makefile_name'] = ''
# Define podomain methods.
def getPoDomain(self):
diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py
index 97bb585e3f..9d9ca458ee 100644
--- a/pygnulib/GLEmiter.py
+++ b/pygnulib/GLEmiter.py
@@ -604,7 +604,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
Emit the contents of the library Makefile. Returns str and a bool
variable which shows if subdirectories are used.
- GLConfig: localpath, sourcebase, libname, pobase, auxdir, makefile, libtool,
+ GLConfig: localpath, sourcebase, libname, pobase, auxdir, makefile_name, libtool,
macro_prefix, podomain, conddeps, witness_c_macro.
destfile is a filename relative to destdir of Makefile being generated.
@@ -638,7 +638,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
libname = self.config['libname']
pobase = self.config['pobase']
auxdir = self.config['auxdir']
- makefile = self.config['makefile']
+ makefile_name = self.config['makefile_name']
libtool = self.config['libtool']
macro_prefix = self.config['macro_prefix']
podomain = self.config['podomain']
@@ -651,9 +651,9 @@ AC_DEFUN([%V1%_LIBSOURCES], [
# When creating an includable Makefile.am snippet, augment variables with
# += instead of assigning them.
- if makefile:
+ if makefile_name:
assign = '+='
- else: # if not makefile
+ else: # if not makefile_name
assign = '='
if libtool:
libext = 'la'
@@ -732,7 +732,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
and file.count('/') > 1):
uses_subdirs = True
break
- if not makefile:
+ if not makefile_name:
subdir_options = ''
# If there are source files in subdirectories, prevent collision of the
# object files (example: hash.c and libxml/hash.c).
@@ -740,7 +740,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
subdir_options = ' subdir-objects'
emit += 'AUTOMAKE_OPTIONS = 1.9.6 gnits%s\n' % subdir_options
emit += '\n'
- if not makefile:
+ if not makefile_name:
emit += 'SUBDIRS =\n'
emit += 'noinst_HEADERS =\n'
emit += 'noinst_LIBRARIES =\n'
@@ -758,7 +758,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
emit += 'BUILT_SOURCES =\n'
emit += 'SUFFIXES =\n'
emit += 'MOSTLYCLEANFILES %s core *.stackdump\n' % assign
- if not makefile:
+ if not makefile_name:
emit += 'MOSTLYCLEANDIRS =\n'
emit += 'CLEANFILES =\n'
emit += 'DISTCLEANFILES =\n'
@@ -788,10 +788,10 @@ AC_DEFUN([%V1%_LIBSOURCES], [
if for_test:
cppflags_part2 = ' -DGNULIB_STRICT_CHECKING=1'
cppflags = '%s%s' % (cppflags_part1, cppflags_part2)
- if not makefile:
+ if not makefile_name:
emit += 'AM_CPPFLAGS =%s\n' % cppflags
emit += 'AM_CFLAGS =\n'
- else: # if makefile
+ else: # if makefile_name
if cppflags:
emit += 'AM_CPPFLAGS +=%s\n' % cppflags
emit += '\n'
@@ -807,7 +807,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
insnippets = bool(pattern.findall(allsnippets))
# Then test if $sourcebase/Makefile.am (if it exists) specifies it.
path = joinpath(sourcebase, 'Makefile.am')
- if makefile and isfile(path):
+ if makefile_name and isfile(path):
with codecs.open(path, 'rb', 'UTF-8') as file:
data = file.read()
inmakefile = bool(pattern.findall(data))
@@ -866,7 +866,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
Emit the contents of the tests Makefile. Returns str and a bool variable
which shows if subdirectories are used.
- GLConfig: localpath, modules, libname, auxdir, makefile, libtool,
+ GLConfig: localpath, modules, libname, auxdir, makefile_name, libtool,
sourcebase, m4base, testsbase, macro_prefix, witness_c_macro,
single_configure, libtests.
@@ -901,7 +901,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
m4base = self.config['m4base']
pobase = self.config['pobase']
testsbase = self.config['testsbase']
- makefile = self.config['makefile']
+ makefile_name = self.config['makefile_name']
libtool = self.config['libtool']
macro_prefix = self.config['macro_prefix']
podomain = self.config['podomain']
diff --git a/pygnulib/GLFileSystem.py b/pygnulib/GLFileSystem.py
index bee38223d5..82f5f085b9 100644
--- a/pygnulib/GLFileSystem.py
+++ b/pygnulib/GLFileSystem.py
@@ -173,7 +173,6 @@ class GLFileAssistant(object):
self.original = None
self.rewritten = None
self.added = list()
- self.makefile = list()
self.config = config
self.transformers = transformers
self.filesystem = GLFileSystem(self.config)
diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index bf8171ea6b..dda10c1b76 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -193,7 +193,7 @@ class GLImport(object):
if tempdict['gl_TESTS_BASE']:
self.cache.setTestsBase(cleaner(tempdict['gl_TESTS_BASE']))
if tempdict['gl_MAKEFILE_NAME']:
- self.cache.setMakefile(cleaner(tempdict['gl_MAKEFILE_NAME']))
+ self.cache.setMakefileName(cleaner(tempdict['gl_MAKEFILE_NAME']))
if tempdict['gl_MACRO_PREFIX']:
self.cache.setMacroPrefix(cleaner(tempdict['gl_MACRO_PREFIX']))
if tempdict['gl_PO_DOMAIN']:
@@ -364,7 +364,7 @@ class GLImport(object):
conddeps = self.config.checkCondDeps()
libname = self.config.getLibName()
lgpl = self.config.getLGPL()
- makefile = self.config.getMakefile()
+ makefile_name = self.config.getMakefileName()
libtool = self.config.checkLibtool()
macro_prefix = self.config.getMacroPrefix()
witness_c_macro = self.config.getWitnessCMacro()
@@ -406,8 +406,8 @@ class GLImport(object):
actioncmd += ' --lgpl'
else: # if lgpl != True
actioncmd += ' --lgpl=%s' % lgpl
- if makefile:
- actioncmd += ' --makefile-name=%s' % makefile
+ if makefile_name:
+ actioncmd += ' --makefile-name=%s' % makefile_name
if conddeps:
actioncmd += ' --conditional-dependencies'
else: # if not conddeps
@@ -479,7 +479,7 @@ class GLImport(object):
testsbase = self.config['testsbase']
lgpl = self.config['lgpl']
libname = self.config['libname']
- makefile = self.config['makefile']
+ makefile_name = self.config['makefile_name']
conddeps = self.config['conddeps']
libtool = self.config['libtool']
macro_prefix = self.config['macro_prefix']
@@ -532,7 +532,7 @@ class GLImport(object):
emit += 'gl_LGPL\n'
else: # if lgpl != True
emit += 'gl_LGPL([%s])\n' % lgpl
- emit += 'gl_MAKEFILE_NAME([%s])\n' % makefile
+ emit += 'gl_MAKEFILE_NAME([%s])\n' % makefile_name
if conddeps:
emit += 'gl_CONDITIONAL_DEPENDENCIES\n'
if libtool:
@@ -562,7 +562,7 @@ class GLImport(object):
testsbase = self.config['testsbase']
lgpl = self.config['lgpl']
libname = self.config['libname']
- makefile = self.config['makefile']
+ makefile_name = self.config['makefile_name']
conddeps = self.config['conddeps']
libtool = self.config['libtool']
macro_prefix = self.config['macro_prefix']
@@ -768,7 +768,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
lgpl = self.config['lgpl']
copyrights = self.config['copyrights']
libname = self.config['libname']
- makefile = self.config['makefile']
+ makefile_name = self.config['makefile_name']
conddeps = self.config['conddeps']
libtool = self.config['libtool']
macro_prefix = self.config['macro_prefix']
@@ -1004,7 +1004,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
lgpl = self.config['lgpl']
copyrights = self.config['copyrights']
libname = self.config['libname']
- makefile = self.config['makefile']
+ makefile_name = self.config['makefile_name']
conddeps = self.config['conddeps']
libtool = self.config['libtool']
macro_prefix = self.config['macro_prefix']
@@ -1102,10 +1102,10 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
include_guard_prefix = self.config['include_guard_prefix']
# Determine makefile name.
- if not makefile:
+ if not makefile_name:
makefile_am = 'Makefile.am'
- else: # if makefile
- makefile_am = makefile
+ else: # if makefile_name
+ makefile_am = makefile_name
# Create normal Makefile.ams.
for_test = False
@@ -1414,14 +1414,14 @@ in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library.''')
if makefile_am == 'Makefile.am':
print(' - add "%s/Makefile" to AC_CONFIG_FILES in %s,' % (sourcebase, configure_ac))
else: # if makefile_am != 'Makefile.am'
- print(' - "include %s" from within "%s/Makefile.am",' % (makefile, sourcebase))
+ print(' - "include %s" from within "%s/Makefile.am",' % (makefile_name, sourcebase))
if pobase:
print(' - add "%s/Makefile.in to AC_CONFIG_FILES in %s,' % (pobase, configure_ac))
if inctests:
if makefile_am == 'Makefile.am':
print(' - add "%s/Makefile" to AC_CONFIG_FILES in %s,' % (testsbase, configure_ac))
else: # if makefile_am != 'Makefile.am'
- print(' - "include %s" from within "%s/Makefile.am",' % (makefile, testsbase))
+ print(' - "include %s" from within "%s/Makefile.am",' % (makefile_name, testsbase))
# Print makefile edits.
current_edit = int()
makefile_am_edits = self.makefiletable.count()
diff --git a/pygnulib/GLMakefileTable.py b/pygnulib/GLMakefileTable.py
index abaeaf9d2e..d23f5710cb 100644
--- a/pygnulib/GLMakefileTable.py
+++ b/pygnulib/GLMakefileTable.py
@@ -81,18 +81,18 @@ class GLMakefileTable(object):
Add a special row to Makefile.am table with the first parent directory
which contains or will contain Makefile.am file.
GLConfig: sourcebase, m4base, testsbase, incl_test_categories,
- excl_test_categories, makefile.'''
+ excl_test_categories, makefile_name.'''
m4base = self.config['m4base']
sourcebase = self.config['sourcebase']
testsbase = self.config['testsbase']
- makefile = self.config['makefile']
+ makefile_name = self.config['makefile_name']
inctests = self.config.checkInclTestCategory(TESTS['tests'])
dir1 = '%s%s' % (m4base, os.path.sep)
mfd = 'Makefile.am'
- if not makefile:
+ if not makefile_name:
mfx = 'Makefile.am'
- else: # if makefile
- mfx = makefile
+ else: # if makefile_name
+ mfx = makefile_name
dir2 = ''
while (dir1
and (joinpath(self.config['destdir'], dir1, mfd)
--
2.34.1
>From fcf959cfe1f3ee1c84bf47af33023c440894b734 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Fri, 5 Aug 2022 23:34:20 +0200
Subject: [PATCH 07/12] gnulib-tool.py: Remove redundant type checks.
* pygnulib/GLConfig.py (GLConfig.__init__): Remove redundant type
checks, left over from 2022-08-04.
(GLConfig.getIncludeGuardPrefix): Improve comment.
(GLConfig.resetMacroPrefix): Optimize.
---
ChangeLog | 6 ++++
pygnulib/GLConfig.py | 71 +++++++++++---------------------------------
2 files changed, 24 insertions(+), 53 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 85938bb76f..4301d9c847 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2022-08-05 Bruno Haible <[email protected]>
+ gnulib-tool.py: Remove redundant type checks.
+ * 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.
* gnulib-tool.py (main): Rename variable 'makefile' to 'makefile_name'.
* pygnulib/GLConfig.py: Rename attribute 'makefile' to 'makefile_name'.
diff --git a/pygnulib/GLConfig.py b/pygnulib/GLConfig.py
index 34788f0f74..e571dff2b3 100644
--- a/pygnulib/GLConfig.py
+++ b/pygnulib/GLConfig.py
@@ -137,19 +137,11 @@ class GLConfig(object):
# libtool
self.resetLibtool()
if libtool != None:
- if type(libtool) is bool:
- self.setLibtool(libtool)
- else: # if type(libtool) is not bool
- raise TypeError('libtool must be a bool, not %s'
- % type(libtool).__name__)
+ self.setLibtool(libtool)
# conddeps
self.resetCondDeps()
if conddeps != None:
- if type(conddeps) is bool:
- self.setCondDeps(conddeps)
- else: # if type(conddeps) is not bool
- raise TypeError('conddeps must be a bool, not %s'
- % type(conddeps).__name__)
+ self.setCondDeps(conddeps)
# macro_prefix
self.resetMacroPrefix()
if macro_prefix != None:
@@ -172,27 +164,15 @@ class GLConfig(object):
# vc_files
self.resetVCFiles()
if vc_files != None:
- if type(vc_files) is bool:
- self.setVCFiles(vc_files)
- else: # if type(vc_files) is not bool
- raise TypeError('vc_files must be a bool, not %s'
- % type(vc_files).__name__)
+ self.setVCFiles(vc_files)
# symbolic
self.resetSymbolic()
if symbolic != None:
- if type(symbolic) is bool:
- self.setSymbolic(symbolic)
- else: # if type(symbolic) is not bool
- raise TypeError('symbolic must be a bool, not %s'
- % type(symbolic).__name__)
+ self.setSymbolic(symbolic)
# lsymbolic
self.resetLSymbolic()
if lsymbolic != None:
- if type(lsymbolic) is bool:
- self.setLSymbolic(lsymbolic)
- else: # if type(lsymbolic) is not bool
- raise TypeError('lsymbolic must be a bool, not %s'
- % type(lsymbolic).__name__)
+ self.setLSymbolic(lsymbolic)
# configure_ac
self.resetAutoconfFile()
if configure_ac != None:
@@ -204,19 +184,11 @@ class GLConfig(object):
# libtests
self.resetLibtests()
if libtests != None:
- if type(libtests) is bool:
- self.setLibtests(libtests)
- else: # if type(libtests) is not bool
- raise TypeError('libtests must be a bool, not %s'
- % type(libtests).__name__)
+ self.setLibtests(libtests)
# single_configure
self.resetSingleConfigure()
if single_configure != None:
- if type(single_configure) is bool:
- self.setSingleConfigure(single_configure)
- else: # if type(single_configure) is not bool
- raise TypeError('single_configure must be a bool, not %s'
- % type(single_configure).__name__)
+ self.setSingleConfigure(single_configure)
# verbose
self.resetVerbosity()
if verbose != None:
@@ -224,19 +196,11 @@ class GLConfig(object):
# dryrun
self.resetDryRun()
if dryrun != None:
- if type(dryrun) is bool:
- self.setDryRun(dryrun)
- else: # if type(dryrun) is not bool
- raise TypeError('dryrun must be a bool, not %s'
- % type(dryrun).__name__)
+ self.setDryRun(dryrun)
# errors
self.resetErrors()
if errors != None:
- if type(errors) is bool:
- self.setErrors(errors)
- else: # if type(errors) is not bool
- raise TypeError('errors must be a bool, not %s'
- % type(errors).__name__)
+ self.setErrors(errors)
# Define special methods.
def __repr__(self):
@@ -819,20 +783,22 @@ class GLConfig(object):
Default value is None, which means that lgpl is disabled.'''
self.table['lgpl'] = None
- def getIncludeGuardPrefix(self):
- '''Return include_guard_prefix to use inside GLEmiter class.'''
- return self.table['include_guard_prefix']
-
def getModuleIndicatorPrefix(self):
'''Return module_indicator_prefix to use inside GLEmiter class.'''
return self.getIncludeGuardPrefix()
- # Define macro_prefix methods.
+ # Define macro_prefix and include_guard_prefix methods.
+ # The include_guard_prefix is a replacement for ${gl_include_guard_prefix}.
+ # It is determined from the macro_prefix.
def getMacroPrefix(self):
'''Return the prefix of the macros 'gl_EARLY' and 'gl_INIT'.
Default macro_prefix is 'gl'.'''
return self.table['macro_prefix']
+ def getIncludeGuardPrefix(self):
+ '''Return the replacement for ${gl_include_guard_prefix}.'''
+ return self.table['include_guard_prefix']
+
def setMacroPrefix(self, macro_prefix):
'''Specify the prefix of the macros 'gl_EARLY' and 'gl_INIT'.
Default macro_prefix is 'gl'.'''
@@ -852,8 +818,7 @@ class GLConfig(object):
'''Reset the prefix of the macros 'gl_EARLY' and 'gl_INIT'.
Default macro_prefix is 'gl'.'''
self.table['macro_prefix'] = 'gl'
- include_guard_prefix = 'GL'
- self.table['include_guard_prefix'] = include_guard_prefix
+ self.table['include_guard_prefix'] = 'GL'
# Define makefile_name methods.
def getMakefileName(self):
@@ -976,11 +941,11 @@ class GLConfig(object):
'''Specify preferred autoconf version. Default value is 2.59.'''
self.table['ac_version'] = 2.59
- # Define symbolic methods.
def checkCopyrights(self):
'''Check if copyright notices in files should be replaced.'''
return self.table['copyrights']
+ # Define symbolic methods.
def checkSymbolic(self):
'''Check if pygnulib will make symbolic links instead of copying files.'''
return self.table['symbolic']
--
2.34.1
>From 13af1a0d8a0bb1028bd4a1276c8da2d68db78367 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Sat, 6 Aug 2022 00:14:02 +0200
Subject: [PATCH 08/12] gnulib-tool.py: Implement option --no-libtool.
* gnulib-tool.py (main): Accept option --no-libtool.
---
ChangeLog | 3 +++
gnulib-tool.py | 10 +++++++---
gnulib-tool.py.TODO | 1 -
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4301d9c847..652600a45a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2022-08-05 Bruno Haible <[email protected]>
+ gnulib-tool.py: Implement option --no-libtool.
+ * gnulib-tool.py (main): Accept option --no-libtool.
+
gnulib-tool.py: Remove redundant type checks.
* pygnulib/GLConfig.py (GLConfig.__init__): Remove redundant type
checks, left over from 2022-08-04.
diff --git a/gnulib-tool.py b/gnulib-tool.py
index 9c63f6147f..f11c7bd5cb 100755
--- a/gnulib-tool.py
+++ b/gnulib-tool.py
@@ -319,10 +319,14 @@ def main():
default=None,
nargs=1)
# libtool
- parser.add_argument("--libtool",
- dest=libtool,
- default=False,
+ parser.add_argument('--libtool',
+ dest='libtool',
+ default=None,
action="store_true")
+ parser.add_argument('--no-libtool',
+ dest='libtool',
+ default=None,
+ action="store_false")
# libname
parser.add_argument('--lib',
dest='libname',
diff --git a/gnulib-tool.py.TODO b/gnulib-tool.py.TODO
index de3a90dc37..6787e88df2 100644
--- a/gnulib-tool.py.TODO
+++ b/gnulib-tool.py.TODO
@@ -29,7 +29,6 @@ Implement the options:
--gnu-make
--tests-makefile-name
--automake-subdir
- --no-libtool
--macro-prefix
--po-domain
--witness-c-macro
--
2.34.1
>From 0108a901f10bf6ed6198e565c35b091c3fe6e218 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Sat, 6 Aug 2022 01:47:34 +0200
Subject: [PATCH 09/12] gnulib-tool.py: Refactor --makefile-name option.
* gnulib-tool.py (main): Handle option --makefile-name like all other
string-valued options.
---
ChangeLog | 4 ++++
gnulib-tool.py | 10 ++++++----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 652600a45a..d98a5bd692 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2022-08-05 Bruno Haible <[email protected]>
+ gnulib-tool.py: Refactor --makefile-name option.
+ * gnulib-tool.py (main): Handle option --makefile-name like all other
+ string-valued options.
+
gnulib-tool.py: Implement option --no-libtool.
* gnulib-tool.py (main): Accept option --no-libtool.
diff --git a/gnulib-tool.py b/gnulib-tool.py
index f11c7bd5cb..ba15ba7154 100755
--- a/gnulib-tool.py
+++ b/gnulib-tool.py
@@ -314,9 +314,9 @@ def main():
action='store_true')
# avoids
parser.add_argument('--avoid',
- action='append',
dest='avoids',
default=None,
+ action='append',
nargs=1)
# libtool
parser.add_argument('--libtool',
@@ -370,10 +370,10 @@ def main():
choices=['2', '3orGPLv2', '3'],
nargs='?')
# makefile-name
- parser.add_argument("--makefile-name",
- dest="makefile_name",
+ parser.add_argument('--makefile-name',
+ dest='makefile_name',
default=None,
- type=str)
+ nargs=1)
# single-configure
parser.add_argument('--single-configure',
dest='single_configure',
@@ -634,6 +634,8 @@ def main():
lgpl = True
libtool = cmdargs.libtool
makefile_name = cmdargs.makefile_name
+ if makefile_name != None:
+ makefile_name = makefile_name[0]
avoids = cmdargs.avoids
if avoids != None:
avoids = [ module
--
2.34.1
>From bfc5329c890031833022bc78b5f0e793a53f5be6 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Sat, 6 Aug 2022 02:10:32 +0200
Subject: [PATCH 10/12] gnulib-tool.py: Finish implementing option
--macro-prefix.
* gnulib-tool.py (main): Accept option --macro-prefix.
---
ChangeLog | 3 +++
gnulib-tool.py | 11 ++++++++++-
gnulib-tool.py.TODO | 1 -
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d98a5bd692..16d17a6232 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2022-08-05 Bruno Haible <[email protected]>
+ gnulib-tool.py: Finish implementing option --macro-prefix.
+ * gnulib-tool.py (main): Accept option --macro-prefix.
+
gnulib-tool.py: Refactor --makefile-name option.
* gnulib-tool.py (main): Handle option --makefile-name like all other
string-valued options.
diff --git a/gnulib-tool.py b/gnulib-tool.py
index ba15ba7154..030e3caf73 100755
--- a/gnulib-tool.py
+++ b/gnulib-tool.py
@@ -374,6 +374,11 @@ def main():
dest='makefile_name',
default=None,
nargs=1)
+ # macro-prefix
+ parser.add_argument('--macro-prefix',
+ dest='macro_prefix',
+ default=None,
+ nargs=1)
# single-configure
parser.add_argument('--single-configure',
dest='single_configure',
@@ -559,7 +564,8 @@ def main():
or cmdargs.excl_privileged_tests != None
or cmdargs.excl_unportable_tests != None
or cmdargs.avoids != None or cmdargs.lgpl != None
- or cmdargs.makefile_name != None))):
+ or cmdargs.makefile_name != None
+ or cmdargs.macro_prefix != None))):
message = '%s: *** ' % constants.APP['name']
message += 'invalid options for --%s mode\n' % mode
message += 'Try \'gnulib-tool --help\' for more information.\n'
@@ -636,6 +642,9 @@ def main():
makefile_name = cmdargs.makefile_name
if makefile_name != None:
makefile_name = makefile_name[0]
+ macro_prefix = cmdargs.macro_prefix
+ if macro_prefix != None:
+ macro_prefix = macro_prefix[0]
avoids = cmdargs.avoids
if avoids != None:
avoids = [ module
diff --git a/gnulib-tool.py.TODO b/gnulib-tool.py.TODO
index 6787e88df2..87438c5a16 100644
--- a/gnulib-tool.py.TODO
+++ b/gnulib-tool.py.TODO
@@ -29,7 +29,6 @@ Implement the options:
--gnu-make
--tests-makefile-name
--automake-subdir
- --macro-prefix
--po-domain
--witness-c-macro
--vc-files
--
2.34.1
>From b5850cf209fc597150fb196067674c8c41857316 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Sat, 6 Aug 2022 03:06:51 +0200
Subject: [PATCH 11/12] gnulib-tool.py: Finish implementing option --po-domain.
* 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.
---
ChangeLog | 8 ++++++++
gnulib-tool.py | 20 +++++++++++++++++++-
gnulib-tool.py.TODO | 1 -
pygnulib/GLEmiter.py | 3 +--
pygnulib/GLImport.py | 11 +++++++----
5 files changed, 35 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 16d17a6232..fde81debea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2022-08-05 Bruno Haible <[email protected]>
+ gnulib-tool.py: Finish implementing option --po-domain.
+ * 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: Finish implementing option --macro-prefix.
* gnulib-tool.py (main): Accept option --macro-prefix.
diff --git a/gnulib-tool.py b/gnulib-tool.py
index 030e3caf73..8dbf2d06a8 100755
--- a/gnulib-tool.py
+++ b/gnulib-tool.py
@@ -379,6 +379,11 @@ def main():
dest='macro_prefix',
default=None,
nargs=1)
+ # po-domain
+ parser.add_argument('--po-domain',
+ dest='podomain',
+ default=None,
+ nargs=1)
# single-configure
parser.add_argument('--single-configure',
dest='single_configure',
@@ -565,13 +570,23 @@ def main():
or cmdargs.excl_unportable_tests != None
or cmdargs.avoids != None or cmdargs.lgpl != None
or cmdargs.makefile_name != None
- or cmdargs.macro_prefix != None))):
+ or cmdargs.macro_prefix != None or cmdargs.podomain != None))):
message = '%s: *** ' % constants.APP['name']
message += 'invalid options for --%s mode\n' % mode
message += 'Try \'gnulib-tool --help\' for more information.\n'
message += '%s: *** Stop.\n' % constants.APP['name']
sys.stderr.write(message)
sys.exit(1)
+ if cmdargs.pobase != None and cmdargs.podomain == None:
+ message = '%s: *** ' % constants.APP['name']
+ message += 'together with --po-base, you need to specify --po-domain\n'
+ message += 'Try \'gnulib-tool --help\' for more information.\n'
+ message += '%s: *** Stop.\n' % constants.APP['name']
+ sys.stderr.write(message)
+ sys.exit(1)
+ if cmdargs.pobase == None and cmdargs.podomain != None:
+ message = '%s: warning: --po-domain has no effect without a --po-base option\n' % constants.APP['name']
+ sys.stderr.write(message)
# Determine specific settings.
destdir = cmdargs.destdir
@@ -645,6 +660,9 @@ def main():
macro_prefix = cmdargs.macro_prefix
if macro_prefix != None:
macro_prefix = macro_prefix[0]
+ podomain = cmdargs.podomain
+ if podomain != None:
+ podomain = podomain[0]
avoids = cmdargs.avoids
if avoids != None:
avoids = [ module
diff --git a/gnulib-tool.py.TODO b/gnulib-tool.py.TODO
index 87438c5a16..b59e89cc59 100644
--- a/gnulib-tool.py.TODO
+++ b/gnulib-tool.py.TODO
@@ -29,7 +29,6 @@ Implement the options:
--gnu-make
--tests-makefile-name
--automake-subdir
- --po-domain
--witness-c-macro
--vc-files
--no-vc-files
diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py
index 9d9ca458ee..b6c31fa603 100644
--- a/pygnulib/GLEmiter.py
+++ b/pygnulib/GLEmiter.py
@@ -444,8 +444,7 @@ USE_MSGCTXT = no\n"""
Emit the file list to be passed to xgettext.
GLConfig: sourcebase.'''
emit = ''
- sourcebase = self.config['sourcebase']
- sourcebase = '%s%s' % (self.sourcebase, os.path.sep)
+ sourcebase = self.config['sourcebase'] + os.path.sep
files = [ constants.substart('lib/', sourcebase, file)
for file in files ]
files = [ file
diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index dda10c1b76..9de4b3b93c 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -42,10 +42,12 @@ __copyright__ = constants.__copyright__
#===============================================================================
# Define global constants
#===============================================================================
+DIRS = constants.DIRS
MODES = constants.MODES
TESTS = constants.TESTS
joinpath = constants.joinpath
cleaner = constants.cleaner
+copyfile = constants.copyfile
copyfile2 = constants.copyfile2
movefile = constants.movefile
isabs = os.path.isabs
@@ -1161,7 +1163,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
tmpfile = self.assistant.tmpfilename(joinpath(pobase, file))
path = joinpath('build-aux', 'po', file)
lookedup, flag = filesystem.lookup(path)
- movefile(lookedup, tmpfile)
+ copyfile(lookedup, tmpfile)
basename = joinpath(pobase, file)
filename, backup, flag = self.assistant.super_update(basename, tmpfile)
if flag == 1:
@@ -1227,7 +1229,8 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
os.chdir(joinpath(destdir, pobase))
args = ['wget', '--no-verbose', '--mirror', '--level=1', '-nd', '-A.po', '-P', '.',
'%sgnulib/' % TP_URL]
- sp.call(args, shell=True)
+ sp.call(args)
+ os.chdir(DIRS['cwd'])
else: # if self.config['dryrun']
print('Fetch gnulib PO files from %s' % TP_URL)
@@ -1236,8 +1239,8 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
if not self.config['dryrun']:
tmpfile = self.assistant.tmpfilename(basename)
data = '# Set of available languages.\n'
- files = [constants.subend('.po', '', file)
- for file in os.listdir(joinpath(destdir, pobase))]
+ files = [ constants.subend('.po', '', file)
+ for file in os.listdir(joinpath(destdir, pobase)) ]
data += '\n'.join(files)
with codecs.open(tmpfile, 'wb', 'UTF-8') as file:
file.write(data)
--
2.34.1
>From 6ef9c33342e6cdb898e157997ea33ed2ab8e00cb Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Sat, 6 Aug 2022 03:18:32 +0200
Subject: [PATCH 12/12] gnulib-tool.py: Don't initialize local variables too
early.
* gnulib-tool.py (main): Initialize each local variable in one place.
I prefer to have pylint tell me about uninitialized variables than to
get the value None at runtime.
---
ChangeLog | 5 +++++
gnulib-tool.py | 33 +++++++--------------------------
2 files changed, 12 insertions(+), 26 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fde81debea..dc968b8982 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2022-08-05 Bruno Haible <[email protected]>
+ gnulib-tool.py: Don't initialize local variables too early.
+ * gnulib-tool.py (main): Initialize each local variable in one place.
+ I prefer to have pylint tell me about uninitialized variables than to
+ get the value None at runtime.
+
gnulib-tool.py: Finish implementing option --po-domain.
* gnulib-tool.py (main): Accept option --po-domain.
* pygnulib/GLEmiter.py (GLEmiter.po_POTFILES_in): Fix variable
diff --git a/gnulib-tool.py b/gnulib-tool.py
index 8dbf2d06a8..78bb326a69 100755
--- a/gnulib-tool.py
+++ b/gnulib-tool.py
@@ -67,32 +67,6 @@ isfile = os.path.isfile
# Define main part
#===============================================================================
def main():
- # Reset arguments
- mode = None
- destdir = None
- localpath = None
- verbose = None
- auxdir = None
- modules = None
- avoids = None
- sourcebase = None
- m4base = None
- pobase = None
- docbase = None
- testsbase = None
- tests = None
- libname = None
- lgpl = None
- makefile_name = None
- libtool = None
- conddeps = None
- macro_prefix = None
- podomain = None
- witness_c_macro = None
- vc_files = None
- dryrun = None
- errors = None
-
info = classes.GLInfo()
parser = argparse.ArgumentParser(
prog=constants.APP['name'],
@@ -467,6 +441,9 @@ def main():
sys.exit(1)
# Determine selected mode.
+ mode = None
+ modules = None
+ files = None
if cmdargs.mode_list != None:
mode = 'list'
if cmdargs.mode_import != None:
@@ -671,6 +648,10 @@ def main():
symlink = cmdargs.symlink == True
lsymlink = cmdargs.lsymlink == True
single_configure = cmdargs.single_configure
+ docbase = None
+ conddeps = None
+ witness_c_macro = None
+ vc_files = None
# Create pygnulib configuration.
config = classes.GLConfig(
--
2.34.1