diff options
author | Bruno Haible <bruno@clisp.org> | 2022-07-30 10:44:02 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2022-07-31 07:07:24 +0200 |
commit | 5d39cdb46a0ab98506d1be1cbf6ec58950ff93e4 (patch) | |
tree | 32e8f6d18582c9cfba711099d0bb9e7cf00fd339 /pygnulib/GLConfig.py | |
parent | c31c05e0334c985ce0aa8a2cc7a470b197d0c4c2 (diff) | |
download | gnulib-5d39cdb46a0ab98506d1be1cbf6ec58950ff93e4.tar.gz |
gnulib-tool.py: Modernize coding style.
* pygnulib/*.py: Remove parentheses around raise value expressions.
Diffstat (limited to 'pygnulib/GLConfig.py')
-rw-r--r-- | pygnulib/GLConfig.py | 186 |
1 files changed, 93 insertions, 93 deletions
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.''' |