# 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.
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__)
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
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')
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.
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;
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__)
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.
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:
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()
# 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
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'
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)