summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--pygnulib/GLConfig.py186
-rw-r--r--pygnulib/GLEmiter.py118
-rw-r--r--pygnulib/GLFileSystem.py70
-rw-r--r--pygnulib/GLImport.py44
-rw-r--r--pygnulib/GLMakefileTable.py20
-rw-r--r--pygnulib/GLModuleSystem.py84
-rw-r--r--pygnulib/GLTestDir.py18
-rw-r--r--pygnulib/constants.py8
9 files changed, 279 insertions, 274 deletions
diff --git a/ChangeLog b/ChangeLog
index 59516a3970..9459fa6e7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2022-07-30 Bruno Haible <bruno@clisp.org>
+ gnulib-tool.py: Modernize coding style.
+ * pygnulib/*.py: Remove parentheses around raise value expressions.
+
+2022-07-30 Bruno Haible <bruno@clisp.org>
+
doc: Update regarding bootstrap split.
Reported by Paul Smith <psmith@gnu.org>.
* doc/gnulib-tool.texi (gettextize and autopoint): Mention autogen.sh
diff --git a/pygnulib/GLConfig.py b/pygnulib/GLConfig.py
index d925e7b2b3..acd6be2040 100644
--- a/pygnulib/GLConfig.py
+++ b/pygnulib/GLConfig.py
@@ -148,8 +148,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:
@@ -159,8 +159,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:
@@ -178,8 +178,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:
@@ -189,8 +189,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:
@@ -200,8 +200,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:
@@ -211,8 +211,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:
@@ -222,8 +222,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:
@@ -241,8 +241,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:
@@ -252,8 +252,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:
@@ -267,8 +267,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:
@@ -278,8 +278,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):
@@ -298,7 +298,7 @@ class GLConfig(object):
return "build-aux"
return self.table[y]
else: # if y not in self.table
- raise(KeyError('GLConfig does not contain key: %s' % repr(y)))
+ raise KeyError('GLConfig does not contain key: %s' % repr(y))
def dictionary(self):
'''Return the configuration as a dict object.'''
@@ -312,8 +312,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:
@@ -335,12 +335,12 @@ 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
- raise(KeyError('GLConfig does not contain key: %s' % repr(key)))
+ raise KeyError('GLConfig does not contain key: %s' % repr(key))
def default(self, key):
'''Return default value for the given key.'''
@@ -369,7 +369,7 @@ class GLConfig(object):
else: # otherwise
return string()
else: # if key not in self.table
- raise(KeyError('GLConfig does not contain key: %s' % repr(key)))
+ raise KeyError('GLConfig does not contain key: %s' % repr(key))
def isdefault(self, key, value):
'''Check whether the value for the given key is a default value.'''
@@ -377,7 +377,7 @@ class GLConfig(object):
default = self.default(key)
return value == default
else: # if key not in self.table
- raise(KeyError('GLConfig does not contain key: %s' % repr(key)))
+ raise KeyError('GLConfig does not contain key: %s' % repr(key))
def keys(self):
'''Return list of keys.'''
@@ -402,8 +402,8 @@ class GLConfig(object):
if destdir:
self.table['destdir'] = os.path.normpath(destdir)
else: # if destdir has not bytes/string 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
@@ -425,8 +425,8 @@ class GLConfig(object):
if localdir:
self.table['localdir'] = localdir
else: # if localdir has not bytes/string type
- raise(TypeError('localdir must be a string, not %s' %
- type(localdir).__name__))
+ raise TypeError('localdir must be a string, not %s' %
+ type(localdir).__name__)
def resetLocalDir(self):
'''Reset a local override directory where to look up files before looking
@@ -450,8 +450,8 @@ class GLConfig(object):
if auxdir:
self.table['auxdir'] = auxdir
else: # if type of auxdir is not bytes or string
- 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
@@ -471,8 +471,8 @@ class GLConfig(object):
if sourcebase:
self.table['sourcebase'] = sourcebase
else: # if type of sourcebase is not bytes or string
- 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.'''
@@ -491,8 +491,8 @@ class GLConfig(object):
if m4base:
self.table['m4base'] = m4base
else: # if type of m4base is not bytes or string
- 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.'''
@@ -511,8 +511,8 @@ class GLConfig(object):
if pobase:
self.table['pobase'] = pobase
else: # if type of pobase is not bytes or string
- 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.'''
@@ -533,8 +533,8 @@ class GLConfig(object):
if docbase:
self.table['docbase'] = docbase
else: # if type of docbase is not bytes or string
- 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.
@@ -556,8 +556,8 @@ class GLConfig(object):
if testsbase:
self.table['testsbase'] = testsbase
else: # if type of testsbase is not bytes or string
- 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.
@@ -573,8 +573,8 @@ class GLConfig(object):
if module not in self.table['modules']:
self.table['modules'] += [module]
else: # if module has not bytes or string 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.'''
@@ -584,8 +584,8 @@ class GLConfig(object):
if module in self.table['modules']:
self.table['modules'].remove(module)
else: # if module has not bytes or string 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.'''
@@ -601,13 +601,13 @@ class GLConfig(object):
self.addModule(module)
except TypeError as error:
self.table['modules'] = old_modules
- raise(TypeError('each module must be a string'))
+ raise TypeError('each module must be a string')
except GLError as error:
self.table['modules'] = old_modules
- raise(GLError(error.errno, error.errinfo))
+ raise GLError(error.errno, error.errinfo)
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.'''
@@ -623,8 +623,8 @@ class GLConfig(object):
if module not in self.table['avoids']:
self.table['avoids'].append(module)
else: # if module has not bytes or string 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.'''
@@ -634,8 +634,8 @@ class GLConfig(object):
if module in self.table['avoids']:
self.table['avoids'].remove(module)
else: # if module has not bytes or string 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.'''
@@ -651,13 +651,13 @@ class GLConfig(object):
self.addAvoid(module)
except TypeError as error:
self.table['avoids'] = old_avoids
- raise(TypeError('each module must be a string'))
+ raise TypeError('each module must be a string')
except GLError as error:
self.table['avoids'] = old_avoids
- raise(GLError(error.errno, error.errinfo))
+ raise GLError(error.errno, error.errinfo)
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.'''
@@ -672,8 +672,8 @@ class GLConfig(object):
if file not in self.table['files']:
self.table['files'].append(file)
else: # if file has not bytes or string 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.'''
@@ -683,8 +683,8 @@ class GLConfig(object):
if file in self.table['files']:
self.table['files'].remove(file)
else: # if file has not bytes or string 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.'''
@@ -700,13 +700,13 @@ class GLConfig(object):
self.addFile(file)
except TypeError as error:
self.table['files'] = old_files
- raise(TypeError('each file must be a string'))
+ raise TypeError('each file must be a string')
except GLError as error:
self.table['files'] = old_files
- raise(GLError(error.errno, error.errinfo))
+ raise GLError(error.errno, error.errinfo)
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.'''
@@ -718,7 +718,7 @@ class GLConfig(object):
if flag in TESTS.values():
return flag in self.table['testflags']
else: # if flag is not in TESTS
- raise(TypeError('unknown flag: %s' % repr(flag)))
+ raise TypeError('unknown flag: %s' % repr(flag))
def enableTestFlag(self, flag):
'''Enable test flag. You can get flags from TESTS variable.'''
@@ -726,7 +726,7 @@ class GLConfig(object):
if flag not in self.table['testflags']:
self.table['testflags'].append(flag)
else: # if flag is not in TESTS
- raise(TypeError('unknown flag: %s' % repr(flag)))
+ raise TypeError('unknown flag: %s' % repr(flag))
def disableTestFlag(self, flag):
'''Disable test flag. You can get flags from TESTS variable.'''
@@ -734,7 +734,7 @@ class GLConfig(object):
if flag in self.table['testflags']:
self.table['testflags'].remove(flag)
else: # if flag is not in TESTS
- raise(TypeError('unknown flag: %s' % repr(flag)))
+ raise TypeError('unknown flag: %s' % repr(flag))
def getTestFlags(self):
'''Return test flags. You can get flags from TESTS variable.'''
@@ -749,11 +749,11 @@ class GLConfig(object):
try: # Try to enable each flag
self.enableTestFlag(flag)
except TypeError as error:
- raise(TypeError('each flag must be one of TESTS integers'))
+ raise TypeError('each flag must be one of TESTS integers')
self.table['testflags'] = testflags
else: # if type of testflags is not list or tuple
- raise(TypeError('testflags must be a list or a tuple, not %s' %
- type(testflags).__name__))
+ raise TypeError('testflags must be a list or a tuple, not %s' %
+ type(testflags).__name__)
def resetTestFlags(self):
'''Reset test flags (only default flag will be enabled).'''
@@ -773,8 +773,8 @@ class GLConfig(object):
if libname:
self.table['libname'] = libname
else: # if type of libname is not bytes or string
- 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'.'''
@@ -826,7 +826,7 @@ class GLConfig(object):
if (type(lgpl) is int and 2 <= lgpl <= 3) or type(lgpl) is bool:
self.table['lgpl'] = lgpl
else: # if lgpl is not False, 2 or 3
- raise(TypeError('invalid LGPL version: %s' % repr(lgpl)))
+ raise TypeError('invalid LGPL version: %s' % repr(lgpl))
def resetLGPL(self):
'''Disable abort if modules aren't available under the LGPL.
@@ -856,8 +856,8 @@ class GLConfig(object):
if macro_prefix:
self.table['macro_prefix'] = macro_prefix
else: # if type of macro_prefix is not bytes or string
- 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'
@@ -890,8 +890,8 @@ class GLConfig(object):
if makefile:
self.table['makefile'] = makefile
else: # if type of makefile is not bytes or string
- 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
@@ -913,8 +913,8 @@ class GLConfig(object):
if podomain:
self.table['podomain'] = podomain
else: # if type of podomain is not bytes or string
- 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.
@@ -936,8 +936,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 bytes or string
- 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
@@ -992,8 +992,8 @@ class GLConfig(object):
self.table['configure_ac'] = \
relpath(self.table['destdir'], configure_ac)
else: # if type of configure_ac is not bytes or string
- 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.'''
@@ -1014,8 +1014,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.'''
@@ -1093,8 +1093,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 0d57b6177b..28c4943e61 100644
--- a/pygnulib/GLEmiter.py
+++ b/pygnulib/GLEmiter.py
@@ -75,8 +75,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):
@@ -137,28 +137,28 @@ class GLEmiter(object):
indentation is a string which contain spaces to prepend on each line.'''
emit = string()
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 bytes or type(indentation) is string:
if type(indentation) is bytes:
indentation = indentation.decode(ENCS['default'])
else: # if indentation has not bytes or string type
- 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'))
+ raise ValueError('indentation must contain only whitespaces')
auxdir = self.config['auxdir']
libtool = self.config['libtool']
include_guard_prefix = self.config['include_guard_prefix']
@@ -247,30 +247,30 @@ add AM_GNU_GETTEXT([external]) or similar to configure.ac.')
emit = string()
for module in modules:
if type(module) is not GLModule:
- raise(TypeError('each module must be a GLModule instance'))
+ 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))
+ 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']
@@ -495,8 +495,8 @@ USE_MSGCTXT = no\n"""
if type(macro_prefix_arg) is bytes:
macro_prefix_arg = macro_prefix_arg.decode(ENCS['default'])
else: # if macro_prefix_arg has not bytes or string type
- 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
@@ -547,8 +547,8 @@ USE_MSGCTXT = no\n"""
if type(macro_prefix_arg) is bytes:
macro_prefix_arg = macro_prefix_arg.decode(ENCS['default'])
else: # if macro_prefix_arg has not bytes or string type
- 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
@@ -603,14 +603,14 @@ found])])
if type(macro_prefix_arg) is bytes:
macro_prefix_arg = macro_prefix_arg.decode(ENCS['default'])
else: # if macro_prefix_arg has not bytes or string type
- 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 bytes or type(sourcebase_arg) is string:
if type(sourcebase_arg) is bytes:
sourcebase_arg = sourcebase_arg.decode(ENCS['default'])
else: # if sourcebase_arg has not bytes or string type
- 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
@@ -667,26 +667,26 @@ AC_DEFUN([%V1%_LIBSOURCES], [
if type(destfile) is bytes:
destfile = destfile.decode(ENCS['default'])
else: # if destfile has not bytes or string type
- 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'))
+ 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 bytes or type(actioncmd) is string:
if type(actioncmd) is bytes:
actioncmd = actioncmd.decode(ENCS['default'])
else: # if actioncmd has not bytes or string type
- 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 = string()
localdir = self.config['localdir']
sourcebase = self.config['sourcebase']
@@ -961,23 +961,23 @@ AC_DEFUN([%V1%_LIBSOURCES], [
if type(destfile) is bytes:
destfile = destfile.decode(ENCS['default'])
else: # if destfile has not bytes or string type
- 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'))
+ 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 bytes or type(witness_macro) is string:
if type(witness_macro) is bytes:
witness_macro = witness_macro.decode(ENCS['default'])
else: # if witness_macro has not bytes or string type
- 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 = string()
localdir = self.config['localdir']
auxdir = self.config['auxdir']
diff --git a/pygnulib/GLFileSystem.py b/pygnulib/GLFileSystem.py
index 9d8d2b0cf7..b41c029cd1 100644
--- a/pygnulib/GLFileSystem.py
+++ b/pygnulib/GLFileSystem.py
@@ -71,8 +71,8 @@ class GLFileSystem(object):
'''Create new GLFileSystem instance. The only argument is localdir,
which can be an empty string too.'''
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):
@@ -92,8 +92,8 @@ class GLFileSystem(object):
if type(name) is bytes:
name = name.decode(ENCS['default'])
else: # if name has not bytes or string type
- raise(TypeError(
- 'name must be a string, not %s' % type(module).__name__))
+ raise TypeError(
+ 'name must be a string, not %s' % type(module).__name__)
# If name exists in localdir, then we use it
path_gnulib = joinpath(DIRS['root'], name)
path_local = joinpath(self.config['localdir'], name)
@@ -115,12 +115,12 @@ class GLFileSystem(object):
try: # Try to apply patch
sp.check_call(command, shell=True)
except sp.CalledProcessError as error:
- raise(GLError(2, name))
+ raise GLError(2, name)
result = (path_temp, True)
else: # if path_diff does not exist
result = (path_gnulib, False)
else: # if path_gnulib does not exist
- raise(GLError(1, name))
+ raise GLError(1, name)
return result
@@ -133,11 +133,11 @@ 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,'
@@ -147,8 +147,8 @@ class GLFileAssistant(object):
if type(value) is bytes:
transformers[key] = value.decode(ENCS['default'])
else: # if value has not bytes or string type
- 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()
@@ -170,8 +170,8 @@ class GLFileAssistant(object):
if type(path) is bytes:
path = path.decode(ENCS['default'])
else: # if path has not bytes or string type
- raise(TypeError(
- 'path must be a string, not %s' % (type(path).__name__)))
+ raise TypeError(
+ 'path must be a string, not %s' % (type(path).__name__))
if not self.config['dryrun']:
# Put the new contents of $file in a file in the same directory (needed
# to guarantee that an 'mv' to "$destdir/$file" works).
@@ -199,8 +199,8 @@ class GLFileAssistant(object):
if type(original) is bytes:
original = original.decode(ENCS['default'])
else: # if original has not bytes or string type
- raise(TypeError(
- 'original must be a string, not %s' % (type(original).__name__)))
+ raise TypeError(
+ 'original must be a string, not %s' % (type(original).__name__))
self.original = original
def setRewritten(self, rewritten):
@@ -211,8 +211,8 @@ class GLFileAssistant(object):
if type(rewritten) is bytes:
rewritten = rewritten.decode(ENCS['default'])
else: # if rewritten has not bytes or string type
- raise(TypeError(
- 'rewritten must be a string, not %s' % type(rewritten).__name__))
+ raise TypeError(
+ 'rewritten must be a string, not %s' % type(rewritten).__name__)
self.rewritten = rewritten
def addFile(self, file):
@@ -245,9 +245,9 @@ class GLFileAssistant(object):
symbolic = self.config['symbolic']
lsymbolic = self.config['lsymbolic']
if original == None:
- raise(TypeError('original must be set before applying the method'))
+ raise TypeError('original must be set before applying the method')
elif rewritten == None:
- raise(TypeError('rewritten must be set before applying the method'))
+ raise TypeError('rewritten must be set before applying the method')
if not self.config['dryrun']:
print('Copying file %s' % rewritten)
loriginal = joinpath(self.config['localdir'], original)
@@ -259,7 +259,7 @@ class GLFileAssistant(object):
try: # Try to move file
shutil.move(tmpfile, joinpath(destdir, rewritten))
except Exception as error:
- raise(GLError(17, original))
+ raise GLError(17, original)
else: # if self.config['dryrun']
print('Copy file %s' % rewritten)
@@ -275,18 +275,18 @@ class GLFileAssistant(object):
symbolic = self.config['symbolic']
lsymbolic = self.config['lsymbolic']
if original == None:
- raise(TypeError('original must be set before applying the method'))
+ raise TypeError('original must be set before applying the method')
elif rewritten == None:
- raise(TypeError('rewritten must be set before applying the method'))
+ raise TypeError('rewritten must be set before applying the method')
if type(lookedup) is bytes or type(lookedup) is string:
if type(lookedup) is bytes:
lookedup = lookedup.decode(ENCS['default'])
else: # if lookedup has not bytes or string type
- 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 = string('%s~' % basename)
basepath = joinpath(destdir, basename)
@@ -306,7 +306,7 @@ class GLFileAssistant(object):
try: # Try to replace the given file
shutil.move(basepath, backuppath)
except Exception as error:
- raise(GLError(17, original))
+ raise GLError(17, original)
loriginal = joinpath(self.config['localdir'], original)
if (symbolic or (lsymbolic and lookedup == loriginal)) \
and not tmpflag and filecmp.cmp(lookedup, tmpfile):
@@ -317,7 +317,7 @@ class GLFileAssistant(object):
os.remove(basepath)
shutil.copy(tmpfile, rewritten)
except Exception as error:
- raise(GLError(17, original))
+ raise GLError(17, original)
else: # if self.config['dryrun']
if already_present:
print('Update file %s (backup in %s)' %
@@ -333,12 +333,12 @@ class GLFileAssistant(object):
original = self.original
rewritten = self.rewritten
if original == None:
- raise(TypeError('original must be set before applying the method'))
+ raise TypeError('original must be set before applying the method')
elif rewritten == None:
- raise(TypeError('rewritten must be set before applying the method'))
+ 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)
@@ -352,7 +352,7 @@ class GLFileAssistant(object):
try: # Try to copy lookedup file to tmpfile
shutil.copy(lookedup, tmpfile)
except Exception as error:
- raise(GLError(15, lookedup))
+ raise GLError(15, lookedup)
# Don't process binary files with sed.
if not (original.endswith(".class") or original.endswith(".mo")):
transformer = string()
@@ -372,7 +372,7 @@ class GLFileAssistant(object):
data = sp.check_output(args, stdin=stdin, shell=False)
data = data.decode("UTF-8")
except Exception as error:
- raise(GLError(16, lookedup))
+ raise GLError(16, lookedup)
with codecs.open(tmpfile, 'wb', 'UTF-8') as file:
file.write(data)
path = joinpath(self.config['destdir'], rewritten)
diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index 06c122e780..ca7a00d5de 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -82,14 +82,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()
@@ -102,7 +102,7 @@ class GLImport(object):
if not isfile(path):
path = joinpath(self.config['destdir'], 'configure.in')
if not isfile(path):
- raise(GLError(3, path))
+ raise GLError(3, path)
self.config.setAutoconfFile(path)
with codecs.open(path, 'rb', 'UTF-8') as file:
data = file.read()
@@ -123,7 +123,7 @@ class GLImport(object):
version = sorted(set([float(version) for version in versions]))[-1]
self.config.setAutoconfVersion(version)
if version < 2.59:
- raise(GLError(4, version))
+ raise GLError(4, version)
# Get other cached variables.
path = joinpath(self.config['m4base'], 'gnulib-cache.m4')
@@ -245,7 +245,7 @@ class GLImport(object):
if self.mode != MODES['import']:
if self.cache['m4base'] and \
(self.config['m4base'] != self.cache['m4base']):
- raise(GLError(5, m4base))
+ raise GLError(5, m4base)
# Perform actions with modules. In --add-import, append each given module
# to the list of cached modules; in --remove-import, remove each given
@@ -261,7 +261,7 @@ class GLImport(object):
# If user tries to apply conddeps and testflag['tests'] together.
if self.config['tests'] and self.config['conddeps']:
- raise(GLError(10, None))
+ raise GLError(10, None)
# Update configuration dictionary.
self.config.update(self.cache)
@@ -274,7 +274,7 @@ class GLImport(object):
# Check if conddeps is enabled together with inctests.
inctests = self.config.checkTestFlag(TESTS['tests'])
if self.config['conddeps'] and inctests:
- raise(GLError(10, None))
+ raise GLError(10, None)
# Define GLImport attributes.
self.emiter = GLEmiter(self.config)
@@ -294,8 +294,8 @@ class GLImport(object):
Replace auxdir, docbase, sourcebase, m4base and testsbase from default
to their version from cached config.'''
if type(files) is not list:
- raise(TypeError(
- 'files argument must has list type, not %s' % type(files).__name__))
+ raise TypeError(
+ 'files argument must has list type, not %s' % type(files).__name__)
files = \
[ # Begin to convert bytes to string
file.decode(ENCS['default']) \
@@ -304,7 +304,7 @@ class GLImport(object):
] # Finish to convert bytes to string
for file in files:
if type(file) is not string:
- raise(TypeError('each file must be a string instance'))
+ raise TypeError('each file must be a string instance')
files = sorted(set(files))
files = ['%s%s' % (file, os.path.sep) for file in files]
auxdir = self.cache['auxdir']
@@ -341,8 +341,8 @@ class GLImport(object):
Replace auxdir, docbase, sourcebase, m4base and testsbase from default
to their version from config.'''
if type(files) is not list:
- raise(TypeError(
- 'files argument must has list type, not %s' % type(files).__name__))
+ raise TypeError(
+ 'files argument must has list type, not %s' % type(files).__name__)
files = \
[ # Begin to convert bytes to string
file.decode(ENCS['default']) \
@@ -351,7 +351,7 @@ class GLImport(object):
] # Finish to convert bytes to string
for file in files:
if type(file) is not string:
- raise(TypeError('each file must be a string instance'))
+ raise TypeError('each file must be a string instance')
files = sorted(set(files))
auxdir = self.config['auxdir']
docbase = self.config['docbase']
@@ -865,7 +865,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
if license not in compatibilities[2]:
listing.append(tuple([str(module), license]))
if listing:
- raise(GLError(11, listing))
+ raise GLError(11, listing)
# Print notices from modules.
for module in main_modules:
@@ -924,7 +924,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
filelist = sorted(
set(main_filelist + tests_filelist), key=string.lower)
if not filelist:
- raise(GLError(12, None))
+ raise GLError(12, None)
# Print list of files.
if verbose >= 0:
@@ -980,11 +980,11 @@ 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)))
+ raise KeyError('filetable must contain key %s' % repr(key))
destdir = self.config['destdir']
localdir = self.config['localdir']
auxdir = self.config['auxdir']
@@ -1027,7 +1027,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
try: # Try to create directory
os.makedirs(directory)
except Exception as error:
- raise(GLError(13, directory))
+ raise GLError(13, directory)
else: # if self.config['dryrun']
print('Create directory %s' % directory)
@@ -1050,7 +1050,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
os.remove(backup)
shutil.move(path, '%s~' % path)
except Exception as error:
- raise(GLError(14, file))
+ raise GLError(14, file)
else: # if self.config['dryrun']
print('Remove file %s (backup in %s~)' % (path, path))
filetable['removed'] += [file]
diff --git a/pygnulib/GLMakefileTable.py b/pygnulib/GLMakefileTable.py
index cff9ff34f9..64fca0ff53 100644
--- a/pygnulib/GLMakefileTable.py
+++ b/pygnulib/GLMakefileTable.py
@@ -71,16 +71,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)
@@ -93,20 +93,20 @@ class GLMakefileTable(object):
if type(dir) is bytes:
dir = dir.decode(ENCS['default'])
else: # if dir has not bytes or string type
- raise(TypeError(
- 'dir must be a string, not %s' % (type(dir).__name__)))
+ raise TypeError(
+ 'dir must be a string, not %s' % (type(dir).__name__))
if type(var) is bytes or type(var) is string:
if type(var) is bytes:
var = var.decode(ENCS['default'])
else: # if var has not bytes or string type
- raise(TypeError(
- 'var must be a string, not %s' % (type(var).__name__)))
+ raise TypeError(
+ 'var must be a string, not %s' % (type(var).__name__))
if type(val) is bytes or type(val) is string:
if type(val) is bytes:
val = val.decode(ENCS['default'])
else: # if val has not bytes or string type
- raise(TypeError(
- 'val must be a string, not %s' % (type(val).__name__)))
+ raise TypeError(
+ 'val must be a string, not %s' % (type(val).__name__))
dictionary = {'dir': dir, 'var': var, 'val': val}
self.table += [dictionary]
diff --git a/pygnulib/GLModuleSystem.py b/pygnulib/GLModuleSystem.py
index d599755ee9..728f9f5610 100644
--- a/pygnulib/GLModuleSystem.py
+++ b/pygnulib/GLModuleSystem.py
@@ -74,8 +74,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)
@@ -93,8 +93,8 @@ class GLModuleSystem(object):
if type(module) is bytes:
module = module.decode(ENCS['default'])
else: # if module has not bytes or string 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__)
result = bool()
badnames = ['ChangeLog', 'COPYING', 'README', 'TEMPLATE',
'TEMPLATE-EXTENDED', 'TEMPLATE-TESTS']
@@ -117,15 +117,15 @@ class GLModuleSystem(object):
if type(module) is bytes:
module = module.decode(ENCS['default'])
else: # if module has not bytes or string 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__)
if self.exists(module):
path, istemp = self.filesystem.lookup(joinpath('modules', module))
result = GLModule(self.config, path, istemp)
return result
else: # if not self.exists(module)
if self.config['errors']:
- raise(GLError(3, module))
+ raise GLError(3, module)
else: # if not self.config['errors']
sys.stderr.write('gnulib-tool: warning: ')
sys.stderr.write('file %s does not exist\n' % str(module))
@@ -205,17 +205,17 @@ class GLModule(object):
self.cache = dict()
self.content = string()
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 bytes or type(module) is string:
if type(module) is bytes:
module = module.decode(ENCS['default'])
else: # if module has not bytes or string 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__)
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
@@ -831,7 +831,7 @@ Include:|Link:|License:|Maintainer:)'
if not self.isTests():
if not license:
if self.config['errors']:
- raise(GLError(18, string(self)))
+ raise GLError(18, string(self))
else: # if not self.config['errors']
sys.stderr.write('gnulib-tool: warning: ')
sys.stderr.write('module %s lacks a license\n' % str(self))
@@ -914,11 +914,11 @@ 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__)
for avoid in avoids:
if type(avoid) is not GLModule:
- raise(TypeError('each avoid must be a GLModule instance'))
+ raise TypeError('each avoid must be a GLModule instance')
self.avoids += [avoids]
self.config = config
self.filesystem = GLFileSystem(self.config)
@@ -943,25 +943,25 @@ class GLModuleTable(object):
else: # if y == 'avoids'
return self.getAvoids()
else: # if y is not in list
- raise(KeyError('GLModuleTable does not contain key: %s' % repr(y)))
+ raise KeyError('GLModuleTable does not contain key: %s' % repr(y))
def addConditional(self, parent, module, condition):
'''GLModuleTable.addConditional(module, condition)
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 type(condition) is bytes or type(condition) is string \
or condition == True:
if type(condition) is bytes:
condition = condition.decode(ENCS['default'])
else: # if condition has not bytes or string type or is not 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()
@@ -974,8 +974,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
@@ -985,8 +985,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
@@ -996,11 +996,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:
@@ -1019,7 +1019,7 @@ class GLModuleTable(object):
GLConfig: testflags.'''
for module in modules:
if type(module) is not GLModule:
- raise(TypeError('each module must be a GLModule instance'))
+ raise TypeError('each module must be a GLModule instance')
handledmodules = list()
inmodules = modules
outmodules = list()
@@ -1129,10 +1129,10 @@ class GLModuleTable(object):
inctests = True
for module in basemodules:
if type(module) is not GLModule:
- raise(TypeError('each module must be a GLModule instance'))
+ raise TypeError('each module must be a GLModule instance')
for module in finalmodules:
if type(module) is not GLModule:
- raise(TypeError('each module must be a GLModule instance'))
+ raise TypeError('each module must be a GLModule instance')
main_modules = self.transitive_closure(basemodules)
tests_modules = \
[m for m in finalmodules if m not in main_modules] + \
@@ -1156,7 +1156,7 @@ class GLModuleTable(object):
have_lib_sources = False
for module in modules:
if type(module) is not GLModule:
- raise(TypeError('each module must be a GLModule instance'))
+ raise TypeError('each module must be a GLModule instance')
snippet = module.getAutomakeSnippet()
snippet = constants.remove_backslash_newline(snippet)
pattern = compiler(
@@ -1183,7 +1183,7 @@ class GLModuleTable(object):
filelist = list()
for module in modules:
if type(module) is not GLModule:
- raise(TypeError('each module must be a GLModule instance'))
+ raise TypeError('each module must be a GLModule instance')
listings = [module.getFiles() for module in modules]
for listing in listings:
for file in listing:
@@ -1222,7 +1222,7 @@ class GLModuleTable(object):
Specify list of avoids.'''
for module in modules:
if type(module) is not GLModule:
- raise(TypeError('each module must be a GLModule instance'))
+ raise TypeError('each module must be a GLModule instance')
self.avoids = sorted(set(modules))
def getBaseModules(self):
@@ -1237,7 +1237,7 @@ class GLModuleTable(object):
Specify list of base modules.'''
for module in modules:
if type(module) is not GLModule:
- raise(TypeError('each module must be a GLModule instance'))
+ raise TypeError('each module must be a GLModule instance')
self.base_modules = sorted(set(modules))
def getFinalModules(self):
@@ -1252,7 +1252,7 @@ class GLModuleTable(object):
Specify list of final modules.'''
for module in modules:
if type(module) is not GLModule:
- raise(TypeError('each module must be a GLModule instance'))
+ raise TypeError('each module must be a GLModule instance')
self.final_modules = sorted(set(modules))
def getMainModules(self):
@@ -1267,7 +1267,7 @@ class GLModuleTable(object):
Specify list of main modules.'''
for module in modules:
if type(module) is not GLModule:
- raise(TypeError('each module must be a GLModule instance'))
+ raise TypeError('each module must be a GLModule instance')
self.main_modules = sorted(set(modules))
def getTestsModules(self):
@@ -1282,5 +1282,5 @@ class GLModuleTable(object):
Specify list of tests modules.'''
for module in modules:
if type(module) is not GLModule:
- raise(TypeError('each module must be a GLModule instance'))
+ raise TypeError('each module must be a GLModule instance')
self.tests_modules = sorted(set(modules))
diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py
index 0a403c993f..0a631ebdc3 100644
--- a/pygnulib/GLTestDir.py
+++ b/pygnulib/GLTestDir.py
@@ -78,8 +78,8 @@ 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 bytes or type(testdir) is string:
if type(testdir) is bytes:
testdir = testdir.decode(ENCS['default'])
@@ -89,7 +89,7 @@ class GLTestDir(object):
try: # Try to create directory
os.mkdir(self.testdir)
except Exception as error:
- raise(GLError(19, self.testdir))
+ raise GLError(19, self.testdir)
self.emiter = GLEmiter(self.config)
self.filesystem = GLFileSystem(self.config)
self.modulesystem = GLModuleSystem(self.config)
@@ -114,8 +114,8 @@ class GLTestDir(object):
Replace auxdir, docbase, sourcebase, m4base and testsbase from default
to their version from config.'''
if type(files) is not list:
- raise(TypeError(
- 'files argument must has list type, not %s' % type(files).__name__))
+ raise TypeError(
+ 'files argument must has list type, not %s' % type(files).__name__)
files = \
[ # Begin to convert bytes to string
file.decode(ENCS['default']) \
@@ -124,7 +124,7 @@ class GLTestDir(object):
] # Finish to convert bytes to string
for file in files:
if type(file) is not string:
- raise(TypeError('each file must be a string instance'))
+ raise TypeError('each file must be a string instance')
files = sorted(set(files))
auxdir = self.config['auxdir']
docbase = self.config['docbase']
@@ -860,8 +860,8 @@ 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 bytes or type(megatestdir) is string:
if type(megatestdir) is bytes:
megatestdir = megatestdir.decode(ENCS['default'])
@@ -871,7 +871,7 @@ class GLMegaTestDir(object):
try: # Try to create directory
os.mkdir(self.megatestdir)
except Exception as error:
- raise(GLError(19, self.megatestdir))
+ raise GLError(19, self.megatestdir)
self.emiter = GLEmiter(self.config)
self.filesystem = GLFileSystem(self.config)
self.modulesystem = GLModuleSystem(self.config)
diff --git a/pygnulib/constants.py b/pygnulib/constants.py
index 235f5d8891..f41c12ffd3 100644
--- a/pygnulib/constants.py
+++ b/pygnulib/constants.py
@@ -348,14 +348,14 @@ def link_relative(src, dest):
if type(src) is bytes:
src = src.decode(ENCS['default'])
else: # if src has not bytes or string type
- raise(TypeError(
- 'src must be a string, not %s' % (type(src).__name__)))
+ raise TypeError(
+ 'src must be a string, not %s' % (type(src).__name__))
if type(dest) is bytes or type(dest) is string:
if type(dest) is bytes:
dest = dest.decode(ENCS['default'])
else: # if dest has not bytes or string type
- raise(TypeError(
- 'dest must be a string, not %s' % (type(dest).__name__)))
+ raise TypeError(
+ 'dest must be a string, not %s' % (type(dest).__name__))
if src.startswith('/') or (len(src) >= 2 and src[1] == ':'):
os.symlink(src, dest)
else: # if src is not absolute