* pygnulib/*.py: Remove parentheses around raise value expressions.
+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.
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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):
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.'''
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:
'''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.'''
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.'''
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.'''
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
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
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
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.'''
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.'''
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.'''
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.
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.
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.'''
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.'''
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.'''
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.'''
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.'''
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.'''
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.'''
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.'''
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.'''
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.'''
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.'''
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.'''
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).'''
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'.'''
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.
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'
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
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.
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
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.'''
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.'''
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.'''
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):
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']
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']
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
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
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
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']
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']
'''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):
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)
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
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,'
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()
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).
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):
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):
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)
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)
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)
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):
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)' %
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)
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()
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)
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()
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()
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')
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
# 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)
# 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)
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']) \
] # 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']
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']) \
] # 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']
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:
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:
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']
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)
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]
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)
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]
'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)
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']
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))
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
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))
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)
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()
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
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
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:
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()
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] + \
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(
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:
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):
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):
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):
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):
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))
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'])
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)
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']) \
] # 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']
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'])
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)
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