From bc3d94bb2df6fa0c766f6226814c2fc2a55ee049 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 9 Aug 2022 23:59:40 +0200 Subject: 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. --- pygnulib/GLEmiter.py | 51 ++++++++++++++------------------------------------- 1 file changed, 14 insertions(+), 37 deletions(-) (limited to 'pygnulib/GLEmiter.py') 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() -- cgit v1.2.1