summaryrefslogtreecommitdiff
path: root/pygnulib
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2022-08-09 23:59:40 +0200
committerBruno Haible <bruno@clisp.org>2022-08-09 23:59:40 +0200
commitbc3d94bb2df6fa0c766f6226814c2fc2a55ee049 (patch)
tree7b2f7cb3b4b31b0111886de295f9741e357a7899 /pygnulib
parent98e7ca354a1108b0b99236e29bedbc6bfbd8593e (diff)
downloadgnulib-bc3d94bb2df6fa0c766f6226814c2fc2a55ee049.tar.gz
gnulib-tool.py: Don't do license replacements in the autoconf snippets.
* 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.
Diffstat (limited to 'pygnulib')
-rw-r--r--pygnulib/GLEmiter.py51
-rw-r--r--pygnulib/GLImport.py4
-rw-r--r--pygnulib/GLTestDir.py10
3 files changed, 21 insertions, 44 deletions
diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py
index 1a15fc4918..9b54d5009e 100644
--- a/pygnulib/GLEmiter.py
+++ b/pygnulib/GLEmiter.py
@@ -95,18 +95,15 @@ class GLEmiter(object):
# Generated by gnulib-tool.\n"""
return constants.nlconvert(emit)
- def autoconfSnippet(self, module, fileassistant, toplevel,
+ def autoconfSnippet(self, module, toplevel,
disable_libtool, disable_gettext, replace_auxdir, indentation):
'''GLEmiter.autoconfSnippet(module, toplevel,
- disable_libtool, disable_gettext, replace_auxdir,
- indentation) -> str
+ disable_libtool, disable_gettext, replace_auxdir, indentation) -> str
Emit the autoconf snippet of a module.
GLConfig: include_guard_prefix.
module is a GLModule instance, which is processed.
- fileassistant is a GLFileAssistant instance, which is used to get temporary
- directories and sed transformer.
toplevel is a bool variable, False means a subordinate use of pygnulib.
disable_libtool is a bool variable; it tells whether to disable libtool
handling even if it has been specified through the GLConfig class.
@@ -115,13 +112,9 @@ class GLEmiter(object):
replace_auxdir is a bool variable; it tells whether to replace
'build-aux' directory in AC_CONFIG_FILES.
indentation is a string which contain spaces to prepend on each line.'''
- emit = ''
if type(module) is not GLModule:
raise TypeError('module must be a GLModule, not %s'
% type(module).__name__)
- if type(fileassistant) is not GLFileAssistant:
- raise TypeError('fileassistant must be a GLFileAssistant, not %s'
- % type(fileassistant).__name__)
if type(toplevel) is not bool:
raise TypeError('toplevel must be a bool, not %s'
% type(toplevel).__name__)
@@ -139,6 +132,7 @@ class GLEmiter(object):
auxdir = self.config['auxdir']
libtool = self.config['libtool']
include_guard_prefix = self.config['include_guard_prefix']
+ emit = ''
if str(module) in ['gnumakefile', 'maintainer-makefile']:
# These modules are meant to be used only in the top-level directory.
flag = toplevel
@@ -152,18 +146,8 @@ class GLEmiter(object):
for line in snippet.split('\n')
if line.strip() ]
snippet = '%s\n' % '\n'.join(lines)
- transformer = fileassistant.transformers.get('aux', '')
pattern = re.compile('^(.*)$', re.M)
snippet = pattern.sub('%s\\1' % indentation, snippet)
- if transformer:
- args = ['sed', '-e', transformer]
- path = fileassistant.tmpfilename('snippet')
- with codecs.open(path, 'wb', 'UTF-8') as file:
- file.write(snippet)
- stdin = codecs.open(path, 'rb', 'UTF-8')
- snippet = sp.check_output(args, stdin=stdin, shell=False)
- snippet = snippet.decode("UTF-8")
- os.remove(path)
if disable_libtool:
snippet = snippet.replace('$gl_cond_libtool', 'false')
snippet = snippet.replace('gl_libdeps', 'gltests_libdeps')
@@ -181,23 +165,21 @@ class GLEmiter(object):
emit += "LTALLOCA=`echo \"$ALLOCA\" | sed -e 's/\\.[^.]* /.lo /g;s/\\.[^.]*$/.lo/'`\n"
emit += 'changequote([, ])dnl\n'
emit += 'AC_SUBST([LTALLOCA])'
- if replace_auxdir:
- regex = 'AC_CONFIG_FILES\\(\\[(.*)\\:build-aux/(.*)\\]\\)'
- repl = 'AC_CONFIG_FILES([\\1:%s/\\2])' % auxdir
- pattern = re.compile(regex, re.M)
- emit = pattern.sub(repl, emit)
+ if replace_auxdir:
+ regex = 'AC_CONFIG_FILES\\(\\[(.*)\\:build-aux/(.*)\\]\\)'
+ repl = 'AC_CONFIG_FILES([\\1:%s/\\2])' % auxdir
+ pattern = re.compile(regex, re.M)
+ emit = pattern.sub(repl, emit)
lines = [ line
for line in emit.split('\n')
if line.strip() ]
emit = '%s\n' % '\n'.join(lines)
- emit = constants.nlconvert(emit)
return emit
- def autoconfSnippets(self, modules, moduletable, fileassistant,
+ def autoconfSnippets(self, modules, moduletable,
verifier, toplevel, disable_libtool, disable_gettext, replace_auxdir):
- '''GLEmiter.autoconfSnippets(modules, fileassistant,
- verifier, toplevel, disable_libtool, disable_gettext,
- replace_auxdir) -> str
+ '''GLEmiter.autoconfSnippets(modules,
+ verifier, toplevel, disable_libtool, disable_gettext, replace_auxdir) -> str
Collect and emit the autoconf snippets of a set of modules.
GLConfig: conddeps.
@@ -209,8 +191,6 @@ class GLEmiter(object):
be a GLModule instance.
moduletable is a GLModuleTable instance, which contains necessary
information about dependencies of the modules.
- fileassistant is a GLFileAssistant instance, which is used to get temporary
- directories and sed transformers.
verifier is an integer, which can be 0, 1 or 2.
if verifier == 0, then process every module;
if verifier == 1, then process only non-tests modules;
@@ -229,9 +209,6 @@ class GLEmiter(object):
if type(moduletable) is not GLModuleTable:
raise TypeError('moduletable must be a GLFileAssistant, not %s'
% type(moduletable).__name__)
- if type(fileassistant) is not GLFileAssistant:
- raise TypeError('fileassistant must be a GLFileAssistant, not %s'
- % type(fileassistant).__name__)
if type(verifier) is not int:
raise TypeError('verifier must be an int, not %s'
% type(verifier).__name__)
@@ -262,7 +239,7 @@ class GLEmiter(object):
elif verifier == 2:
solution = module.isTests()
if solution:
- emit += self.autoconfSnippet(module, fileassistant, toplevel,
+ emit += self.autoconfSnippet(module, toplevel,
disable_libtool, disable_gettext, replace_auxdir, ' ')
else: # if conddeps
# Emit the autoconf code for the unconditional modules.
@@ -275,7 +252,7 @@ class GLEmiter(object):
solution = module.isTests()
if solution:
if not moduletable.isConditional(module):
- emit += self.autoconfSnippet(module, fileassistant, toplevel,
+ emit += self.autoconfSnippet(module, toplevel,
disable_libtool, disable_gettext, replace_auxdir, ' ')
# Initialize the shell variables indicating that the modules are enabled.
for module in modules:
@@ -306,7 +283,7 @@ class GLEmiter(object):
emit += ' %s ()\n' % shellfunc
emit += ' {\n'
emit += ' if ! $%s; then\n' % shellvar
- emit += self.autoconfSnippet(module, fileassistant, toplevel,
+ emit += self.autoconfSnippet(module, toplevel,
disable_libtool, disable_gettext, replace_auxdir, ' ')
emit += ' %s=true\n' % shellvar
depmodules = module.getDependenciesWithoutConditions()
diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index 0197e0671d..114605dd8a 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -636,7 +636,7 @@ AC_DEFUN([%s_INIT],
emit += ' m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [%s])\n' % witness_c_macro
# Emit main autoconf snippets.
emit += self.emiter.autoconfSnippets(moduletable['main'],
- moduletable, assistant, 0, True, False, True, replace_auxdir)
+ moduletable, 0, True, False, True, replace_auxdir)
if witness_c_macro:
emit += ' m4_popdef([gl_MODULE_INDICATOR_CONDITION])\n'
emit += ' # End of code from modules\n'
@@ -659,7 +659,7 @@ AC_DEFUN([%s_INIT],
emit += '[$gl_module_indicator_condition])\n'
# Emit tests autoconf snippets.
emit += self.emiter.autoconfSnippets(moduletable['tests'],
- moduletable, assistant, 0, True, True, True, replace_auxdir)
+ moduletable, 0, True, True, True, replace_auxdir)
emit += ' m4_popdef([gl_MODULE_INDICATOR_CONDITION])\n'
emit += self.emiter.initmacro_end('%stests' % macro_prefix)
# _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py
index 746b815b49..3c4ad0b9dc 100644
--- a/pygnulib/GLTestDir.py
+++ b/pygnulib/GLTestDir.py
@@ -496,11 +496,11 @@ class GLTestDir(object):
# those of the tests.
emit += "gl_source_base='../%s'\n" % sourcebase
emit += self.emiter.autoconfSnippets(modules,
- moduletable, self.assistant, 1, False, False, False,
+ moduletable, 1, False, False, False,
replace_auxdir)
emit += "gl_source_base='.'"
emit += self.emiter.autoconfSnippets(modules,
- moduletable, self.assistant, 2, False, False, False,
+ moduletable, 2, False, False, False,
replace_auxdir)
emit += self.emiter.initmacro_end(macro_prefix)
# _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
@@ -614,10 +614,10 @@ class GLTestDir(object):
emit += 'gl_source_base=\'%s\'\n' % sourcebase
if single_configure:
emit += self.emiter.autoconfSnippets(main_modules, moduletable,
- self.assistant, 0, False, False, False, replace_auxdir)
+ 0, False, False, False, replace_auxdir)
else: # if not single_configure
emit += self.emiter.autoconfSnippets(modules, moduletable,
- self.assistant, 1, False, False, False, replace_auxdir)
+ 1, False, False, False, replace_auxdir)
emit += self.emiter.initmacro_end(macro_prefix)
if single_configure:
emit += ' gltests_libdeps=\n'
@@ -631,7 +631,7 @@ class GLTestDir(object):
emit += ' m4_pushdef([gl_MODULE_INDICATOR_CONDITION], '
emit += '[$gl_module_indicator_condition])\n'
snippets = self.emiter.autoconfSnippets(tests_modules, moduletable,
- self.assistant, 1, True, False, False, replace_auxdir)
+ 1, True, False, False, replace_auxdir)
emit += snippets.strip()
emit += ' m4_popdef([gl_MODULE_INDICATOR_CONDITION])\n'
emit += self.emiter.initmacro_end('%stests' % macro_prefix)