>From 2a33db96531933f00405522d94ebc658236f0b84 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 4 Aug 2022 18:26:08 +0200 Subject: [PATCH 5/9] gnulib-tool.py: Use mainstream/GNU coding style. * gnulib-tool.py: Break lines before the % operator, not after. * pygnulib/*.py: Likewise. Avoid line breaks when the resulting lines are not too long. --- ChangeLog | 5 ++ gnulib-tool.py | 6 +- pygnulib/GLConfig.py | 156 ++++++++++++++++++------------------ pygnulib/GLEmiter.py | 155 +++++++++++++++++------------------ pygnulib/GLFileSystem.py | 41 +++++----- pygnulib/GLImport.py | 53 +++++------- pygnulib/GLMakefileTable.py | 8 +- pygnulib/GLModuleSystem.py | 59 +++++++------- pygnulib/GLTestDir.py | 31 +++---- pygnulib/constants.py | 8 +- 10 files changed, 247 insertions(+), 275 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8cb3660c3d..e54a572c09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2022-08-04 Bruno Haible + gnulib-tool.py: Use mainstream/GNU coding style. + * gnulib-tool.py: Break lines before the % operator, not after. + * pygnulib/*.py: Likewise. Avoid line breaks when the resulting lines + are not too long. + gnulib-tool.py: Follow gnulib-tool changes, part 24. Follow gnulib-tool change 2017-02-19 Bruno Haible diff --git a/gnulib-tool.py b/gnulib-tool.py index 55e94fb25a..4f5494655d 100755 --- a/gnulib-tool.py +++ b/gnulib-tool.py @@ -387,9 +387,9 @@ def main(): print(info.usage()) sys.exit(0) if cmdargs.version != None: - message = '''gnulib-tool (%s %s)%s\n%s\n%s\n\nWritten by %s.''' % \ - (info.package(), info.date(), info.version(), info.copyright(), - info.license(), info.authors()) + message = '''gnulib-tool (%s %s)%s\n%s\n%s\n\nWritten by %s.''' \ + % (info.package(), info.date(), info.version(), info.copyright(), + info.license(), info.authors()) print(message) sys.exit(0) diff --git a/pygnulib/GLConfig.py b/pygnulib/GLConfig.py index 30ca391b0d..a9c2319e2c 100644 --- a/pygnulib/GLConfig.py +++ b/pygnulib/GLConfig.py @@ -147,8 +147,8 @@ class GLConfig(object): else: # if libtool self.enableLibtool() else: # if type(libtool) is not bool - raise TypeError('libtool must be a bool, not %s' % - type(libtool).__name__) + raise TypeError('libtool must be a bool, not %s' + % type(libtool).__name__) # conddeps self.resetCondDeps() if conddeps != None: @@ -158,8 +158,8 @@ class GLConfig(object): else: # if conddeps self.enableCondDeps() else: # if type(conddeps) is not bool - raise TypeError('conddeps must be a bool, not %s' % - type(conddeps).__name__) + raise TypeError('conddeps must be a bool, not %s' + % type(conddeps).__name__) # macro_prefix self.resetMacroPrefix() if macro_prefix != None: @@ -177,8 +177,8 @@ class GLConfig(object): else: # if witness_c_macro self.resetWitnessCMacro() else: # if type(witness_c_macro) is not bool - raise TypeError('witness_c_macro must be a bool, not %s' % - type(witness_c_macro).__name__) + raise TypeError('witness_c_macro must be a bool, not %s' + % type(witness_c_macro).__name__) # vc_files self.resetVCFiles() if vc_files != None: @@ -188,8 +188,8 @@ class GLConfig(object): else: # if vc_files self.enableVCFiles() else: # if type(vc_files) is not bool - raise TypeError('vc_files must be a bool, not %s' % - type(vc_files).__name__) + raise TypeError('vc_files must be a bool, not %s' + % type(vc_files).__name__) # symbolic self.resetSymbolic() if symbolic != None: @@ -199,8 +199,8 @@ class GLConfig(object): else: # if symbolic self.enableSymbolic() else: # if type(symbolic) is not bool - raise TypeError('symbolic must be a bool, not %s' % - type(symbolic).__name__) + raise TypeError('symbolic must be a bool, not %s' + % type(symbolic).__name__) # lsymbolic self.resetLSymbolic() if lsymbolic != None: @@ -210,8 +210,8 @@ class GLConfig(object): else: # if lsymbolic self.enableLSymbolic() else: # if type(lsymbolic) is not bool - raise TypeError('lsymbolic must be a bool, not %s' % - type(lsymbolic).__name__) + raise TypeError('lsymbolic must be a bool, not %s' + % type(lsymbolic).__name__) # modcache self.resetModuleCaching() if modcache != None: @@ -221,8 +221,8 @@ class GLConfig(object): else: # if modcache self.enableModuleCaching() else: # if type(modcache) is not bool - raise TypeError('modcache must be a bool, not %s' % - type(modcache).__name__) + raise TypeError('modcache must be a bool, not %s' + % type(modcache).__name__) # configure_ac self.resetAutoconfFile() if configure_ac != None: @@ -240,8 +240,8 @@ class GLConfig(object): else: # if libtests self.enableLibtests() else: # if type(libtests) is not bool - raise TypeError('libtests must be a bool, not %s' % - type(libtests).__name__) + raise TypeError('libtests must be a bool, not %s' + % type(libtests).__name__) # single_configure self.resetSingleConfigure() if single_configure != None: @@ -251,8 +251,8 @@ class GLConfig(object): else: # if single_configure self.enableSingleConfigure() else: # if type(single_configure) is not bool - raise TypeError('single_configure must be a bool, not %s' % - type(single_configure).__name__) + raise TypeError('single_configure must be a bool, not %s' + % type(single_configure).__name__) # verbose self.resetVerbosity() if verbose != None: @@ -266,8 +266,8 @@ class GLConfig(object): else: # if dryrun self.enableDryRun() else: # if type(dryrun) is not bool - raise TypeError('dryrun must be a bool, not %s' % - type(dryrun).__name__) + raise TypeError('dryrun must be a bool, not %s' + % type(dryrun).__name__) # errors self.resetErrors() if errors != None: @@ -277,8 +277,8 @@ class GLConfig(object): else: # if errors self.enableErrors() else: # if type(errors) is not bool - raise TypeError('errors must be a bool, not %s' % - type(errors).__name__) + raise TypeError('errors must be a bool, not %s' + % type(errors).__name__) # Define special methods. def __repr__(self): @@ -311,8 +311,8 @@ class GLConfig(object): def update(self, dictionary): '''Specify the dictionary whose keys will be used to update config.''' if type(dictionary) is not GLConfig: - raise TypeError('dictionary must be a GLConfig, not %s' % - type(dictionary).__name__) + raise TypeError('dictionary must be a GLConfig, not %s' + % type(dictionary).__name__) dictionary = dict(dictionary.table) result = dict() for key in dictionary: @@ -334,8 +334,8 @@ class GLConfig(object): '''Update the given key using value from the given dictionary.''' if key in self.table: if type(dictionary) is not GLConfig: - raise TypeError('dictionary must be a GLConfig, not %s' % - type(dictionary).__name__) + raise TypeError('dictionary must be a GLConfig, not %s' + % type(dictionary).__name__) dictionary = dict(dictionary.table) self.table[key] = dictionary[key] else: # if key not in self.table @@ -399,8 +399,8 @@ class GLConfig(object): if destdir: self.table['destdir'] = os.path.normpath(destdir) else: # if destdir has not str type - raise TypeError('destdir must be a string, not %s' % - type(destdir).__name__) + raise TypeError('destdir must be a string, not %s' + % type(destdir).__name__) def resetDestDir(self): '''Reset the target directory. For --import, this specifies where your @@ -446,8 +446,8 @@ class GLConfig(object): if auxdir: self.table['auxdir'] = remove_trailing_slashes(auxdir) else: # if type of auxdir is not str - raise TypeError('auxdir must be a string, not %s' % - type(auxdir).__name__) + raise TypeError('auxdir must be a string, not %s' + % type(auxdir).__name__) def resetAuxDir(self): '''Reset directory relative to --dir where auxiliary build tools are @@ -465,8 +465,8 @@ class GLConfig(object): if sourcebase: self.table['sourcebase'] = remove_trailing_slashes(sourcebase) else: # if type of sourcebase is not str - raise TypeError('sourcebase must be a string, not %s' % - type(sourcebase).__name__) + raise TypeError('sourcebase must be a string, not %s' + % type(sourcebase).__name__) def resetSourceBase(self): '''Return directory relative to destdir where source code is placed.''' @@ -483,8 +483,8 @@ class GLConfig(object): if m4base: self.table['m4base'] = remove_trailing_slashes(m4base) else: # if type of m4base is not str - raise TypeError('m4base must be a string, not %s' % - type(m4base).__name__) + raise TypeError('m4base must be a string, not %s' + % type(m4base).__name__) def resetM4Base(self): '''Reset directory relative to destdir where *.m4 macros are placed.''' @@ -501,8 +501,8 @@ class GLConfig(object): if pobase: self.table['pobase'] = remove_trailing_slashes(pobase) else: # if type of pobase is not str - raise TypeError('pobase must be a string, not %s' % - type(pobase).__name__) + raise TypeError('pobase must be a string, not %s' + % type(pobase).__name__) def resetPoBase(self): '''Reset directory relative to destdir where *.po files are placed.''' @@ -521,8 +521,8 @@ class GLConfig(object): if docbase: self.table['docbase'] = remove_trailing_slashes(docbase) else: # if type of docbase is not str - raise TypeError('docbase must be a string, not %s' % - type(docbase).__name__) + raise TypeError('docbase must be a string, not %s' + % type(docbase).__name__) def resetDocBase(self): '''Reset directory relative to destdir where doc files are placed. @@ -542,8 +542,8 @@ class GLConfig(object): if testsbase: self.table['testsbase'] = remove_trailing_slashes(testsbase) else: # if type of testsbase is not str - raise TypeError('testsbase must be a string, not %s' % - type(testsbase).__name__) + raise TypeError('testsbase must be a string, not %s' + % type(testsbase).__name__) def resetTestsBase(self): '''Reset directory relative to destdir where unit tests are placed. @@ -557,8 +557,8 @@ class GLConfig(object): if module not in self.table['modules']: self.table['modules'] += [module] else: # if module has not str type - raise TypeError('module must be a string, not %s' % - type(module).__name__) + raise TypeError('module must be a string, not %s' + % type(module).__name__) def removeModule(self, module): '''Remove the module from the modules list.''' @@ -566,8 +566,8 @@ class GLConfig(object): if module in self.table['modules']: self.table['modules'].remove(module) else: # if module has not str type - raise TypeError('module must be a string, not %s' % - type(module).__name__) + raise TypeError('module must be a string, not %s' + % type(module).__name__) def getModules(self): '''Return the modules list.''' @@ -588,8 +588,8 @@ class GLConfig(object): self.table['modules'] = old_modules raise else: # if type of modules is not list or tuple - raise TypeError('modules must be a list or a tuple, not %s' % - type(modules).__name__) + raise TypeError('modules must be a list or a tuple, not %s' + % type(modules).__name__) def resetModules(self): '''Reset the list of the modules.''' @@ -603,8 +603,8 @@ class GLConfig(object): if module not in self.table['avoids']: self.table['avoids'].append(module) else: # if module has not str type - raise TypeError('avoid must be a string, not %s' % - type(module).__name__) + raise TypeError('avoid must be a string, not %s' + % type(module).__name__) def removeAvoid(self, module): '''Remove the given module from the list of avoided modules.''' @@ -612,8 +612,8 @@ class GLConfig(object): if module in self.table['avoids']: self.table['avoids'].remove(module) else: # if module has not str type - raise TypeError('avoid must be a string, not %s' % - type(module).__name__) + raise TypeError('avoid must be a string, not %s' + % type(module).__name__) def getAvoids(self): '''Return the list of the avoided modules.''' @@ -634,8 +634,8 @@ class GLConfig(object): self.table['avoids'] = old_avoids raise else: # if type of modules is not list or tuple - raise TypeError('modules must be a list or a tuple, not %s' % - type(modules).__name__) + raise TypeError('modules must be a list or a tuple, not %s' + % type(modules).__name__) def resetAvoids(self): '''Reset the list of the avoided modules.''' @@ -648,8 +648,8 @@ class GLConfig(object): if file not in self.table['files']: self.table['files'].append(file) else: # if file has not str type - raise TypeError('file must be a string, not %s' % - type(file).__name__) + raise TypeError('file must be a string, not %s' + % type(file).__name__) def removeFile(self, file): '''Remove the given file from the list of files.''' @@ -657,8 +657,8 @@ class GLConfig(object): if file in self.table['files']: self.table['files'].remove(file) else: # if file has not str type - raise TypeError('file must be a string, not %s' % - type(file).__name__) + raise TypeError('file must be a string, not %s' + % type(file).__name__) def getFiles(self): '''Return the list of the fileed files.''' @@ -679,8 +679,8 @@ class GLConfig(object): self.table['files'] = old_files raise else: # if type of files is not list or tuple - raise TypeError('files must be a list or a tuple, not %s' % - type(files).__name__) + raise TypeError('files must be a list or a tuple, not %s' + % type(files).__name__) def resetFiles(self): '''Reset the list of files.''' @@ -734,8 +734,8 @@ class GLConfig(object): self.table['incl_test_categories'] = old_categories raise TypeError('each category must be one of TESTS integers') else: # if type of categories is not list or tuple - raise TypeError('categories must be a list or a tuple, not %s' % - type(categories).__name__) + raise TypeError('categories must be a list or a tuple, not %s' + % type(categories).__name__) def resetInclTestCategories(self): '''Reset test categories.''' @@ -782,8 +782,8 @@ class GLConfig(object): self.table['excl_test_categories'] = old_categories raise TypeError('each category must be one of TESTS integers') else: # if type of categories is not list or tuple - raise TypeError('categories must be a list or a tuple, not %s' % - type(categories).__name__) + raise TypeError('categories must be a list or a tuple, not %s' + % type(categories).__name__) def resetExclTestCategories(self): '''Reset test categories.''' @@ -800,8 +800,8 @@ class GLConfig(object): if libname: self.table['libname'] = libname else: # if type of libname is not str - raise TypeError('libname must be a string, not %s' % - type(module).__name__) + raise TypeError('libname must be a string, not %s' + % type(module).__name__) def resetLibName(self): '''Reset the library name to 'libgnu'.''' @@ -881,8 +881,8 @@ class GLConfig(object): if macro_prefix: self.table['macro_prefix'] = macro_prefix else: # if type of macro_prefix is not str - raise TypeError('macro_prefix must be a string, not %s' % - type(macro_prefix).__name__) + raise TypeError('macro_prefix must be a string, not %s' + % type(macro_prefix).__name__) if macro_prefix == 'gl': include_guard_prefix = 'GL' else: # macro_prefix != 'gl' @@ -909,8 +909,8 @@ class GLConfig(object): 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__) + raise TypeError('makefile must be a string, not %s' + % type(makefile).__name__) def resetMakefile(self): '''Reset the name of makefile in automake syntax in the source-base and @@ -930,8 +930,8 @@ class GLConfig(object): if podomain: self.table['podomain'] = podomain else: # if type of podomain is not str - raise TypeError('podomain must be a string, not %s' % - type(podomain).__name__) + raise TypeError('podomain must be a string, not %s' + % type(podomain).__name__) def resetPoDomain(self): '''Reset the prefix of the i18n domain. Usually use the package name. @@ -951,8 +951,8 @@ class GLConfig(object): if witness_c_macro: self.table['witness_c_macro'] = witness_c_macro else: # if type of witness_c_macro is not str - raise TypeError('witness_c_macro must be a string, not %s' % - type(witness_c_macro).__name__) + raise TypeError('witness_c_macro must be a string, not %s' + % type(witness_c_macro).__name__) def resetWitnessCMacro(self): '''Return the C macro that is defined when the sources in this directory @@ -1005,8 +1005,8 @@ class GLConfig(object): self.table['configure_ac'] = \ relpath(self.table['destdir'], configure_ac) else: # if type of configure_ac is not str - raise TypeError('configure_ac must be a string, not %s' % - type(configure_ac).__name__) + raise TypeError('configure_ac must be a string, not %s' + % type(configure_ac).__name__) def resetAutoconfFile(self): '''Reset path of autoconf file relative to destdir.''' @@ -1027,8 +1027,8 @@ class GLConfig(object): if type(ac_version) is float or type(ac_version) is int: self.table['ac_version'] = float(ac_version) else: # if ac_version has not int or float type - raise TypeError('ac_version must be an int or a float, not %s' % - type(ac_version).__name__) + raise TypeError('ac_version must be an int or a float, not %s' + % type(ac_version).__name__) def resetAutoconfVersion(self): '''Specify preferred autoconf version. Default value is 2.59.''' @@ -1106,8 +1106,8 @@ class GLConfig(object): elif verbose > MODES['verbose-max']: self.table['verbosity'] = MODES['verbose-max'] else: # if type(verbose) is not int - raise TypeError('verbosity must be an int, not %s' % - type(verbose).__name__) + raise TypeError('verbosity must be an int, not %s' + % type(verbose).__name__) def resetVerbosity(self): '''Reset verbosity level.''' diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py index a5a13e63fb..223e1ee553 100644 --- a/pygnulib/GLEmiter.py +++ b/pygnulib/GLEmiter.py @@ -63,8 +63,8 @@ class GLEmiter(object): Create GLEmiter instance.''' self.info = GLInfo() if type(config) is not GLConfig: - raise TypeError('config must be a GLConfig, not %s' % - type(config).__name__) + raise TypeError('config must be a GLConfig, not %s' + % type(config).__name__) self.config = config def __repr__(self): @@ -122,23 +122,23 @@ class GLEmiter(object): 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__) + 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__) + 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__) + raise TypeError('toplevel must be a bool, not %s' + % type(toplevel).__name__) if type(disable_libtool) is not bool: - raise TypeError('disable_libtool must be a bool, not %s' % - type(disable_libtool).__name__) + raise TypeError('disable_libtool must be a bool, not %s' + % type(disable_libtool).__name__) if type(disable_gettext) is not bool: - raise TypeError('disable_gettext must be a bool, not %s' % - type(disable_gettext).__name__) + raise TypeError('disable_gettext must be a bool, not %s' + % type(disable_gettext).__name__) if type(indentation) is not str: - raise TypeError('indentation must be a string, not %s' % - type(indentation).__name__) + raise TypeError('indentation must be a string, not %s' + % type(indentation).__name__) if not indentation.isspace(): raise ValueError('indentation must contain only whitespaces') auxdir = self.config['auxdir'] @@ -229,28 +229,28 @@ add AM_GNU_GETTEXT([external]) or similar to configure.ac.') if type(module) is not GLModule: raise TypeError('each module must be a GLModule instance') if type(moduletable) is not GLModuleTable: - raise TypeError('moduletable must be a GLFileAssistant, not %s' % - type(moduletable).__name__) + 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__) + 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__) + raise TypeError('verifier must be an int, not %s' + % type(verifier).__name__) if not (0 <= verifier <= 2): raise ValueError('verifier must be 0, 1 or 2, not %d' % verifier) if type(toplevel) is not bool: - raise TypeError('toplevel must be a bool, not %s' % - type(toplevel).__name__) + raise TypeError('toplevel must be a bool, not %s' + % type(toplevel).__name__) if type(disable_libtool) is not bool: - raise TypeError('disable_libtool must be a bool, not %s' % - type(disable_libtool).__name__) + raise TypeError('disable_libtool must be a bool, not %s' + % type(disable_libtool).__name__) if type(disable_gettext) is not bool: - raise TypeError('disable_gettext must be a bool, not %s' % - type(disable_gettext).__name__) + raise TypeError('disable_gettext must be a bool, not %s' + % type(disable_gettext).__name__) if type(replace_auxdir) is not bool: - raise TypeError('replace_auxdir must be a bool, not %s' % - type(replace_auxdir).__name__) + raise TypeError('replace_auxdir must be a bool, not %s' + % type(replace_auxdir).__name__) auxdir = self.config['auxdir'] conddeps = self.config['conddeps'] macro_prefix = self.config['macro_prefix'] @@ -463,8 +463,8 @@ USE_MSGCTXT = no\n""" Emit the first few statements of the gl_INIT macro.''' emit = '' if type(macro_prefix_arg) is not str: - raise TypeError('macro_prefix_arg must be a string, not %s' % - type(macro_prefix_arg).__name__) + raise TypeError('macro_prefix_arg must be a string, not %s' + % type(macro_prefix_arg).__name__) module_indicator_prefix = self.config.getModuleIndicatorPrefix() # Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing # platform-dependent object files in ${macro_prefix_arg}_LIBOBJS instead @@ -510,8 +510,8 @@ USE_MSGCTXT = no\n""" Emit the last few statements of the gl_INIT macro.''' emit = '' if type(macro_prefix_arg) is not str: - raise TypeError('macro_prefix_arg must be a string, not %s' % - type(macro_prefix_arg).__name__) + raise TypeError('macro_prefix_arg must be a string, not %s' + % type(macro_prefix_arg).__name__) # Check the presence of files that are mentioned as AC_LIBSOURCES # arguments. The check is performed only when autoconf is run from the # directory where the configure.ac resides; if it is run from a different @@ -561,11 +561,11 @@ found])]) GLConfig: sourcebase.''' emit = '' if type(macro_prefix_arg) is not str: - raise TypeError('macro_prefix_arg must be a string, not %s' % - type(macro_prefix_arg).__name__) + raise TypeError('macro_prefix_arg must be a string, not %s' + % type(macro_prefix_arg).__name__) if type(sourcebase_arg) is not str: - raise TypeError('sourcebase_arg must be a string, not %s' % - type(sourcebase_arg).__name__) + raise TypeError('sourcebase_arg must be a string, not %s' + % type(sourcebase_arg).__name__) emit += """\ # Like AC_LIBOBJ, except that the module name goes @@ -617,23 +617,23 @@ AC_DEFUN([%V1%_LIBSOURCES], [ for_test is a bool variable; it must be set to True if creating a package for testing, False otherwise.''' if type(destfile) is not str: - raise TypeError('destfile must be a string, not %s' % - type(destfile).__name__) + raise TypeError('destfile must be a string, not %s' + % type(destfile).__name__) for module in modules: if type(module) is not GLModule: raise TypeError('each module must be a GLModule instance') if type(moduletable) is not GLModuleTable: - raise TypeError('moduletable must be a GLModuleTable, not %s' % - type(moduletable).__name__) + raise TypeError('moduletable must be a GLModuleTable, not %s' + % type(moduletable).__name__) if type(makefiletable) is not GLMakefileTable: - raise TypeError('makefiletable must be a GLMakefileTable, not %s' % - type(makefiletable).__name__) + raise TypeError('makefiletable must be a GLMakefileTable, not %s' + % type(makefiletable).__name__) if type(actioncmd) is not str: - raise TypeError('actioncmd must be a string, not %s' % - type(actioncmd).__name__) + raise TypeError('actioncmd must be a string, not %s' + % type(actioncmd).__name__) if type(for_test) is not bool: - raise TypeError('for_test must be a bool, not %s' % - type(for_test).__name__) + raise TypeError('for_test must be a bool, not %s' + % type(for_test).__name__) emit = '' sourcebase = self.config['sourcebase'] modcache = self.config['modcache'] @@ -697,8 +697,8 @@ AC_DEFUN([%V1%_LIBSOURCES], [ 'lib_LDFLAGS[\t ]*\\+=(.*?)$', re.S | re.M) amsnippet1 = pattern.sub('', amsnippet1) pattern = compiler('lib_([A-Z][A-Z](?:.*?))', re.S | re.M) - amsnippet1 = pattern.sub('%s_%s_\\1' % - (libname, libext), amsnippet1) + amsnippet1 = pattern.sub('%s_%s_\\1' % (libname, libext), + amsnippet1) amsnippet1 = amsnippet1.replace( '$(GNULIB_', '$(' + module_indicator_prefix + '_GNULIB_') amsnippet1 = amsnippet1.replace( @@ -711,10 +711,8 @@ AC_DEFUN([%V1%_LIBSOURCES], [ amsnippet1 = amsnippet1.replace('${gl_include_guard_prefix}', include_guard_prefix) if str(module) == 'alloca': - amsnippet1 += '%s_%s_LIBADD += @%sALLOCA@\n' % \ - (libname, libext, perhapsLT) - amsnippet1 += '%s_%s_DEPENDENCIES += @%sALLOCA@\n' % \ - (libname, libext, perhapsLT) + 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) @@ -722,8 +720,8 @@ AC_DEFUN([%V1%_LIBSOURCES], [ # Get unconditional snippet, edit it and save to amsnippet2. amsnippet2 = module.getAutomakeSnippet_Unconditional() pattern = compiler('lib_([A-Z][A-Z](?:.*?))', re.S | re.M) - amsnippet2 = pattern.sub('%s_%s_\\1' % - (libname, libext), amsnippet2) + amsnippet2 = pattern.sub('%s_%s_\\1' % (libname, libext), + amsnippet2) amsnippet2 = amsnippet2.replace( '$(GNULIB_', '$(' + module_indicator_prefix + '_GNULIB_') if not (amsnippet1 + amsnippet2).isspace(): @@ -785,8 +783,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [ if dictionary['var']: paths = list() paths += [joinpath(dictionary['dir'], 'Makefile.am')] - paths += [os.path.normpath('./%s/Makefile.am' % - dictionary['dir'])] + paths += [os.path.normpath('./%s/Makefile.am' % dictionary['dir'])] paths = sorted(set(paths)) if destfile in paths: emit += '%s += %s\n' % (dictionary['var'], @@ -816,8 +813,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [ # First test if allsnippets already specify an installation location. insnippets = False inmakefile = False - regex = '^[a-zA-Z0-9_]*_%sLIBRARIES *\\+{0,1}= *%s.%s' % \ - (perhapsLT, libname, libext) + regex = '^[a-zA-Z0-9_]*_%sLIBRARIES *\\+{0,1}= *%s.%s' % (perhapsLT, libname, libext) pattern = compiler(regex, re.S | re.M) insnippets = bool(pattern.findall(allsnippets)) # Then test if $sourcebase/Makefile.am (if it exists) specifies it. @@ -828,17 +824,14 @@ AC_DEFUN([%V1%_LIBSOURCES], [ inmakefile = bool(pattern.findall(data)) if not any([insnippets, inmakefile]): # By default, the generated library should not be installed. - emit += 'noinst_%sLIBRARIES += %s.%s\n' % ( - perhapsLT, libname, libext) + emit += 'noinst_%sLIBRARIES += %s.%s\n' % (perhapsLT, libname, libext) emit += '\n' emit += '%s_%s_SOURCES =\n' % (libname, libext) # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However, # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@. - emit += '%s_%s_LIBADD = $(%s_%sLIBOBJS)\n' % \ - (libname, libext, macro_prefix, perhapsLT) - emit += '%s_%s_DEPENDENCIES = $(%s_%sLIBOBJS)\n' % \ - (libname, libext, macro_prefix, perhapsLT) + emit += '%s_%s_LIBADD = $(%s_%sLIBOBJS)\n' % (libname, libext, macro_prefix, perhapsLT) + emit += '%s_%s_DEPENDENCIES = $(%s_%sLIBOBJS)\n' % (libname, libext, macro_prefix, perhapsLT) emit += 'EXTRA_%s_%s_SOURCES =\n' % (libname, libext) if libtool: emit += '%s_%s_LDFLAGS = $(AM_LDFLAGS)\n' % (libname, libext) @@ -898,20 +891,20 @@ AC_DEFUN([%V1%_LIBSOURCES], [ for_test is a bool variable; it must be set to True if creating a package for testing, False otherwise.''' if type(destfile) is not str: - raise TypeError('destfile must be a string, not %s' % - type(destfile).__name__) + raise TypeError('destfile must be a string, not %s' + % type(destfile).__name__) for module in modules: if type(module) is not GLModule: raise TypeError('each module must be a GLModule instance') if type(makefiletable) is not GLMakefileTable: - raise TypeError('makefiletable must be a GLMakefileTable, not %s' % - type(makefiletable).__name__) + raise TypeError('makefiletable must be a GLMakefileTable, not %s' + % type(makefiletable).__name__) if type(witness_macro) is not str: - raise TypeError('witness_macro must be a string, not %s' % - type(witness_macro).__name__) + raise TypeError('witness_macro must be a string, not %s' + % type(witness_macro).__name__) if type(for_test) is not bool: - raise TypeError('for_test must be a bool, not %s' % - type(for_test).__name__) + raise TypeError('for_test must be a bool, not %s' + % type(for_test).__name__) emit = '' auxdir = self.config['auxdir'] sourcebase = self.config['sourcebase'] @@ -1087,8 +1080,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [ if dictionary['var']: paths = list() paths += [joinpath(dictionary['dir'], 'Makefile.am')] - paths += [os.path.normpath('./%s/Makefile.am' % - dictionary['dir'])] + paths += [os.path.normpath('./%s/Makefile.am' % dictionary['dir'])] paths = sorted(set(paths)) if destfile in paths: emit += '%s += %s\n' % (dictionary['var'], @@ -1103,10 +1095,8 @@ AC_DEFUN([%V1%_LIBSOURCES], [ if witness_macro: emit += ' -D@%s@=1 \\\n' % witness_macro emit += ' -I. -I$(srcdir) \\\n' - emit += ' -I%s -I$(srcdir)/%s \\\n' % \ - (testsbase_inverse, testsbase_inverse) - emit += ' -I%s/%s -I$(srcdir)/%s/%s\n' % \ - (testsbase_inverse, sourcebase, testsbase_inverse, sourcebase) + emit += ' -I%s -I$(srcdir)/%s \\\n' % (testsbase_inverse, testsbase_inverse) + emit += ' -I%s/%s -I$(srcdir)/%s/%s\n' % (testsbase_inverse, sourcebase, testsbase_inverse, sourcebase) emit += '\n' if libtests: @@ -1119,12 +1109,11 @@ AC_DEFUN([%V1%_LIBSOURCES], [ # voluntarily omitted). # The LIBTESTS_LIBDEPS can be passed to the linker once or twice, it # does not matter. - emit += 'LDADD = libtests.a %s/%s/%s.%s libtests.a %s/%s/%s.%s libtests.a $(LIBTESTS_LIBDEPS)\n\n' % \ - (testsbase_inverse, sourcebase, libname, libext, - testsbase_inverse, sourcebase, libname, libext) + emit += 'LDADD = libtests.a %s/%s/%s.%s libtests.a %s/%s/%s.%s libtests.a $(LIBTESTS_LIBDEPS)\n\n' \ + % (testsbase_inverse, sourcebase, libname, libext, + testsbase_inverse, sourcebase, libname, libext) else: - emit += 'LDADD = %s/%s/%s.%s\n\n' % \ - (testsbase_inverse, sourcebase, libname, libext) + emit += 'LDADD = %s/%s/%s.%s\n\n' % (testsbase_inverse, sourcebase, libname, libext) if libtests: emit += 'libtests_a_SOURCES =\n' # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However, diff --git a/pygnulib/GLFileSystem.py b/pygnulib/GLFileSystem.py index 1f7a9f2343..a1d1520f7c 100644 --- a/pygnulib/GLFileSystem.py +++ b/pygnulib/GLFileSystem.py @@ -69,8 +69,8 @@ class GLFileSystem(object): '''Create new GLFileSystem instance. The only argument is localpath, which can be an empty list.''' if type(config) is not GLConfig: - raise TypeError('config must be a GLConfig, not %s' % - type(config).__name__) + raise TypeError('config must be a GLConfig, not %s' + % type(config).__name__) self.config = config def __repr__(self): @@ -87,8 +87,8 @@ class GLFileSystem(object): indicates whether file is a temporary file. GLConfig: localpath.''' if type(name) is not str: - raise TypeError( - 'name must be a string, not %s' % type(module).__name__) + raise TypeError('name must be a string, not %s' + % type(module).__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 @@ -160,19 +160,19 @@ class GLFileAssistant(object): def __init__(self, config, transformers=dict()): '''Create GLFileAssistant instance.''' if type(config) is not GLConfig: - raise TypeError('config must be a GLConfig, not %s' % - type(config).__name__) + raise TypeError('config must be a GLConfig, not %s' + % type(config).__name__) if type(transformers) is not dict: - raise TypeError('transformers must be a dict, not %s' % - type(transformers).__name__) + raise TypeError('transformers must be a dict, not %s' + % type(transformers).__name__) for key in ['lib', 'aux', 'main', 'tests']: if key not in transformers: transformers[key] = 's,x,x,' else: # if key in transformers value = transformers[key] if type(value) is not str: - raise TypeError('transformers[%s] must be a string, not %s' % - (key, type(value).__name__)) + raise TypeError('transformers[%s] must be a string, not %s' + % (key, type(value).__name__)) self.original = None self.rewritten = None self.added = list() @@ -287,11 +287,11 @@ class GLFileAssistant(object): if rewritten == None: raise TypeError('rewritten must be set before applying the method') if type(lookedup) is not str: - raise TypeError('lookedup must be a string, not %s' % - type(lookedup).__name__) + raise TypeError('lookedup must be a string, not %s' + % type(lookedup).__name__) if type(already_present) is not bool: - raise TypeError('already_present must be a bool, not %s' % - type(already_present).__name__) + raise TypeError('already_present must be a bool, not %s' + % type(already_present).__name__) basename = rewritten backupname = '%s~' % basename basepath = joinpath(destdir, basename) @@ -299,8 +299,7 @@ class GLFileAssistant(object): if not filecmp.cmp(basepath, tmpfile): if not self.config['dryrun']: if already_present: - print('Updating file %s (backup in %s)' % - (basename, backupname)) + print('Updating file %s (backup in %s)' % (basename, backupname)) else: # if not already_present message = 'Replacing file ' message += '%s (non-gnulib code backed up in ' % basename @@ -324,11 +323,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, backup)) else: # if not already_present - print('Replace file %s (backup in %s)' % - (rewritten, backup)) + print('Replace file %s (backup in %s)' % (rewritten, backup)) def add_or_update(self, already_present): '''GLFileAssistant.add_or_update(already_present) @@ -341,8 +338,8 @@ class GLFileAssistant(object): elif rewritten == None: raise TypeError('rewritten must be set before applying the method') if type(already_present) is not bool: - raise TypeError('already_present must be a bool, not %s' % - type(already_present).__name__) + raise TypeError('already_present must be a bool, not %s' + % type(already_present).__name__) xoriginal = original if original.startswith('tests=lib/'): xoriginal = constants.substart('tests=lib/', 'lib/', original) diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py index 28bef1d9f3..ea41e91cbd 100644 --- a/pygnulib/GLImport.py +++ b/pygnulib/GLImport.py @@ -76,14 +76,14 @@ class GLImport(object): object, which is accessible from constants module. The second one, config, must be a GLConfig object.''' if type(config) is not GLConfig: - raise TypeError('config must have GLConfig type, not %s' % - repr(config)) + raise TypeError('config must have GLConfig type, not %s' + % repr(config)) if type(mode) is int and \ MODES['import'] <= mode <= MODES['update']: self.mode = mode else: # if mode is not int or is not 0-3 - raise TypeError('mode must be 0 <= mode <= 3, not %s' % - repr(mode)) + raise TypeError('mode must be 0 <= mode <= 3, not %s' + % repr(mode)) # Initialize some values. self.cache = GLConfig() @@ -213,8 +213,7 @@ class GLImport(object): if isfile(path): with codecs.open(path, 'rb', 'UTF-8') as file: data = file.read() - regex = 'AC_DEFUN\\(\\[%s_FILE_LIST\\], \\[(.*?)\\]\\)' % \ - self.cache['macro_prefix'] + regex = 'AC_DEFUN\\(\\[%s_FILE_LIST\\], \\[(.*?)\\]\\)' % self.cache['macro_prefix'] pattern = compiler(regex, re.S | re.M) self.cache.setFiles(pattern.findall(data)[-1].strip().split()) @@ -636,8 +635,7 @@ AC_DEFUN([%s_INIT], emit += self.emiter.initmacro_start(macro_prefix) emit += ' gl_source_base=\'%s\'\n' % sourcebase if witness_c_macro: - emit += ' m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [%s])\n' % \ - witness_c_macro + 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) @@ -732,15 +730,13 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix destdata = '\n'.join(sorted(set(dirs_ignore))).strip() if srcdata != destdata: if not self.config['dryrun']: - print('Updating %s (backup in %s)' % - (srcpath, backupname)) + print('Updating %s (backup in %s)' % (srcpath, backupname)) copyfile2(srcpath, backupname) result = '' with codecs.open(srcpath, 'ab', 'UTF-8') as file: file.write(destdata) else: # if self.config['dryrun'] - print('Updating %s (backup in %s)' % - (srcpath, backupname)) + print('Updating %s (backup in %s)' % (srcpath, backupname)) else: # if not isfile(srcpath) if dirs_added: if not self.config['dryrun']: @@ -989,8 +985,8 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix format except filelist argument. Such lists of files can be created using GLImport.prepare() function.''' if type(filetable) is not dict: - raise TypeError('filetable must be a dict, not %s' % - type(filetable).__name__) + raise TypeError('filetable must be a dict, not %s' + % type(filetable).__name__) for key in ['all', 'old', 'new', 'added', 'removed']: if key not in filetable: raise KeyError('filetable must contain key %s' % repr(key)) @@ -1160,8 +1156,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix basename, tmpfile) if flag == 1: if not self.config['dryrun']: - print('Updating %s (backup in %s)' % - (filename, backup)) + print('Updating %s (backup in %s)' % (filename, backup)) else: # if self.config['dryrun'] print('Update %s (backup in %s)' % (filename, backup)) elif flag == 2: @@ -1408,30 +1403,24 @@ in _a_LDFLAGS or _la_LDFLAGS when linking a library.''') print('') print('Don\'t forget to') if makefile_am == 'Makefile.am': - print(' - add "%s/Makefile" to AC_CONFIG_FILES in %s,' % - (sourcebase, configure_ac)) + 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, sourcebase)) if pobase: - print(' - add "%s/Makefile.in to AC_CONFIG_FILES in %s,' % - (pobase, configure_ac)) + 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)) + 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, testsbase)) # Print makefile edits. current_edit = int() makefile_am_edits = self.makefiletable.count() while current_edit != makefile_am_edits: dictionary = self.makefiletable[current_edit] if dictionary['var']: - print(' - mention "%s" in %s in %s,' % - (dictionary['val'], dictionary['var'], - joinpath(dictionary['dir'], 'Makefile.am'))) + print(' - mention "%s" in %s in %s,' + % (dictionary['val'], dictionary['var'], joinpath(dictionary['dir'], 'Makefile.am'))) current_edit += 1 # Detect position_early_after. @@ -1447,8 +1436,6 @@ in _a_LDFLAGS or _la_LDFLAGS when linking a library.''') position_early_after = 'AC_PROG_CC_C99' else: # if not any([match_result1, match_result2]) position_early_after = 'AC_PROG_CC' - print(' - invoke %s_EARLY in %s, right after %s,' % - (macro_prefix, configure_ac, position_early_after)) - print(' - invoke %s_INIT in %s.' % - (macro_prefix, configure_ac)) + print(' - invoke %s_EARLY in %s, right after %s,' % (macro_prefix, configure_ac, position_early_after)) + print(' - invoke %s_INIT in %s.' % (macro_prefix, configure_ac)) sp.call(['rm', '-rf', self.config['tempdir']], shell=False) diff --git a/pygnulib/GLMakefileTable.py b/pygnulib/GLMakefileTable.py index fdb15ac132..f3a8b9cccf 100644 --- a/pygnulib/GLMakefileTable.py +++ b/pygnulib/GLMakefileTable.py @@ -55,16 +55,16 @@ class GLMakefileTable(object): Create GLMakefileTable instance.''' if type(config) is not GLConfig: - raise TypeError('config must be a GLConfig, not %s' % - type(config).__name__) + raise TypeError('config must be a GLConfig, not %s' + % type(config).__name__) self.config = config self.table = list() def __getitem__(self, y): '''x.__getitem__(y) = x[y]''' if type(y) is not int: - raise TypeError('indices must be integers, not %s' % - type(y).__name__) + raise TypeError('indices must be integers, not %s' + % type(y).__name__) result = self.table[y] return dict(result) diff --git a/pygnulib/GLModuleSystem.py b/pygnulib/GLModuleSystem.py index 13352ffb5c..9c8e2eb266 100644 --- a/pygnulib/GLModuleSystem.py +++ b/pygnulib/GLModuleSystem.py @@ -64,8 +64,8 @@ class GLModuleSystem(object): 'patch' utility.''' self.args = dict() if type(config) is not GLConfig: - raise TypeError('config must be a GLConfig, not %s' % - type(config).__name__) + raise TypeError('config must be a GLConfig, not %s' + % type(config).__name__) self.config = config self.filesystem = GLFileSystem(self.config) @@ -191,14 +191,14 @@ class GLModule(object): self.cache = dict() self.content = '' if type(config) is not GLConfig: - raise TypeError('config must be a GLConfig, not %s' % - type(config).__name__) + raise TypeError('config must be a GLConfig, not %s' + % type(config).__name__) if type(module) is not str: - raise TypeError('module must be a string, not %s' % - type(module).__name__) + raise TypeError('module must be a string, not %s' + % type(module).__name__) if type(patched) is not bool: - raise TypeError('patched must be a bool, not %s' % - type(module).__name__) + raise TypeError('patched must be a bool, not %s' + % type(module).__name__) self.module = module self.patched = patched self.config = config @@ -272,8 +272,7 @@ Include:|Link:|License:|Maintainer:)' def __repr__(self): '''x.__repr__ <==> repr(x)''' - result = '' % \ - (repr(self.getName()), hex(id(self))) + result = '' % (repr(self.getName()), hex(id(self))) return result def getName(self): @@ -893,14 +892,14 @@ class GLModuleTable(object): self.tests_modules = list() # Tests modules self.final_modules = list() # Final modules if type(config) is not GLConfig: - raise TypeError('config must be a GLConfig, not %s' % - type(config).__name__) + raise TypeError('config must be a GLConfig, not %s' + % type(config).__name__) self.config = config self.filesystem = GLFileSystem(self.config) self.modulesystem = GLModuleSystem(self.config) if type(inc_all_direct_tests) is not bool: - raise TypeError('inc_all_direct_tests must be a bool, not %s' % - type(inc_all_direct_tests).__name__) + raise TypeError('inc_all_direct_tests must be a bool, not %s' + % type(inc_all_direct_tests).__name__) self.inc_all_direct_tests = inc_all_direct_tests self.inc_all_indirect_tests = inc_all_indirect_tests self.avoids = list() # Avoids @@ -935,14 +934,14 @@ class GLModuleTable(object): Add new conditional dependency from parent to module with condition.''' if type(parent) is not GLModule: - raise TypeError('parent must be a GLModule, not %s' % - type(parent).__name__) + raise TypeError('parent must be a GLModule, not %s' + % type(parent).__name__) if type(module) is not GLModule: - raise TypeError('module must be a GLModule, not %s' % - type(module).__name__) + raise TypeError('module must be a GLModule, not %s' + % type(module).__name__) if not (type(condition) is str or condition == True): - raise TypeError('condition must be a string or True, not %s' % - type(condition).__name__) + raise TypeError('condition must be a string or True, not %s' + % type(condition).__name__) if not str(module) in self.unconditionals: if str(module) not in self.dependers: self.dependers[module] = list() @@ -955,8 +954,8 @@ class GLModuleTable(object): Add module as unconditional dependency.''' if type(module) is not GLModule: - raise TypeError('module must be a GLModule, not %s' % - type(module).__name__) + raise TypeError('module must be a GLModule, not %s' + % type(module).__name__) if str(module) in self.dependers: self.dependers.pop(str(module)) self.unconditionals[str(module)] = True @@ -966,8 +965,8 @@ class GLModuleTable(object): Check whether module is unconditional.''' if type(module) is not GLModule: - raise TypeError('module must be a GLModule, not %s' % - type(module).__name__) + raise TypeError('module must be a GLModule, not %s' + % type(module).__name__) result = str(module) in self.dependers return result @@ -977,11 +976,11 @@ class GLModuleTable(object): Return condition from parent to module. Condition can be string or True. If module is not in the list of conddeps, method returns None.''' if type(parent) is not GLModule: - raise TypeError('parent must be a GLModule, not %s' % - type(parent).__name__) + raise TypeError('parent must be a GLModule, not %s' + % type(parent).__name__) if type(module) is not GLModule: - raise TypeError('module must be a GLModule, not %s' % - type(module).__name__) + raise TypeError('module must be a GLModule, not %s' + % type(module).__name__) key = '%s---%s' % (str(parent), str(module)) result = None if key in self.conditionals: @@ -1118,8 +1117,8 @@ class GLModuleTable(object): main_modules = self.transitive_closure(basemodules) self.config.setInclTestCategory(TESTS['tests'], saved_inctests) tests_modules = \ - [m for m in finalmodules if m not in main_modules] + \ - [m for m in main_modules if m.getApplicability() != 'main'] + [m for m in finalmodules if m not in main_modules] \ + + [m for m in main_modules if m.getApplicability() != 'main'] tests_modules = sorted(set(tests_modules)) result = tuple([main_modules, tests_modules]) return result diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py index 96fcb3e9a3..056eef3ee0 100644 --- a/pygnulib/GLTestDir.py +++ b/pygnulib/GLTestDir.py @@ -72,11 +72,11 @@ class GLTestDir(object): Create new GLTestDir instance.''' if type(config) is not GLConfig: - raise TypeError('config must be a GLConfig, not %s' % - type(config).__name__) + raise TypeError('config must be a GLConfig, not %s' + % type(config).__name__) if type(testdir) is not str: - raise TypeError('testdir must be a string, not %s' % - type(testdir).__name__) + raise TypeError('testdir must be a string, not %s' + % type(testdir).__name__) self.config = config self.testdir = os.path.normpath(testdir) if not os.path.exists(self.testdir): @@ -248,8 +248,7 @@ class GLTestDir(object): if single_configure: # Determine main module list and tests-related module list separately. main_modules, tests_modules = \ - moduletable.transitive_closure_separately( - specified_modules, final_modules) + moduletable.transitive_closure_separately(specified_modules, final_modules) # Print main_modules and tests_modules. if verbose >= 1: print('Main module list:') @@ -619,8 +618,7 @@ class GLTestDir(object): # Define a tests witness macro. emit += ' %stests_WITNESS=IN_GNULIB_TESTS\n' % macro_prefix emit += ' AC_SUBST([%stests_WITNESS])\n' % macro_prefix - emit += ' gl_module_indicator_condition=$%stests_WITNESS\n' % \ - macro_prefix + emit += ' gl_module_indicator_condition=$%stests_WITNESS\n' % macro_prefix emit += ' m4_pushdef([gl_MODULE_INDICATOR_CONDITION], ' emit += '[$gl_module_indicator_condition])\n' snippets = self.emiter.autoconfSnippets(tests_modules, moduletable, @@ -642,16 +640,13 @@ class GLTestDir(object): emit += '])\n' emit += self.emiter.initmacro_done(macro_prefix, sourcebase) if single_configure: - emit += self.emiter.initmacro_done('%stests' % - macro_prefix, testsbase) + emit += self.emiter.initmacro_done('%stests' % macro_prefix, testsbase) emit += '\ngl_INIT\n\n' if subdirs_with_configure_ac: if single_configure: - emit += 'AC_CONFIG_SUBDIRS([%s])\n' % \ - ' '.join(subdirs_with_configure_ac[:-1]) + emit += 'AC_CONFIG_SUBDIRS([%s])\n' % ' '.join(subdirs_with_configure_ac[:-1]) else: # if not single_configure - emit += 'AC_CONFIG_SUBDIRS([%s])\n' % \ - ' '.join(subdirs_with_configure_ac) + emit += 'AC_CONFIG_SUBDIRS([%s])\n' % ' '.join(subdirs_with_configure_ac) makefiles = ['Makefile'] for directory in subdirs: # For subdirs that have a configure.ac by their own, it's the subdir's @@ -856,11 +851,11 @@ class GLMegaTestDir(object): Create new GLTestDir instance.''' if type(config) is not GLConfig: - raise TypeError('config must be a GLConfig, not %s' % - type(config).__name__) + raise TypeError('config must be a GLConfig, not %s' + % type(config).__name__) if type(megatestdir) is not str: - raise TypeError('megatestdir must be a string, not %s' % - type(megatestdir).__name__) + raise TypeError('megatestdir must be a string, not %s' + % type(megatestdir).__name__) self.config = config self.megatestdir = os.path.normpath(megatestdir) if not os.path.exists(self.megatestdir): diff --git a/pygnulib/constants.py b/pygnulib/constants.py index bf01f86f39..70864f9f8d 100644 --- a/pygnulib/constants.py +++ b/pygnulib/constants.py @@ -404,10 +404,10 @@ 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)) - result = pattern.sub('%s\\1%s' % - (added_prefix, added_suffix), filename) + pattern = compiler('^%s(.*?)%s$' + % (removed_prefix, removed_suffix)) + result = pattern.sub('%s\\1%s' + % (added_prefix, added_suffix), filename) listing += [result] result = separator.join(listing) return result -- 2.34.1