Created
March 26, 2020 11:09
-
-
Save Flamefire/713c7ce1cbb190ef0567e7b5e87a12ba to your computer and use it in GitHub Desktop.
pep8 diff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/contrib/hooks/hpc2n_hooks.py b/contrib/hooks/hpc2n_hooks.py | |
index ad93fe88e..4e00513ba 100644 | |
--- a/contrib/hooks/hpc2n_hooks.py | |
+++ b/contrib/hooks/hpc2n_hooks.py | |
@@ -13,6 +13,8 @@ from easybuild.tools.systemtools import get_shared_lib_ext | |
# Add/remove dependencies and/or patches | |
# Access to the raw values before templating and such. | |
+ | |
+ | |
def parse_hook(ec, *args, **kwargs): | |
# Internal helper function | |
@@ -58,7 +60,7 @@ def parse_hook(ec, *args, **kwargs): | |
if LooseVersion(ec.version) >= LooseVersion('3'): | |
pmix_version = '2.2.1' | |
if LooseVersion(ec.version) >= LooseVersion('4'): | |
- pmix_version = '3.0.2' # OpenMPI 4.0.0 is not compatible with PMIx 3.1.x | |
+ pmix_version = '3.0.2' # OpenMPI 4.0.0 is not compatible with PMIx 3.1.x | |
extra_deps.append(('PMIx', pmix_version)) | |
# Use of external PMIx requires external libevent | |
diff --git a/easybuild/base/fancylogger.py b/easybuild/base/fancylogger.py | |
index f24b336b7..a6103705e 100644 | |
--- a/easybuild/base/fancylogger.py | |
+++ b/easybuild/base/fancylogger.py | |
@@ -224,6 +224,7 @@ def getLevelInt(level_name): | |
class FancyStreamHandler(logging.StreamHandler): | |
"""The logging StreamHandler with uniform named arg in __init__ for selecting the stream.""" | |
+ | |
def __init__(self, stream=None, stdout=None): | |
"""Initialize the stream (default is sys.stderr) | |
- stream : a specific stream to use | |
@@ -245,6 +246,7 @@ class FancyLogRecord(logging.LogRecord): | |
This class defines a custom log record. | |
Adding extra specifiers is as simple as adding attributes to the log record | |
""" | |
+ | |
def __init__(self, *args, **kwargs): | |
logging.LogRecord.__init__(self, *args, **kwargs) | |
# modify custom specifiers here | |
@@ -782,7 +784,7 @@ def getAllExistingLoggers(): | |
""" | |
# not-so-well documented manager (in 2.6 and later) | |
# return list of (name,logger) tuple | |
- return [x for x in logging.Logger.manager.loggerDict.items()]+[(logging.root.name, logging.root)] | |
+ return [x for x in logging.Logger.manager.loggerDict.items()] + [(logging.root.name, logging.root)] | |
def getAllNonFancyloggers(): | |
diff --git a/easybuild/base/generaloption.py b/easybuild/base/generaloption.py | |
index 0a301137a..07a5f1ad5 100644 | |
--- a/easybuild/base/generaloption.py | |
+++ b/easybuild/base/generaloption.py | |
@@ -307,7 +307,7 @@ class ExtOption(CompleterOption): | |
empty = get_empty_add_flex(lvalue, self=self) | |
if empty in value: | |
ind = value.index(empty) | |
- lvalue = value[:ind] + default + value[ind+1:] | |
+ lvalue = value[:ind] + default + value[ind + 1:] | |
else: | |
lvalue = value | |
elif action == "regex": | |
@@ -1573,7 +1573,7 @@ class GeneralOption(object): | |
(opt_name, default, action)) | |
else: | |
if opt_value == default and ((action in ('store_true',) + | |
- ExtOption.EXTOPTION_LOG and default is False) or | |
+ ExtOption.EXTOPTION_LOG and default is False) or | |
(action in ('store_false',) and default is True)): | |
if hasattr(self.parser.option_class, 'ENABLE') and \ | |
hasattr(self.parser.option_class, 'DISABLE'): | |
@@ -1588,10 +1588,10 @@ class GeneralOption(object): | |
if default is not None: | |
if action == 'add_flex' and default: | |
for ind, elem in enumerate(opt_value): | |
- if elem == default[0] and opt_value[ind:ind+len(default)] == default: | |
+ if elem == default[0] and opt_value[ind:ind + len(default)] == default: | |
empty = get_empty_add_flex(opt_value, self=self) | |
# TODO: this will only work for tuples and lists | |
- opt_value = opt_value[:ind] + type(opt_value)([empty]) + opt_value[ind+len(default):] | |
+ opt_value = opt_value[:ind] + type(opt_value)([empty]) + opt_value[ind + len(default):] | |
# only the first occurence | |
break | |
elif hasattr(opt_value, '__neg__'): | |
diff --git a/easybuild/base/optcomplete.py b/easybuild/base/optcomplete.py | |
index c7a5e0e1a..f0c172d9f 100644 | |
--- a/easybuild/base/optcomplete.py | |
+++ b/easybuild/base/optcomplete.py | |
@@ -186,6 +186,7 @@ class NoneCompleter(Completer): | |
class ListCompleter(Completer): | |
"""Completes by filtering using a fixed list of strings.""" | |
+ | |
def __init__(self, stringlist): | |
self.olist = stringlist | |
@@ -263,6 +264,7 @@ class DirCompleter(Completer): | |
class KnownHostsCompleter(Completer): | |
"""Completes a list of known hostnames""" | |
+ | |
def _call(self, **kwargs): | |
if SHELL == BASH: | |
return "_known_hosts" | |
@@ -310,6 +312,7 @@ class RegexCompleter(Completer): | |
class CompleterOption(OPTION_CLASS): | |
"""optparse Option class with completer attribute""" | |
+ | |
def __init__(self, *args, **kwargs): | |
completer = kwargs.pop('completer', None) | |
OPTION_CLASS.__init__(self, *args, **kwargs) | |
@@ -587,7 +590,7 @@ def autocomplete(parser, arg_completer=None, opt_completer=None, subcmd_complete | |
'completer_kwargs%s' % str(completer_kwargs), | |
# 'completer_completions %s' % completer_completions, | |
'completions %s' % completions, | |
- ]) | |
+ ]) | |
if isinstance(debugfn, logging.Logger): | |
debugfn.debug(txt) | |
else: | |
diff --git a/easybuild/base/rest.py b/easybuild/base/rest.py | |
index 842c0bd3c..7e5ed6bc2 100644 | |
--- a/easybuild/base/rest.py | |
+++ b/easybuild/base/rest.py | |
@@ -228,6 +228,7 @@ class RequestBuilder(object): | |
To understand the method(...) calls, check out github.client.Client. | |
''' | |
+ | |
def __init__(self, client): | |
"""Constructor""" | |
self.client = client | |
@@ -288,6 +289,7 @@ class RestClient(object): | |
try to validate the url you feed it. On the other hand, it | |
automatically supports the full API--so why should you care? | |
""" | |
+ | |
def __init__(self, *args, **kwargs): | |
"""We create a client with the given arguments""" | |
self.client = Client(*args, **kwargs) | |
diff --git a/easybuild/base/testing.py b/easybuild/base/testing.py | |
index e7d75b25a..c78e11818 100644 | |
--- a/easybuild/base/testing.py | |
+++ b/easybuild/base/testing.py | |
@@ -60,7 +60,7 @@ def nicediff(txta, txtb, offset=5): | |
res_idx = [] | |
# very bruteforce | |
for didx in different_idx: | |
- for idx in range(max(didx-offset, 0), min(didx+offset, len(diff)-1)): | |
+ for idx in range(max(didx - offset, 0), min(didx + offset, len(diff) - 1)): | |
if idx not in res_idx: | |
res_idx.append(idx) | |
res_idx.sort() | |
diff --git a/easybuild/framework/easyblock.py b/easybuild/framework/easyblock.py | |
index 8ba572464..67cede96b 100644 | |
--- a/easybuild/framework/easyblock.py | |
+++ b/easybuild/framework/easyblock.py | |
@@ -416,7 +416,7 @@ class EasyBlock(object): | |
# this *must* be of typ int, nothing else | |
# no 'isinstance(..., int)', since that would make True/False also acceptable | |
- if type(patch_spec[1]) == int: | |
+ if isinstance(patch_spec[1], int): | |
level = patch_spec[1] | |
elif isinstance(patch_spec[1], string_type): | |
# non-patch files are assumed to be files to copy | |
@@ -2161,7 +2161,7 @@ class EasyBlock(object): | |
# always go back to original work dir to avoid running stuff from a dir that no longer exists | |
change_dir(self.orig_workdir) | |
- tup = (ext.name, ext.version or '', idx+1, exts_cnt) | |
+ tup = (ext.name, ext.version or '', idx + 1, exts_cnt) | |
print_msg("installing extension %s %s (%d/%d)..." % tup, silent=self.silent) | |
if self.dry_run: | |
diff --git a/easybuild/framework/easyconfig/__init__.py b/easybuild/framework/easyconfig/__init__.py | |
index cf6a11c4e..8fc93cd78 100644 | |
--- a/easybuild/framework/easyconfig/__init__.py | |
+++ b/easybuild/framework/easyconfig/__init__.py | |
@@ -28,6 +28,7 @@ | |
# TODO cleanup to be evaluated for 2.0 release | |
# is used (esp CUSTOM) in some easyblocks | |
+from easybuild.framework.easyconfig.easyconfig import EasyConfig | |
from easybuild.framework.easyconfig.default import ALL_CATEGORIES | |
globals().update(ALL_CATEGORIES) | |
@@ -35,4 +36,3 @@ globals().update(ALL_CATEGORIES) | |
EASYCONFIGS_PKG_SUBDIR = 'easyconfigs' | |
# is used in some tools | |
-from easybuild.framework.easyconfig.easyconfig import EasyConfig | |
diff --git a/easybuild/framework/easyconfig/easyconfig.py b/easybuild/framework/easyconfig/easyconfig.py | |
index d6033eb7c..75220b33f 100644 | |
--- a/easybuild/framework/easyconfig/easyconfig.py | |
+++ b/easybuild/framework/easyconfig/easyconfig.py | |
@@ -106,6 +106,7 @@ _easyconfigs_cache = {} | |
def handle_deprecated_or_replaced_easyconfig_parameters(ec_method): | |
"""Decorator to handle deprecated/replaced easyconfig parameters.""" | |
+ | |
def new_ec_method(self, key, *args, **kwargs): | |
"""Check whether any replace easyconfig parameters are still used""" | |
# map deprecated parameters to their replacements, issue deprecation warning(/error) | |
@@ -1345,7 +1346,7 @@ class EasyConfig(object): | |
# (true) boolean value simply indicates that a system toolchain is used | |
elif isinstance(tc_spec, bool) and tc_spec: | |
- tc = {'name': SYSTEM_TOOLCHAIN_NAME, 'version': ''} | |
+ tc = {'name': SYSTEM_TOOLCHAIN_NAME, 'version': ''} | |
# two-element list/tuple value indicates custom toolchain specification | |
elif isinstance(tc_spec, (list, tuple,)): | |
diff --git a/easybuild/framework/easyconfig/format/format.py b/easybuild/framework/easyconfig/format/format.py | |
index 0ac6c380f..61da07d20 100644 | |
--- a/easybuild/framework/easyconfig/format/format.py | |
+++ b/easybuild/framework/easyconfig/format/format.py | |
@@ -95,6 +95,7 @@ def get_format_version(txt): | |
class NestedDict(dict): | |
"""A nested dictionary, with tracking of depth and parent""" | |
+ | |
def __init__(self, parent, depth): | |
"""Initialise NestedDict instance""" | |
dict.__init__(self) | |
@@ -121,6 +122,7 @@ class NestedDict(dict): | |
class TopNestedDict(NestedDict): | |
"""The top level nested dictionary (depth 0, parent is itself)""" | |
+ | |
def __init__(self, parent=None, depth=None): | |
"""Initialise TopNestedDict instance""" | |
# parent and depth are ignored; just to support same init for copier | |
@@ -129,6 +131,7 @@ class TopNestedDict(NestedDict): | |
class Squashed(object): | |
"""Class to ease the squashing of OrderedVersionOperators and OrderedToolchainVersionOperators""" | |
+ | |
def __init__(self): | |
"""Initialise Squashed instance""" | |
self.log = fancylogger.getLogger(self.__class__.__name__, fname=False) | |
diff --git a/easybuild/framework/easyconfig/format/one.py b/easybuild/framework/easyconfig/format/one.py | |
index 853449729..7287ab0ed 100644 | |
--- a/easybuild/framework/easyconfig/format/one.py | |
+++ b/easybuild/framework/easyconfig/format/one.py | |
@@ -346,7 +346,7 @@ class FormatOneZero(EasyConfigFormatConfigObj): | |
'iterabove': {}, # comment above elements of iterable values | |
'iterinline': {}, # inline comments on elements of iterable values | |
'tail': [], # comment at the end of the easyconfig file | |
- } | |
+ } | |
parsed_ec = self.get_config_dict() | |
@@ -514,7 +514,7 @@ def retrieve_blocks_in_spec(spec, only_blocks, silent=False): | |
dep_block = reg_dep_block.search(block_contents) | |
if dep_block: | |
dependencies = eval(dep_block.group(1)) | |
- if type(dependencies) == list: | |
+ if isinstance(dependencies, list): | |
block['dependencies'] = dependencies | |
else: | |
block['dependencies'] = [dependencies] | |
diff --git a/easybuild/framework/easyconfig/format/pyheaderconfigobj.py b/easybuild/framework/easyconfig/format/pyheaderconfigobj.py | |
index 5f002de6f..1a3c86d1b 100644 | |
--- a/easybuild/framework/easyconfig/format/pyheaderconfigobj.py | |
+++ b/easybuild/framework/easyconfig/format/pyheaderconfigobj.py | |
@@ -128,8 +128,8 @@ class EasyConfigFormatConfigObj(EasyConfigFormat): | |
else: | |
start_section = reg.start() | |
last_n = 100 | |
- pre_section_tail = txt[start_section-last_n:start_section] | |
- sections_head = txt[start_section:start_section+last_n] | |
+ pre_section_tail = txt[start_section - last_n:start_section] | |
+ sections_head = txt[start_section:start_section + last_n] | |
self.log.debug('Sections start at index %s, %d-chars context:\n"""%s""""\n<split>\n"""%s..."""', | |
start_section, last_n, pre_section_tail, sections_head) | |
@@ -199,7 +199,7 @@ class EasyConfigFormatConfigObj(EasyConfigFormat): | |
exc_tb = sys.exc_info()[2] | |
if exc_tb.tb_next is not None: | |
err_msg += " (line %d)" % exc_tb.tb_next.tb_lineno | |
- raise EasyBuildError("Parsing easyconfig file failed: %s", err_msg) | |
+ raise EasyBuildError("Parsing easyconfig file failed: %s", err_msg) | |
self.log.debug("pyheader parsed cfg: %s", cfg) | |
diff --git a/easybuild/framework/easyconfig/format/yeb.py b/easybuild/framework/easyconfig/format/yeb.py | |
index 6215500f8..e75e136cd 100644 | |
--- a/easybuild/framework/easyconfig/format/yeb.py | |
+++ b/easybuild/framework/easyconfig/format/yeb.py | |
@@ -115,7 +115,7 @@ class FormatYeb(EasyConfigFormat): | |
yaml_header = [] | |
for i, line in enumerate(lines): | |
if line.startswith(YAML_DIR): | |
- if lines[i+1].startswith(YAML_SEP): | |
+ if lines[i + 1].startswith(YAML_SEP): | |
yaml_header.extend([lines.pop(i), lines.pop(i)]) | |
injected_constants = ['__CONSTANTS__: '] | |
diff --git a/easybuild/framework/easyconfig/style.py b/easybuild/framework/easyconfig/style.py | |
index 8adc85594..b4dc2c7d6 100644 | |
--- a/easybuild/framework/easyconfig/style.py | |
+++ b/easybuild/framework/easyconfig/style.py | |
@@ -82,7 +82,7 @@ def _eb_check_trailing_whitespace(physical_line, lines, line_number, checker_sta | |
https://pycodestyle.readthedocs.io/en/latest/developer.html#contribute | |
""" | |
# apparently this is not the same as physical_line line?! | |
- line = lines[line_number-1] | |
+ line = lines[line_number - 1] | |
if COMMENT_REGEX.match(line): | |
return None | |
diff --git a/easybuild/framework/easyconfig/tweak.py b/easybuild/framework/easyconfig/tweak.py | |
index 37403b352..34b1a9829 100644 | |
--- a/easybuild/framework/easyconfig/tweak.py | |
+++ b/easybuild/framework/easyconfig/tweak.py | |
@@ -264,6 +264,7 @@ def tweak_one(orig_ec, tweaked_ec, tweaks, targetdir=None): | |
class TcDict(dict): | |
"""A special dict class that represents trivial toolchains properly.""" | |
+ | |
def __repr__(self): | |
return "{'name': '%(name)s', 'version': '%(version)s'}" % self | |
@@ -612,7 +613,7 @@ def select_or_generate_ec(fp, paths, specs): | |
# if a value is specified, use that, even if it's not available yet | |
selected_val = val | |
# promote value to list if deemed appropriate | |
- if vals and type(vals[0]) == list and not type(val) == list: | |
+ if vals and isinstance(vals[0], list) and not isinstance(val, list): | |
_log.debug("Promoting type of %s value to list, since original value was." % param) | |
specs[param] = [val] | |
_log.debug("%s is specified, so using it (even though it's not available yet): %s" % (param, selected_val)) | |
diff --git a/easybuild/framework/extension.py b/easybuild/framework/extension.py | |
index b44d5759f..f99af4070 100644 | |
--- a/easybuild/framework/extension.py | |
+++ b/easybuild/framework/extension.py | |
@@ -85,6 +85,7 @@ class Extension(object): | |
""" | |
Support for installing extensions. | |
""" | |
+ | |
def __init__(self, mself, ext, extra_params=None): | |
""" | |
Constructor for Extension class | |
diff --git a/easybuild/scripts/bootstrap_eb.py b/easybuild/scripts/bootstrap_eb.py | |
index 2e8c487a2..f2140cd80 100644 | |
--- a/easybuild/scripts/bootstrap_eb.py | |
+++ b/easybuild/scripts/bootstrap_eb.py | |
@@ -625,7 +625,8 @@ def stage1(tmpdir, sourcepath, distribute_egg_dir, forcedversion): | |
# figure out EasyBuild version via eb command line | |
# note: EasyBuild uses some magic to determine the EasyBuild version based on the versions of the individual pkgs | |
- pattern = "This is EasyBuild (?P<version>%(v)s) \(framework: %(v)s, easyblocks: %(v)s\)" % {'v': '[0-9.]*[a-z0-9]*'} | |
+ pattern = r"This is EasyBuild (?P<version>%(v)s) \(framework: %(v)s, easyblocks: %(v)s\)" % { | |
+ 'v': '[0-9.]*[a-z0-9]*'} | |
version_re = re.compile(pattern) | |
version_out_file = os.path.join(tmpdir, 'eb_version.out') | |
eb_version_cmd = 'from easybuild.tools.version import this_is_easybuild; print(this_is_easybuild())' | |
diff --git a/easybuild/scripts/mk_tmpl_easyblock_for.py b/easybuild/scripts/mk_tmpl_easyblock_for.py | |
index 65a0bc13f..32ff59833 100644 | |
--- a/easybuild/scripts/mk_tmpl_easyblock_for.py | |
+++ b/easybuild/scripts/mk_tmpl_easyblock_for.py | |
@@ -46,7 +46,7 @@ parser.add_option("--parent", default="EasyBlock", | |
help="Name of parent easyblock for this easyblock (default: 'EasyBlock').") | |
parser.add_option("--letter-prefix", default=False, action="store_true", | |
help="Whether or not to prefix the easyblock path with a letter directory (default: False)") | |
- | |
+ | |
(options, args) = parser.parse_args() | |
@@ -68,7 +68,7 @@ if not os.path.isdir(easyblocks_repo_path): | |
# determine path for easyblock | |
if options.letter_prefix: | |
letter = name.lower()[0] | |
- if not ord(letter) in range(ord('a'),ord('z')+1): | |
+ if not ord(letter) in range(ord('a'), ord('z') + 1): | |
letter = '0' | |
easyblock_path = os.path.join(easyblocks_repo_path, letter, "%s.py" % name.lower()) | |
else: | |
@@ -147,8 +147,8 @@ class %(class_name)s(%(parent)s): | |
# always use env.setvar instead of os.putenv or os.environ for defining environment variables | |
env.setvar('CUSTOM_ENV_VAR', 'foo') | |
- | |
- cmd = "configure command" | |
+ | |
+ cmd = "configure command" | |
run_cmd(cmd, log_all=True, simple=True, log_ok=True) | |
# complete configuration with configure_method of parent | |
@@ -172,13 +172,13 @@ class %(class_name)s(%(parent)s): | |
\"\"\"Custom built-in test procedure for %(name)s.\"\"\" | |
if self.cfg['runtest']: | |
- cmd = "test-command" | |
+ cmd = "test-command" | |
run_cmd(cmd, simple=True, log_all=True, log_ok=True) | |
def install_step(self): | |
\"\"\"Custom install procedure for %(name)s.\"\"\" | |
- | |
- cmd = "install command" | |
+ | |
+ cmd = "install command" | |
run_cmd(cmd, log_all=True, simple=True, log_ok=True) | |
def sanity_check_step(self): | |
diff --git a/easybuild/toolchains/cgmpolf.py b/easybuild/toolchains/cgmpolf.py | |
index d0615734c..556e4efe9 100644 | |
--- a/easybuild/toolchains/cgmpolf.py | |
+++ b/easybuild/toolchains/cgmpolf.py | |
@@ -41,4 +41,3 @@ class Cgmpolf(Cgmpich, OpenBLAS, ScaLAPACK, Fftw): | |
"""Compiler toolchain with Clang, GFortran, MPICH, OpenBLAS, ScaLAPACK and FFTW.""" | |
NAME = 'cgmpolf' | |
SUBTOOLCHAIN = Cgmpich.NAME | |
- | |
diff --git a/easybuild/toolchains/compiler/clang.py b/easybuild/toolchains/compiler/clang.py | |
index cbf5aaa5a..97aa22b95 100644 | |
--- a/easybuild/toolchains/compiler/clang.py | |
+++ b/easybuild/toolchains/compiler/clang.py | |
@@ -43,7 +43,7 @@ class Clang(Compiler): | |
"""Clang compiler class""" | |
COMPILER_MODULE_NAME = ['Clang'] | |
- | |
+ | |
COMPILER_FAMILY = TC_CONSTANT_CLANG | |
# Don't set COMPILER_FAMILY in this class because Clang does not have | |
@@ -58,10 +58,10 @@ class Clang(Compiler): | |
'unroll': 'funroll-loops', | |
'loop-vectorize': ['fvectorize'], | |
'basic-block-vectorize': ['fslp-vectorize'], | |
- 'optarch':'march=native', | |
+ 'optarch': 'march=native', | |
# Clang's options do not map well onto these precision modes. The flags enable and disable certain classes of | |
# optimizations. | |
- # | |
+ # | |
# -fassociative-math: allow re-association of operands in series of floating-point operations, violates the | |
# ISO C and C++ language standard by possibly changing computation result. | |
# -freciprocal-math: allow optimizations to use the reciprocal of an argument rather than perform division. | |
@@ -114,4 +114,3 @@ class Clang(Compiler): | |
if self.options.get('32bit', None): | |
raise EasyBuildError("_set_compiler_vars: 32bit set, but no support yet for 32bit Clang in EasyBuild") | |
- | |
diff --git a/easybuild/toolchains/compiler/cuda.py b/easybuild/toolchains/compiler/cuda.py | |
index 6bfcdfa14..2fc19459f 100644 | |
--- a/easybuild/toolchains/compiler/cuda.py | |
+++ b/easybuild/toolchains/compiler/cuda.py | |
@@ -45,7 +45,7 @@ class Cuda(Compiler): | |
COMPILER_CUDA_FAMILY = TC_CONSTANT_CUDA | |
COMPILER_CUDA_UNIQUE_OPTS = { | |
- # handle '-gencode arch=X,code=Y' nvcc options (also -arch, -code) | |
+ # handle '-gencode arch=X,code=Y' nvcc options (also -arch, -code) | |
# -arch always needs to be specified, -code is optional (defaults to -arch if missing) | |
# -gencode is syntactic sugar for combining -arch/-code | |
# multiple values can be specified | |
@@ -87,7 +87,7 @@ class Cuda(Compiler): | |
# always C++ compiler flags, even for C! | |
# note: using $LIBS will yield the use of -lcudart in Xlinker, which is silly, but fine | |
- | |
+ | |
cuda_flags = [ | |
'Xcompiler="%s"' % str(self.variables['CXXFLAGS']), | |
'Xlinker="%s %s"' % (str(self.variables['LDFLAGS']), str(self.variables['LIBS'])), | |
diff --git a/easybuild/toolchains/compiler/gcc.py b/easybuild/toolchains/compiler/gcc.py | |
index dacecd3b1..8ec1ce2af 100644 | |
--- a/easybuild/toolchains/compiler/gcc.py | |
+++ b/easybuild/toolchains/compiler/gcc.py | |
@@ -50,7 +50,7 @@ class Gcc(Compiler): | |
COMPILER_UNIQUE_OPTS = { | |
'loop': (False, "Automatic loop parallellisation"), | |
'f2c': (False, "Generate code compatible with f2c and f77"), | |
- 'lto':(False, "Enable Link Time Optimization"), | |
+ 'lto': (False, "Enable Link Time Optimization"), | |
} | |
COMPILER_UNIQUE_OPTION_MAP = { | |
'i8': 'fdefault-integer-8', | |
@@ -71,16 +71,17 @@ class Gcc(Compiler): | |
# used when 'optarch' toolchain option is enabled (and --optarch is not specified) | |
COMPILER_OPTIMAL_ARCHITECTURE_OPTION = { | |
- (systemtools.AARCH32, systemtools.ARM): 'mcpu=native', # implies -march=native and -mtune=native | |
- (systemtools.AARCH64, systemtools.ARM): 'mcpu=native', # since GCC 6; implies -march=native and -mtune=native | |
+ (systemtools.AARCH32, systemtools.ARM): 'mcpu=native', # implies -march=native and -mtune=native | |
+ (systemtools.AARCH64, systemtools.ARM): 'mcpu=native', # since GCC 6; implies -march=native and -mtune=native | |
(systemtools.POWER, systemtools.POWER): 'mcpu=native', # no support for -march on POWER; implies -mtune=native | |
- (systemtools.POWER, systemtools.POWER_LE): 'mcpu=native', # no support for -march on POWER; implies -mtune=native | |
- (systemtools.X86_64, systemtools.AMD): 'march=native', # implies -mtune=native | |
- (systemtools.X86_64, systemtools.INTEL): 'march=native', # implies -mtune=native | |
+ # no support for -march on POWER; implies -mtune=native | |
+ (systemtools.POWER, systemtools.POWER_LE): 'mcpu=native', | |
+ (systemtools.X86_64, systemtools.AMD): 'march=native', # implies -mtune=native | |
+ (systemtools.X86_64, systemtools.INTEL): 'march=native', # implies -mtune=native | |
} | |
# used with --optarch=GENERIC | |
COMPILER_GENERIC_OPTION = { | |
- (systemtools.AARCH32, systemtools.ARM): 'mcpu=generic-armv7', # implies -march=armv7 and -mtune=generic-armv7 | |
+ (systemtools.AARCH32, systemtools.ARM): 'mcpu=generic-armv7', # implies -march=armv7 and -mtune=generic-armv7 | |
(systemtools.AARCH64, systemtools.ARM): 'mcpu=generic', # implies -march=armv8-a and -mtune=generic | |
(systemtools.POWER, systemtools.POWER): 'mcpu=powerpc64', # no support for -march on POWER | |
(systemtools.POWER, systemtools.POWER_LE): 'mcpu=powerpc64le', # no support for -march on POWER | |
@@ -157,7 +158,7 @@ class Gcc(Compiler): | |
core_types = [] | |
for core_type in [ct.strip().lower() for ct in cpu_model[4:].split('+')]: | |
# Determine numeric ID for each core type, since we need to sort them later numerically | |
- res = re.search('\d+$', core_type) # note: numeric ID is expected at the end | |
+ res = re.search(r'\d+$', core_type) # note: numeric ID is expected at the end | |
if res: | |
core_id = int(res.group(0)) | |
core_types.append((core_id, core_type)) | |
diff --git a/easybuild/toolchains/compiler/inteliccifort.py b/easybuild/toolchains/compiler/inteliccifort.py | |
index 9978bd729..7ab1b7868 100644 | |
--- a/easybuild/toolchains/compiler/inteliccifort.py | |
+++ b/easybuild/toolchains/compiler/inteliccifort.py | |
@@ -92,7 +92,7 @@ class IntelIccIfort(Compiler): | |
LINKER_TOGGLE_STATIC_DYNAMIC = { | |
'static': '-Bstatic', | |
- 'dynamic':'-Bdynamic', | |
+ 'dynamic': '-Bdynamic', | |
} | |
LIB_MULTITHREAD = ['iomp5', 'pthread'] # iomp5 is OpenMP related | |
diff --git a/easybuild/toolchains/compiler/pgi.py b/easybuild/toolchains/compiler/pgi.py | |
index 38b51f274..06b2efa95 100644 | |
--- a/easybuild/toolchains/compiler/pgi.py | |
+++ b/easybuild/toolchains/compiler/pgi.py | |
@@ -58,10 +58,10 @@ class Pgi(Compiler): | |
COMPILER_UNIQUE_OPTION_MAP = { | |
'i8': 'i8', | |
'r8': 'r8', | |
- 'optarch': '', # PGI by default generates code for the arch it is running on! | |
+ 'optarch': '', # PGI by default generates code for the arch it is running on! | |
'openmp': 'mp', | |
'ieee': 'Kieee', | |
- 'strict': ['Mnoflushz','Kieee'], | |
+ 'strict': ['Mnoflushz', 'Kieee'], | |
'precise': ['Mnoflushz'], | |
'defaultprec': ['Mflushz'], | |
'loose': ['Mfprelaxed'], | |
@@ -90,7 +90,7 @@ class Pgi(Compiler): | |
LINKER_TOGGLE_STATIC_DYNAMIC = { | |
'static': '-Bstatic', | |
- 'dynamic':'-Bdynamic', | |
+ 'dynamic': '-Bdynamic', | |
} | |
def _set_compiler_flags(self): | |
diff --git a/easybuild/toolchains/fft/fftw.py b/easybuild/toolchains/fft/fftw.py | |
index cbaa36f8b..6b2523895 100644 | |
--- a/easybuild/toolchains/fft/fftw.py | |
+++ b/easybuild/toolchains/fft/fftw.py | |
@@ -65,7 +65,7 @@ class Fftw(Fft): | |
super(Fftw, self)._set_fft_variables() | |
- ## TODO can these be replaced with the FFT ones? | |
+ # TODO can these be replaced with the FFT ones? | |
self.variables.join('FFTW_INC_DIR', 'FFT_INC_DIR') | |
self.variables.join('FFTW_LIB_DIR', 'FFT_LIB_DIR') | |
if 'FFT_STATIC_LIBS' in self.variables: | |
diff --git a/easybuild/toolchains/giolfc.py b/easybuild/toolchains/giolfc.py | |
index d367136ca..a7fae239f 100644 | |
--- a/easybuild/toolchains/giolfc.py | |
+++ b/easybuild/toolchains/giolfc.py | |
@@ -35,8 +35,8 @@ from easybuild.toolchains.fft.fftw import Fftw | |
from easybuild.toolchains.linalg.openblas import OpenBLAS | |
from easybuild.toolchains.linalg.scalapack import ScaLAPACK | |
+ | |
class Giolfc(Gimpic, OpenBLAS, ScaLAPACK, Fftw): | |
"""Compiler toolchain with GCC+CUDA, IntelMPI, OpenBLAS, ScaLAPACK and FFTW.""" | |
NAME = 'giolfc' | |
SUBTOOLCHAIN = [Gimpic.NAME, Golfc.NAME] | |
- | |
diff --git a/easybuild/toolchains/gmacml.py b/easybuild/toolchains/gmacml.py | |
index 0aa383607..29ebd846f 100644 | |
--- a/easybuild/toolchains/gmacml.py | |
+++ b/easybuild/toolchains/gmacml.py | |
@@ -34,7 +34,6 @@ from easybuild.toolchains.linalg.acml import Acml | |
from easybuild.toolchains.linalg.scalapack import ScaLAPACK | |
- | |
class Gmacml(Gmvapich2, Acml, ScaLAPACK, Fftw): | |
"""Compiler toolchain with GCC, MVAPICH2, ACML, ScaLAPACK and FFTW.""" | |
NAME = 'gmacml' | |
diff --git a/easybuild/toolchains/gsolf.py b/easybuild/toolchains/gsolf.py | |
index 342ead223..7b0703f57 100644 | |
--- a/easybuild/toolchains/gsolf.py | |
+++ b/easybuild/toolchains/gsolf.py | |
@@ -35,6 +35,7 @@ from easybuild.toolchains.fft.fftw import Fftw | |
from easybuild.toolchains.linalg.openblas import OpenBLAS | |
from easybuild.toolchains.linalg.scalapack import ScaLAPACK | |
+ | |
class Gsolf(Gsmpi, OpenBLAS, ScaLAPACK, Fftw): | |
"""Compiler toolchain with GCC, SpectrumMPI, OpenBLAS, ScaLAPACK and FFTW.""" | |
NAME = 'gsolf' | |
diff --git a/easybuild/toolchains/impmkl.py b/easybuild/toolchains/impmkl.py | |
index dd6a150da..d82aa7f2d 100644 | |
--- a/easybuild/toolchains/impmkl.py | |
+++ b/easybuild/toolchains/impmkl.py | |
@@ -34,6 +34,7 @@ from easybuild.toolchains.iimkl import Iimkl | |
from easybuild.toolchains.fft.intelfftw import IntelFFTW | |
from easybuild.toolchains.linalg.intelmkl import IntelMKL | |
+ | |
class Impmkl(Impich, IntelMKL, IntelFFTW): | |
""" | |
Compiler toolchain with Intel compilers (icc/ifort), MPICH, | |
diff --git a/easybuild/toolchains/linalg/acml.py b/easybuild/toolchains/linalg/acml.py | |
index 6d3f682da..c34498f47 100644 | |
--- a/easybuild/toolchains/linalg/acml.py | |
+++ b/easybuild/toolchains/linalg/acml.py | |
@@ -80,7 +80,7 @@ class Acml(LinAlg): | |
self.variables.append_exists('LDFLAGS', root, self.BLAS_LIB_DIR, append_all=True) | |
incdirs = [os.path.join(x, 'include') for x in subdirs] | |
self.variables.append_exists('CPPFLAGS', root, incdirs, append_all=True) | |
- except: | |
+ except BaseException: | |
raise EasyBuildError("_set_blas_variables: ACML set LDFLAGS/CPPFLAGS unknown entry in ACML_SUBDIRS_MAP " | |
"with compiler family %s", self.COMPILER_FAMILY) | |
@@ -91,4 +91,3 @@ class Acml(LinAlg): | |
self.BLAS_LIB_MT.insert(0, "acml_mv") | |
super(Acml, self)._set_blas_variables() | |
- | |
diff --git a/easybuild/toolchains/linalg/blacs.py b/easybuild/toolchains/linalg/blacs.py | |
index 599cede4e..2aca00295 100644 | |
--- a/easybuild/toolchains/linalg/blacs.py | |
+++ b/easybuild/toolchains/linalg/blacs.py | |
@@ -44,4 +44,3 @@ class Blacs(LinAlg): | |
"""Skip setting BLACS variables if it is not required (e.g., with recent ScaLAPACK versions).""" | |
if self.is_required(self.BLACS_MODULE_NAME[0]): | |
super(Blacs, self)._set_blacs_variables() | |
- | |
diff --git a/easybuild/toolchains/linalg/intelmkl.py b/easybuild/toolchains/linalg/intelmkl.py | |
index ed1129688..7877cbf11 100644 | |
--- a/easybuild/toolchains/linalg/intelmkl.py | |
+++ b/easybuild/toolchains/linalg/intelmkl.py | |
@@ -55,8 +55,8 @@ class IntelMKL(LinAlg): | |
"interface": None, | |
"interface_mt": None, | |
} | |
- BLAS_LIB = ["mkl_%(interface)s%(lp64)s" , "mkl_sequential", "mkl_core"] | |
- BLAS_LIB_MT = ["mkl_%(interface)s%(lp64)s" , "mkl_%(interface_mt)s_thread", "mkl_core"] | |
+ BLAS_LIB = ["mkl_%(interface)s%(lp64)s", "mkl_sequential", "mkl_core"] | |
+ BLAS_LIB_MT = ["mkl_%(interface)s%(lp64)s", "mkl_%(interface_mt)s_thread", "mkl_core"] | |
BLAS_LIB_GROUP = True | |
BLAS_LIB_STATIC = True | |
BLAS_FAMILY = TC_CONSTANT_INTELMKL | |
@@ -67,7 +67,7 @@ class IntelMKL(LinAlg): | |
BLACS_MODULE_NAME = ['imkl'] | |
BLACS_LIB = ["mkl_blacs%(mpi)s%(lp64)s"] | |
- BLACS_LIB_MAP = {'mpi':None} | |
+ BLACS_LIB_MAP = {'mpi': None} | |
BLACS_LIB_GROUP = True | |
BLACS_LIB_STATIC = True | |
@@ -114,7 +114,7 @@ class IntelMKL(LinAlg): | |
self.BLAS_LIB_MAP.update({ | |
"interface": interfacemap[self.COMPILER_FAMILY], | |
}) | |
- except: | |
+ except BaseException: | |
raise EasyBuildError("_set_blas_variables: interface unsupported combination with MPI family %s", | |
self.COMPILER_FAMILY) | |
@@ -124,18 +124,17 @@ class IntelMKL(LinAlg): | |
TC_CONSTANT_PGI: 'pgi', | |
} | |
try: | |
- self.BLAS_LIB_MAP.update({"interface_mt":interfacemap_mt[self.COMPILER_FAMILY]}) | |
- except: | |
+ self.BLAS_LIB_MAP.update({"interface_mt": interfacemap_mt[self.COMPILER_FAMILY]}) | |
+ except BaseException: | |
raise EasyBuildError("_set_blas_variables: interface_mt unsupported combination with compiler family %s", | |
self.COMPILER_FAMILY) | |
- | |
if self.options.get('32bit', None): | |
# 32bit | |
- self.BLAS_LIB_MAP.update({"lp64":''}) | |
+ self.BLAS_LIB_MAP.update({"lp64": ''}) | |
if self.options.get('i8', None): | |
# ilp64/i8 | |
- self.BLAS_LIB_MAP.update({"lp64":'_ilp64'}) | |
+ self.BLAS_LIB_MAP.update({"lp64": '_ilp64'}) | |
# CPP / CFLAGS | |
self.variables.nappend_el('CFLAGS', 'DMKL_ILP64') | |
@@ -176,7 +175,7 @@ class IntelMKL(LinAlg): | |
} | |
try: | |
self.BLACS_LIB_MAP.update({'mpi': mpimap[self.MPI_FAMILY]}) | |
- except: | |
+ except BaseException: | |
raise EasyBuildError("_set_blacs_variables: mpi unsupported combination with MPI family %s", | |
self.MPI_FAMILY) | |
@@ -193,11 +192,11 @@ class IntelMKL(LinAlg): | |
if self.options.get('32bit', None): | |
# 32 bit | |
- self.SCALAPACK_LIB_MAP.update({"lp64_sc":'_core'}) | |
+ self.SCALAPACK_LIB_MAP.update({"lp64_sc": '_core'}) | |
elif self.options.get('i8', None): | |
# ilp64/i8 | |
- self.SCALAPACK_LIB_MAP.update({"lp64_sc":'_ilp64'}) | |
+ self.SCALAPACK_LIB_MAP.update({"lp64_sc": '_ilp64'}) | |
self.SCALAPACK_LIB_DIR = self.BLAS_LIB_DIR | |
self.SCALAPACK_INCLUDE_DIR = self.BLAS_INCLUDE_DIR | |
diff --git a/easybuild/toolchains/mpi/craympich.py b/easybuild/toolchains/mpi/craympich.py | |
index cf3223745..eea99f495 100644 | |
--- a/easybuild/toolchains/mpi/craympich.py | |
+++ b/easybuild/toolchains/mpi/craympich.py | |
@@ -57,7 +57,7 @@ class CrayMPICH(Mpi): | |
"""Set the MPI compiler variables""" | |
for var_tuple in COMPILER_VARIABLES: | |
c_var = var_tuple[0] # [1] is the description | |
- var = MPI_COMPILER_TEMPLATE % {'c_var':c_var} | |
+ var = MPI_COMPILER_TEMPLATE % {'c_var': c_var} | |
value = getattr(self, 'MPI_COMPILER_%s' % var.upper(), None) | |
if value is None: | |
diff --git a/easybuild/toolchains/mpi/mpich2.py b/easybuild/toolchains/mpi/mpich2.py | |
index 113d859fb..ae1cceaf2 100644 | |
--- a/easybuild/toolchains/mpi/mpich2.py | |
+++ b/easybuild/toolchains/mpi/mpich2.py | |
@@ -45,7 +45,7 @@ class Mpich2(Mpich): | |
def _set_mpi_compiler_variables(self): | |
"""Set the MPICH_{CC, CXX, F77, F90, FC} variables.""" | |
- # C/CXX commands are set by the parent or child classes | |
+ # C/CXX commands are set by the parent or child classes | |
if self.MPI_COMPILER_MPIF77 is None and self.MPI_COMPILER_MPIF90 is None and self.MPI_COMPILER_MPIFC is None: | |
# hardwire MPI wrapper commands (otherwise Mpich parent class sets them based on MPICH version) | |
diff --git a/easybuild/tools/asyncprocess.py b/easybuild/tools/asyncprocess.py | |
index 17e7e132e..bcab27bc8 100644 | |
--- a/easybuild/tools/asyncprocess.py | |
+++ b/easybuild/tools/asyncprocess.py | |
@@ -65,6 +65,8 @@ and the methods will return None. | |
:author: Jens Timmerman (Ghent University) | |
""" | |
+import fcntl # @UnresolvedImport | |
+import select # @UnresolvedImport | |
import errno | |
import os | |
import subprocess | |
@@ -73,9 +75,6 @@ import time | |
PIPE = subprocess.PIPE | |
STDOUT = subprocess.STDOUT | |
-import select #@UnresolvedImport | |
-import fcntl #@UnresolvedImport | |
- | |
class Popen(subprocess.Popen): | |
@@ -117,7 +116,7 @@ class Popen(subprocess.Popen): | |
try: | |
written = os.write(self.stdin.fileno(), inp.encode()) | |
except OSError as why: | |
- if why[0] == errno.EPIPE: #broken pipe | |
+ if why[0] == errno.EPIPE: # broken pipe | |
return self._close('stdin') | |
raise | |
@@ -147,8 +146,10 @@ class Popen(subprocess.Popen): | |
if not conn.closed: | |
fcntl.fcntl(conn, fcntl.F_SETFL, flags) | |
+ | |
message = "Other end disconnected!" | |
+ | |
def recv_some(p, t=.2, e=1, tr=5, stderr=0): | |
if tr < 1: | |
tr = 1 | |
@@ -171,6 +172,7 @@ def recv_some(p, t=.2, e=1, tr=5, stderr=0): | |
time.sleep(max((x - time.time()) / tr, 0)) | |
return b''.join(y) | |
+ | |
def send_all(p, data): | |
while len(data): | |
sent = p.send(data) | |
diff --git a/easybuild/tools/configobj.py b/easybuild/tools/configobj.py | |
index f96c404ac..e29b698be 100644 | |
--- a/easybuild/tools/configobj.py | |
+++ b/easybuild/tools/configobj.py | |
@@ -41,7 +41,7 @@ BOMS = { | |
BOM_UTF16_BE: ('utf16_be', 'utf_16'), | |
BOM_UTF16_LE: ('utf16_le', 'utf_16'), | |
BOM_UTF16: ('utf_16', 'utf_16'), | |
- } | |
+} | |
# All legal variants of the BOM codecs. | |
# TODO: the list of aliases is not meant to be exhaustive, is there a | |
# better way ? | |
@@ -61,7 +61,7 @@ BOM_LIST = { | |
'utf': 'utf_8', | |
'utf8': 'utf_8', | |
'utf-8': 'utf_8', | |
- } | |
+} | |
# Map of encodings to the BOM to write. | |
BOM_SET = { | |
@@ -70,7 +70,7 @@ BOM_SET = { | |
'utf16_be': BOM_UTF16_BE, | |
'utf16_le': BOM_UTF16_LE, | |
None: BOM_UTF8 | |
- } | |
+} | |
def match_utf8(encoding): | |
@@ -143,7 +143,6 @@ OPTION_DEFAULTS = { | |
} | |
- | |
def getObj(s): | |
global compiler | |
if compiler is None: | |
@@ -222,12 +221,12 @@ def unrepr(s): | |
return _builder.build(getObj(s)) | |
- | |
class ConfigObjError(SyntaxError): | |
""" | |
This is the base class for all errors that ConfigObj raises. | |
It is a subclass of SyntaxError. | |
""" | |
+ | |
def __init__(self, message='', line_number=None, line=''): | |
self.line = line | |
self.line_number = line_number | |
@@ -253,6 +252,7 @@ class ReloadError(IOError): | |
A 'reload' operation failed. | |
This exception is a subclass of ``IOError``. | |
""" | |
+ | |
def __init__(self): | |
IOError.__init__(self, 'reload failed, filename is not set.') | |
@@ -291,6 +291,7 @@ class RepeatSectionError(ConfigObjError): | |
class MissingInterpolationOption(InterpolationError): | |
"""A value specified for interpolation was missing.""" | |
+ | |
def __init__(self, option): | |
msg = 'missing option "%s" in interpolation.' % option | |
InterpolationError.__init__(self, msg) | |
@@ -300,7 +301,6 @@ class UnreprError(ConfigObjError): | |
"""An error parsing in unrepr mode.""" | |
- | |
class InterpolationEngine(object): | |
""" | |
A helper class to help perform string interpolation. | |
@@ -317,10 +317,9 @@ class InterpolationEngine(object): | |
# the Section instance that "owns" this engine | |
self.section = section | |
- | |
def interpolate(self, key, value): | |
# short-cut | |
- if not self._cookie in value: | |
+ if self._cookie not in value: | |
return value | |
def recursive_interpolate(key, value, section, backtrail): | |
@@ -370,7 +369,6 @@ class InterpolationEngine(object): | |
value = recursive_interpolate(key, value, self.section, {}) | |
return value | |
- | |
def _fetch(self, key): | |
"""Helper function to fetch values from owning section. | |
@@ -404,7 +402,6 @@ class InterpolationEngine(object): | |
raise MissingInterpolationOption(key) | |
return val, current_section | |
- | |
def _parse_match(self, match): | |
"""Implementation-dependent helper function. | |
@@ -424,7 +421,6 @@ class InterpolationEngine(object): | |
raise NotImplementedError() | |
- | |
class ConfigParserInterpolation(InterpolationEngine): | |
"""Behaves like ConfigParser.""" | |
_cookie = '%' | |
@@ -436,7 +432,6 @@ class ConfigParserInterpolation(InterpolationEngine): | |
return key, value, section | |
- | |
class TemplateInterpolation(InterpolationEngine): | |
"""Behaves like string.Template.""" | |
_cookie = '$' | |
@@ -473,6 +468,7 @@ def __newobj__(cls, *args): | |
# Hack for pickle | |
return cls.__new__(cls, *args) | |
+ | |
class Section(dict): | |
""" | |
A dictionary-like object that represents a section in a config file. | |
@@ -491,7 +487,6 @@ class Section(dict): | |
Iteration follows the order: scalars, then sections. | |
""" | |
- | |
def __setstate__(self, state): | |
dict.update(self, state[0]) | |
self.__dict__.update(state[1]) | |
@@ -500,7 +495,6 @@ class Section(dict): | |
state = (dict(self), self.__dict__) | |
return (__newobj__, (self.__class__,), state) | |
- | |
def __init__(self, parent, depth, main, indict=None, name=None): | |
""" | |
* parent is the section above | |
@@ -542,7 +536,6 @@ class Section(dict): | |
self.extra_values = [] | |
self._created = False | |
- | |
def _interpolate(self, key, value): | |
try: | |
# do we already have an interpolation engine? | |
@@ -550,7 +543,7 @@ class Section(dict): | |
except AttributeError: | |
# not yet: first time running _interpolate(), so pick the engine | |
name = self.main.interpolation | |
- if name == True: # note that "if name:" would be incorrect here | |
+ if name: # note that "if name:" would be incorrect here | |
# backwards-compatibility: interpolation=True means use default | |
name = DEFAULT_INTERPOLATION | |
name = name.lower() # so that "Template", "template", etc. all work | |
@@ -565,7 +558,6 @@ class Section(dict): | |
# let the engine do the actual work | |
return engine.interpolate(key, value) | |
- | |
def __getitem__(self, key): | |
"""Fetch the item and do string interpolation.""" | |
val = dict.__getitem__(self, key) | |
@@ -582,7 +574,6 @@ class Section(dict): | |
return new | |
return val | |
- | |
def __setitem__(self, key, value, unrepr=False): | |
""" | |
Correctly set a value. | |
@@ -641,7 +632,6 @@ class Section(dict): | |
raise TypeError('Value is not a string "%s".' % value) | |
dict.__setitem__(self, key, value) | |
- | |
def __delitem__(self, key): | |
"""Remove items from the sequence when deleting.""" | |
dict. __delitem__(self, key) | |
@@ -652,7 +642,6 @@ class Section(dict): | |
del self.comments[key] | |
del self.inline_comments[key] | |
- | |
def get(self, key, default=None): | |
"""A version of ``get`` that doesn't bypass string interpolation.""" | |
try: | |
@@ -660,7 +649,6 @@ class Section(dict): | |
except KeyError: | |
return default | |
- | |
def update(self, indict): | |
""" | |
A version of update that uses our ``__setitem__``. | |
@@ -668,7 +656,6 @@ class Section(dict): | |
for entry in indict: | |
self[entry] = indict[entry] | |
- | |
def pop(self, key, default=MISSING): | |
""" | |
'D.pop(k[,d]) -> v, remove specified key and return the corresponding value. | |
@@ -684,7 +671,6 @@ class Section(dict): | |
del self[key] | |
return val | |
- | |
def popitem(self): | |
"""Pops the first (key,val)""" | |
sequence = (self.scalars + self.sections) | |
@@ -695,7 +681,6 @@ class Section(dict): | |
del self[key] | |
return key, val | |
- | |
def clear(self): | |
""" | |
A version of clear that also affects scalars/sections | |
@@ -713,7 +698,6 @@ class Section(dict): | |
self.defaults = [] | |
self.extra_values = [] | |
- | |
def setdefault(self, key, default=None): | |
"""A version of setdefault that sets sequence if appropriate.""" | |
try: | |
@@ -722,39 +706,32 @@ class Section(dict): | |
self[key] = default | |
return self[key] | |
- | |
def items(self): | |
"""D.items() -> list of D's (key, value) pairs, as 2-tuples""" | |
return zip((self.scalars + self.sections), self.values()) | |
- | |
def keys(self): | |
"""D.keys() -> list of D's keys""" | |
return (self.scalars + self.sections) | |
- | |
def values(self): | |
"""D.values() -> list of D's values""" | |
return [self[key] for key in (self.scalars + self.sections)] | |
- | |
def iteritems(self): | |
"""D.iteritems() -> an iterator over the (key, value) items of D""" | |
return iter(self.items()) | |
- | |
def iterkeys(self): | |
"""D.iterkeys() -> an iterator over the keys of D""" | |
return iter((self.scalars + self.sections)) | |
__iter__ = iterkeys | |
- | |
def itervalues(self): | |
"""D.itervalues() -> an iterator over the values of D""" | |
return iter(self.values()) | |
- | |
def __repr__(self): | |
"""x.__repr__() <==> repr(x)""" | |
def _getval(key): | |
@@ -763,12 +740,11 @@ class Section(dict): | |
except MissingInterpolationOption: | |
return dict.__getitem__(self, key) | |
return '{%s}' % ', '.join([('%s: %s' % (repr(key), repr(_getval(key)))) | |
- for key in (self.scalars + self.sections)]) | |
+ for key in (self.scalars + self.sections)]) | |
__str__ = __repr__ | |
__str__.__doc__ = "x.__str__() <==> str(x)" | |
- | |
# Extra methods - not in a normal dictionary | |
def dict(self): | |
@@ -798,7 +774,6 @@ class Section(dict): | |
newdict[entry] = this_entry | |
return newdict | |
- | |
def merge(self, indict): | |
""" | |
A recursive update - useful for merging config files. | |
@@ -820,12 +795,11 @@ class Section(dict): | |
""" | |
for key, val in indict.items(): | |
if (key in self and isinstance(self[key], dict) and | |
- isinstance(val, dict)): | |
+ isinstance(val, dict)): | |
self[key].merge(val) | |
else: | |
self[key] = val | |
- | |
def rename(self, oldkey, newkey): | |
""" | |
Change a keyname to another, without changing position in sequence. | |
@@ -855,9 +829,8 @@ class Section(dict): | |
self.comments[newkey] = comm | |
self.inline_comments[newkey] = inline_comment | |
- | |
def walk(self, function, raise_errors=True, | |
- call_on_sections=False, **keywargs): | |
+ call_on_sections=False, **keywargs): | |
""" | |
Walk every member and call a function on the keyword and value. | |
@@ -940,7 +913,6 @@ class Section(dict): | |
**keywargs) | |
return out | |
- | |
def as_bool(self, key): | |
""" | |
Accepts a key as input. The corresponding value must be a string or | |
@@ -970,7 +942,7 @@ class Section(dict): | |
0 | |
""" | |
val = self[key] | |
- if val == True: | |
+ if val: | |
return True | |
elif val == False: | |
return False | |
@@ -984,7 +956,6 @@ class Section(dict): | |
except KeyError: | |
raise ValueError('Value "%s" is neither True nor False' % val) | |
- | |
def as_int(self, key): | |
""" | |
A convenience method which coerces the specified value to an integer. | |
@@ -1007,7 +978,6 @@ class Section(dict): | |
""" | |
return int(self[key]) | |
- | |
def as_float(self, key): | |
""" | |
A convenience method which coerces the specified value to a float. | |
@@ -1029,7 +999,6 @@ class Section(dict): | |
""" | |
return float(self[key]) | |
- | |
def as_list(self, key): | |
""" | |
A convenience method which fetches the specified value, guaranteeing | |
@@ -1051,7 +1020,6 @@ class Section(dict): | |
return list(result) | |
return [result] | |
- | |
def restore_default(self, key): | |
""" | |
Restore (and return) default value for the specified key. | |
@@ -1067,7 +1035,6 @@ class Section(dict): | |
self.defaults.append(key) | |
return default | |
- | |
def restore_defaults(self): | |
""" | |
Recursively restore default values to all members | |
@@ -1099,7 +1066,7 @@ class ConfigObj(Section): | |
(.*) # value (including list values and comments) | |
$ # line end | |
''', | |
- re.VERBOSE) | |
+ re.VERBOSE) | |
_sectionmarker = re.compile(r'''^ | |
(\s*) # 1: indentation | |
@@ -1112,7 +1079,7 @@ class ConfigObj(Section): | |
((?:\s*\])+) # 4: section marker close | |
\s*(\#.*)? # 5: optional comment | |
$''', | |
- re.VERBOSE) | |
+ re.VERBOSE) | |
# this regexp pulls list values out as a single string | |
# or single values and comments | |
@@ -1142,7 +1109,7 @@ class ConfigObj(Section): | |
) | |
\s*(\#.*)? # optional comment | |
$''', | |
- re.VERBOSE) | |
+ re.VERBOSE) | |
# use findall to get the members of a list value | |
_listvalueexp = re.compile(r''' | |
@@ -1153,7 +1120,7 @@ class ConfigObj(Section): | |
) | |
\s*,\s* # comma | |
''', | |
- re.VERBOSE) | |
+ re.VERBOSE) | |
# this regexp is used for the value | |
# when lists are switched off | |
@@ -1166,7 +1133,7 @@ class ConfigObj(Section): | |
) | |
\s*(\#.*)? # optional comment | |
$''', | |
- re.VERBOSE) | |
+ re.VERBOSE) | |
# regexes for finding triple quoted values on one line | |
_single_line_single = re.compile(r"^'''(.*?)'''\s*(#.*)?$") | |
@@ -1185,8 +1152,7 @@ class ConfigObj(Section): | |
'on': True, 'off': False, | |
'1': True, '0': False, | |
'true': True, 'false': False, | |
- } | |
- | |
+ } | |
def __init__(self, infile=None, options=None, configspec=None, encoding=None, | |
interpolation=True, raise_errors=False, list_values=True, | |
@@ -1245,7 +1211,6 @@ class ConfigObj(Section): | |
self._original_configspec = configspec | |
self._load(infile, configspec) | |
- | |
def _load(self, infile, configspec): | |
if isinstance(infile, string_type): | |
self.filename = infile | |
@@ -1342,7 +1307,6 @@ class ConfigObj(Section): | |
else: | |
self._handle_configspec(configspec) | |
- | |
def _initialise(self, options=None): | |
if options is None: | |
options = OPTION_DEFAULTS | |
@@ -1374,7 +1338,6 @@ class ConfigObj(Section): | |
# Clear section attributes as well | |
Section._initialise(self) | |
- | |
def __repr__(self): | |
def _getval(key): | |
try: | |
@@ -1383,8 +1346,7 @@ class ConfigObj(Section): | |
return dict.__getitem__(self, key) | |
return ('ConfigObj({%s})' % | |
', '.join([('%s: %s' % (repr(key), repr(_getval(key)))) | |
- for key in (self.scalars + self.sections)])) | |
- | |
+ for key in (self.scalars + self.sections)])) | |
def _handle_bom(self, infile): | |
""" | |
@@ -1409,7 +1371,7 @@ class ConfigObj(Section): | |
passed in as a single string. | |
""" | |
if ((self.encoding is not None) and | |
- (self.encoding.lower() not in BOM_LIST)): | |
+ (self.encoding.lower() not in BOM_LIST)): | |
# No need to check for a BOM | |
# the encoding specified doesn't have one | |
# just decode | |
@@ -1486,7 +1448,6 @@ class ConfigObj(Section): | |
return infile.splitlines(True) | |
return infile | |
- | |
def _a_to_u(self, aString): | |
"""Decode ASCII strings to unicode if a self.encoding is specified.""" | |
if self.encoding: | |
@@ -1494,7 +1455,6 @@ class ConfigObj(Section): | |
else: | |
return aString | |
- | |
def _decode(self, infile, encoding): | |
""" | |
Decode infile to unicode. Using the specified encoding. | |
@@ -1513,7 +1473,6 @@ class ConfigObj(Section): | |
infile[i] = line.decode(encoding) | |
return infile | |
- | |
def _decode_element(self, line): | |
"""Decode element to unicode if necessary.""" | |
if not self.encoding: | |
@@ -1522,7 +1481,6 @@ class ConfigObj(Section): | |
return line.decode(self.default_encoding) | |
return line | |
- | |
def _str(self, value): | |
""" | |
Used by ``stringify`` within validate, to turn non-string values | |
@@ -1533,7 +1491,6 @@ class ConfigObj(Section): | |
else: | |
return value | |
- | |
def _parse(self, infile): | |
"""Actually parse the config file.""" | |
temp_list_values = self.list_values | |
@@ -1646,12 +1603,12 @@ class ConfigObj(Section): | |
try: | |
value = unrepr(value) | |
except Exception as e: | |
- if type(e) == UnknownType: | |
+ if isinstance(e, UnknownType): | |
msg = 'Unknown name or type in value at line %s.' | |
else: | |
msg = 'Parse error in value at line %s.' | |
self._handle_error(msg, UnreprError, infile, | |
- cur_index) | |
+ cur_index) | |
continue | |
else: | |
if self.unrepr: | |
@@ -1664,7 +1621,7 @@ class ConfigObj(Section): | |
else: | |
msg = 'Parse error in value at line %s.' | |
self._handle_error(msg, UnreprError, infile, | |
- cur_index) | |
+ cur_index) | |
continue | |
else: | |
# extract comment and lists | |
@@ -1701,7 +1658,6 @@ class ConfigObj(Section): | |
self.final_comment = comment_list | |
self.list_values = temp_list_values | |
- | |
def _match_depth(self, sect, depth): | |
""" | |
Given a section and a depth level, walk back through the sections | |
@@ -1720,7 +1676,6 @@ class ConfigObj(Section): | |
# shouldn't get here | |
raise SyntaxError() | |
- | |
def _handle_error(self, text, ErrorClass, infile, cur_index): | |
""" | |
Handle an error according to the error settings. | |
@@ -1739,7 +1694,6 @@ class ConfigObj(Section): | |
# reraise when parsing has finished | |
self._errors.append(error) | |
- | |
def _unquote(self, value): | |
"""Return an unquoted version of a value""" | |
if not value: | |
@@ -1749,7 +1703,6 @@ class ConfigObj(Section): | |
value = value[1:-1] | |
return value | |
- | |
def _quote(self, value, multiline=True): | |
""" | |
Return a safely quoted version of a value. | |
@@ -1780,7 +1733,7 @@ class ConfigObj(Section): | |
elif len(value) == 1: | |
return self._quote(value[0], multiline=False) + ',' | |
return ', '.join([self._quote(val, multiline=False) | |
- for val in value]) | |
+ for val in value]) | |
if not isinstance(value, string_type): | |
if self.stringify: | |
value = str(value) | |
@@ -1818,7 +1771,6 @@ class ConfigObj(Section): | |
return quot % value | |
- | |
def _get_single_quote(self, value): | |
if ("'" in value) and ('"' in value): | |
raise ConfigObjError('Value "%s" cannot be safely quoted.' % value) | |
@@ -1828,7 +1780,6 @@ class ConfigObj(Section): | |
quot = dquot | |
return quot | |
- | |
def _get_triple_quote(self, value): | |
if (value.find('"""') != -1) and (value.find("'''") != -1): | |
raise ConfigObjError('Value "%s" cannot be safely quoted.' % value) | |
@@ -1838,7 +1789,6 @@ class ConfigObj(Section): | |
quot = tsquot | |
return quot | |
- | |
def _handle_value(self, value): | |
""" | |
Given a value string, unquote, remove comment, | |
@@ -1887,7 +1837,6 @@ class ConfigObj(Section): | |
the_list += [single] | |
return (the_list, comment) | |
- | |
def _multiline(self, value, infile, cur_index, maxline): | |
"""Extract the value, where we are in a multiline situation.""" | |
quot = value[:3] | |
@@ -1922,7 +1871,6 @@ class ConfigObj(Section): | |
(value, comment) = mat.groups() | |
return (newvalue + value, comment, cur_index) | |
- | |
def _handle_configspec(self, configspec): | |
"""Parse the configspec.""" | |
# FIXME: Should we check that the configspec was created with the | |
@@ -1942,8 +1890,6 @@ class ConfigObj(Section): | |
self.configspec = configspec | |
- | |
- | |
def _set_configspec(self, section, copy): | |
""" | |
Called by validate. Handles setting the configspec on subsections | |
@@ -1971,7 +1917,6 @@ class ConfigObj(Section): | |
if isinstance(section[entry], Section): | |
section[entry].configspec = configspec[entry] | |
- | |
def _write_line(self, indent_string, entry, this_entry, comment): | |
"""Write an individual line, for the write method""" | |
# NOTE: the calls to self._quote here handles non-StringType values. | |
@@ -1985,7 +1930,6 @@ class ConfigObj(Section): | |
val, | |
self._decode_element(comment)) | |
- | |
def _write_marker(self, indent_string, depth, entry, comment): | |
"""Write a section marker line""" | |
return '%s%s%s%s%s' % (indent_string, | |
@@ -1994,7 +1938,6 @@ class ConfigObj(Section): | |
self._a_to_u(']' * depth), | |
self._decode_element(comment)) | |
- | |
def _handle_comment(self, comment): | |
"""Deal with a comment.""" | |
if not comment: | |
@@ -2004,7 +1947,6 @@ class ConfigObj(Section): | |
start += self._a_to_u(' # ') | |
return (start + comment) | |
- | |
# Public methods | |
def write(self, outfile=None, section=None): | |
@@ -2087,7 +2029,7 @@ class ConfigObj(Section): | |
if self.encoding: | |
out = [l.encode(self.encoding) for l in out] | |
if (self.BOM and ((self.encoding is None) or | |
- (BOM_LIST.get(self.encoding.lower()) == 'utf_8'))): | |
+ (BOM_LIST.get(self.encoding.lower()) == 'utf_8'))): | |
# Add the UTF8 BOM | |
if not out: | |
out.append('') | |
@@ -2097,7 +2039,7 @@ class ConfigObj(Section): | |
# Turn the list to a string, joined with correct newlines | |
newline = self.newlines or os.linesep | |
if (getattr(outfile, 'mode', None) is not None and outfile.mode == 'w' | |
- and sys.platform == 'win32' and newline == '\r\n'): | |
+ and sys.platform == 'win32' and newline == '\r\n'): | |
# Windows specific hack to avoid writing '\r\r\n' | |
newline = '\n' | |
output = self._a_to_u(newline).join(out) | |
@@ -2116,7 +2058,6 @@ class ConfigObj(Section): | |
h.write(output) | |
h.close() | |
- | |
def validate(self, validator, preserve_errors=False, copy=False, | |
section=None): | |
""" | |
@@ -2177,7 +2118,6 @@ class ConfigObj(Section): | |
configspec = section.configspec | |
self._set_configspec(section, copy) | |
- | |
def validate_entry(entry, spec, val, missing, ret_true, ret_false): | |
section.default_values.pop(entry, None) | |
@@ -2235,7 +2175,7 @@ class ConfigObj(Section): | |
if entry in ('__many__', '___many___'): | |
# reserved names | |
continue | |
- if (not entry in section.scalars) or (entry in section.defaults): | |
+ if (entry not in section.scalars) or (entry in section.defaults): | |
# missing entries | |
# or entries from defaults | |
missing = True | |
@@ -2298,9 +2238,9 @@ class ConfigObj(Section): | |
section.inline_comments[entry] = configspec.inline_comments.get(entry, '') | |
check = self.validate(validator, preserve_errors=preserve_errors, copy=copy, section=section[entry]) | |
out[entry] = check | |
- if check == False: | |
+ if not check: | |
ret_true = False | |
- elif check == True: | |
+ elif check: | |
ret_false = False | |
else: | |
ret_true = False | |
@@ -2323,7 +2263,6 @@ class ConfigObj(Section): | |
return False | |
return out | |
- | |
def reset(self): | |
"""Clear ConfigObj instance and restore to 'freshly created' state.""" | |
self.clear() | |
@@ -2334,7 +2273,6 @@ class ConfigObj(Section): | |
# Just to be sure ;-) | |
self._original_configspec = None | |
- | |
def reload(self): | |
""" | |
Reload a ConfigObj from file. | |
@@ -2360,7 +2298,6 @@ class ConfigObj(Section): | |
self._load(filename, configspec) | |
- | |
class SimpleVal(object): | |
""" | |
A simple validator. | |
@@ -2419,7 +2356,7 @@ def flatten_errors(cfg, res, levels=None, results=None): | |
# first time called | |
levels = [] | |
results = [] | |
- if res == True: | |
+ if res: | |
return results | |
if res == False or isinstance(res, Exception): | |
results.append((levels[:], None, res)) | |
@@ -2427,7 +2364,7 @@ def flatten_errors(cfg, res, levels=None, results=None): | |
levels.pop() | |
return results | |
for (key, val) in res.items(): | |
- if val == True: | |
+ if val: | |
continue | |
if isinstance(cfg.get(key), dict): | |
# Go down one level | |
diff --git a/easybuild/tools/containers/utils.py b/easybuild/tools/containers/utils.py | |
index b259763d5..4902d2c11 100644 | |
--- a/easybuild/tools/containers/utils.py | |
+++ b/easybuild/tools/containers/utils.py | |
@@ -78,7 +78,7 @@ def check_tool(tool_name, min_tool_version=None): | |
out, ec = run_cmd(version_cmd, simple=False, trace=False, force_in_dry_run=True) | |
if ec: | |
raise EasyBuildError("Error running '{0}' for tool {1} with output: {2}".format(version_cmd, tool_name, out)) | |
- res = re.search("\d+\.\d+(\.\d+)?", out.strip()) | |
+ res = re.search(r"\d+\.\d+(\.\d+)?", out.strip()) | |
if not res: | |
raise EasyBuildError("Error parsing version for tool {0}".format(tool_name)) | |
tool_version = res.group(0) | |
diff --git a/easybuild/tools/docs.py b/easybuild/tools/docs.py | |
index 1d1342e2c..f00e237b2 100644 | |
--- a/easybuild/tools/docs.py | |
+++ b/easybuild/tools/docs.py | |
@@ -490,7 +490,7 @@ def gen_list_easyblocks(list_easyblocks, format_strings): | |
txt.append(format_strings['root_templ'] % root) | |
if format_strings.get('newline') is not None: | |
- txt.append(format_strings['newline']) | |
+ txt.append(format_strings['newline']) | |
if 'children' in classes[root]: | |
txt.extend(avail_classes_tree(classes, classes[root]['children'], locations, detailed, format_strings)) | |
if format_strings.get('newline') is not None: | |
@@ -522,7 +522,7 @@ def list_software(output_format=FORMAT_TXT, detailed=False, only_installed=False | |
ecs.append(ec) | |
print_msg('\r', prefix=False, newline=False, silent=silent) | |
- print_msg("Processed %d/%d easyconfigs..." % (idx+1, cnt), newline=False, silent=silent) | |
+ print_msg("Processed %d/%d easyconfigs..." % (idx + 1, cnt), newline=False, silent=silent) | |
print_msg('', prefix=False, silent=silent) | |
software = {} | |
@@ -871,7 +871,7 @@ def gen_easyblock_doc_section_rst(eb_class, path_to_examples, common_params, doc | |
'.. _' + classname + ':', | |
'', | |
'``' + classname + '``', | |
- '=' * (len(classname)+4), | |
+ '=' * (len(classname) + 4), | |
'', | |
] | |
@@ -936,7 +936,7 @@ def gen_easyblock_doc_section_rst(eb_class, path_to_examples, common_params, doc | |
if os.path.exists(os.path.join(path_to_examples, '%s.eb' % classname)): | |
title = 'Example easyconfig for ``' + classname + '`` easyblock' | |
doc.extend([title, '-' * len(title), '', '.. code::', '']) | |
- for line in read_file(os.path.join(path_to_examples, classname+'.eb')).split('\n'): | |
+ for line in read_file(os.path.join(path_to_examples, classname + '.eb')).split('\n'): | |
doc.append(INDENT_4SPACES + line) | |
doc.append('') # empty line after literal block | |
diff --git a/easybuild/tools/filetools.py b/easybuild/tools/filetools.py | |
index 6ce5ebb5a..4649bd8f2 100644 | |
--- a/easybuild/tools/filetools.py | |
+++ b/easybuild/tools/filetools.py | |
@@ -128,28 +128,28 @@ CHECKSUM_TYPES = sorted(CHECKSUM_FUNCTIONS.keys()) | |
EXTRACT_CMDS = { | |
# gzipped or gzipped tarball | |
- '.gtgz': "tar xzf %(filepath)s", | |
- '.gz': "gunzip -c %(filepath)s > %(target)s", | |
- '.tar.gz': "tar xzf %(filepath)s", | |
- '.tgz': "tar xzf %(filepath)s", | |
+ '.gtgz': "tar xzf %(filepath)s", | |
+ '.gz': "gunzip -c %(filepath)s > %(target)s", | |
+ '.tar.gz': "tar xzf %(filepath)s", | |
+ '.tgz': "tar xzf %(filepath)s", | |
# bzipped or bzipped tarball | |
- '.bz2': "bunzip2 -c %(filepath)s > %(target)s", | |
+ '.bz2': "bunzip2 -c %(filepath)s > %(target)s", | |
'.tar.bz2': "tar xjf %(filepath)s", | |
- '.tb2': "tar xjf %(filepath)s", | |
- '.tbz': "tar xjf %(filepath)s", | |
- '.tbz2': "tar xjf %(filepath)s", | |
+ '.tb2': "tar xjf %(filepath)s", | |
+ '.tbz': "tar xjf %(filepath)s", | |
+ '.tbz2': "tar xjf %(filepath)s", | |
# xzipped or xzipped tarball | |
- '.tar.xz': "unxz %(filepath)s --stdout | tar x", | |
- '.txz': "unxz %(filepath)s --stdout | tar x", | |
- '.xz': "unxz %(filepath)s", | |
+ '.tar.xz': "unxz %(filepath)s --stdout | tar x", | |
+ '.txz': "unxz %(filepath)s --stdout | tar x", | |
+ '.xz': "unxz %(filepath)s", | |
# tarball | |
- '.tar': "tar xf %(filepath)s", | |
+ '.tar': "tar xf %(filepath)s", | |
# zip file | |
- '.zip': "unzip -qq %(filepath)s", | |
+ '.zip': "unzip -qq %(filepath)s", | |
# iso file | |
- '.iso': "7z x %(filepath)s", | |
+ '.iso': "7z x %(filepath)s", | |
# tar.Z: using compress (LZW), but can be handled with gzip so use 'z' | |
- '.tar.z': "tar xzf %(filepath)s", | |
+ '.tar.z': "tar xzf %(filepath)s", | |
} | |
@@ -158,6 +158,7 @@ class ZlibChecksum(object): | |
wrapper class for adler32 and crc32 checksums to | |
match the interface of the hashlib module | |
""" | |
+ | |
def __init__(self, algorithm): | |
self.algorithm = algorithm | |
self.checksum = algorithm(b'') # use the same starting point as the module | |
diff --git a/easybuild/tools/github.py b/easybuild/tools/github.py | |
index dd6eccc15..83918a8e8 100644 | |
--- a/easybuild/tools/github.py | |
+++ b/easybuild/tools/github.py | |
@@ -967,7 +967,7 @@ def find_software_name_for_patch(patch_name, ec_dirs): | |
break | |
except EasyBuildError as err: | |
_log.debug("Ignoring easyconfig %s that fails to parse: %s", path, err) | |
- sys.stdout.write('\r%s of %s easyconfigs checked' % (idx+1, nr_of_ecs)) | |
+ sys.stdout.write('\r%s of %s easyconfigs checked' % (idx + 1, nr_of_ecs)) | |
sys.stdout.flush() | |
sys.stdout.write('\n') | |
diff --git a/easybuild/tools/include.py b/easybuild/tools/include.py | |
index 90b971528..9d85402cc 100644 | |
--- a/easybuild/tools/include.py | |
+++ b/easybuild/tools/include.py | |
@@ -142,7 +142,7 @@ def verify_imports(pymods, pypkg, from_path): | |
def is_software_specific_easyblock(module): | |
"""Determine whether Python module at specified location is a software-specific easyblock.""" | |
- return bool(re.search('^class EB_.*\(.*\):\s*$', read_file(module), re.M)) | |
+ return bool(re.search(r'^class EB_.*\(.*\):\s*$', read_file(module), re.M)) | |
def include_easyblocks(tmpdir, paths): | |
diff --git a/easybuild/tools/job/gc3pie.py b/easybuild/tools/job/gc3pie.py | |
index 80593a037..4b7927407 100644 | |
--- a/easybuild/tools/job/gc3pie.py | |
+++ b/easybuild/tools/job/gc3pie.py | |
@@ -168,7 +168,7 @@ class GC3Pie(JobBackend): | |
""" | |
named_args = { | |
'jobname': name, # job name in GC3Pie | |
- 'name': name, # job name in EasyBuild | |
+ 'name': name, # job name in EasyBuild | |
} | |
# environment | |
diff --git a/easybuild/tools/job/pbs_python.py b/easybuild/tools/job/pbs_python.py | |
index 6e427b6e2..f1f7dd4cd 100644 | |
--- a/easybuild/tools/job/pbs_python.py | |
+++ b/easybuild/tools/job/pbs_python.py | |
@@ -171,7 +171,9 @@ class PbsPython(JobBackend): | |
# return most frequent | |
freq_count, freq_np = max([(j, i) for i, j in res.items()]) | |
- self.log.debug("Found most frequent np %s (%s times) in interesting nodes %s" % (freq_np, freq_count, interesting_nodes)) | |
+ self.log.debug( | |
+ "Found most frequent np %s (%s times) in interesting nodes %s" % | |
+ (freq_np, freq_count, interesting_nodes)) | |
self._ppn = freq_np | |
@@ -453,7 +455,7 @@ class PbsJob(object): | |
return None | |
# convert single type into list | |
- if type(types) is str: | |
+ if isinstance(types, str): | |
types = [types] | |
self.log.debug("Return info types %s" % types) | |
diff --git a/easybuild/tools/module_generator.py b/easybuild/tools/module_generator.py | |
index e3859880e..ef9caa760 100644 | |
--- a/easybuild/tools/module_generator.py | |
+++ b/easybuild/tools/module_generator.py | |
@@ -735,7 +735,7 @@ class ModuleGeneratorTcl(ModuleGenerator): | |
""" | |
txt = '\n'.join([ | |
"proc ModulesHelp { } {", | |
- " puts stderr {%s" % re.sub('([{}\[\]])', r'\\\1', self._generate_help_text()), | |
+ " puts stderr {%s" % re.sub(r'([{}\[\]])', r'\\\1', self._generate_help_text()), | |
" }", | |
'}', | |
'', | |
diff --git a/easybuild/tools/module_naming_scheme/categorized_mns.py b/easybuild/tools/module_naming_scheme/categorized_mns.py | |
index 46f0b0e86..3cc0ae174 100644 | |
--- a/easybuild/tools/module_naming_scheme/categorized_mns.py | |
+++ b/easybuild/tools/module_naming_scheme/categorized_mns.py | |
@@ -35,6 +35,7 @@ import re | |
from easybuild.tools.module_naming_scheme.mns import ModuleNamingScheme | |
from easybuild.tools.module_naming_scheme.utilities import det_full_ec_version | |
+ | |
class CategorizedModuleNamingScheme(ModuleNamingScheme): | |
"""Class implementing the categorized module naming scheme.""" | |
@@ -55,11 +56,10 @@ class CategorizedModuleNamingScheme(ModuleNamingScheme): | |
Default implementation checks via a strict regex pattern, and assumes short module names are of the form: | |
<name>/<version>[-<toolchain>] | |
""" | |
- modname_regex = re.compile('^[^/]+/%s/\S+$' % re.escape(name)) | |
+ modname_regex = re.compile(r'^[^/]+/%s/\S+$' % re.escape(name)) | |
res = bool(modname_regex.match(short_modname)) | |
tup = (short_modname, name, modname_regex.pattern, res) | |
self.log.debug("Checking whether '%s' is a module name for software with name '%s' via regex %s: %s" % tup) | |
return res | |
- | |
diff --git a/easybuild/tools/module_naming_scheme/migrate_from_eb_to_hmns.py b/easybuild/tools/module_naming_scheme/migrate_from_eb_to_hmns.py | |
index 7dfdfc38e..70629b762 100644 | |
--- a/easybuild/tools/module_naming_scheme/migrate_from_eb_to_hmns.py | |
+++ b/easybuild/tools/module_naming_scheme/migrate_from_eb_to_hmns.py | |
@@ -30,6 +30,7 @@ Implementation of a module naming scheme that can be used to migrate from EasyBu | |
from easybuild.tools.module_naming_scheme.easybuild_mns import EasyBuildMNS | |
from easybuild.tools.module_naming_scheme.hierarchical_mns import HierarchicalMNS | |
+ | |
class MigrateFromEBToHMNS(HierarchicalMNS, EasyBuildMNS): | |
def det_install_subdir(self, ec): | |
diff --git a/easybuild/tools/module_naming_scheme/mns.py b/easybuild/tools/module_naming_scheme/mns.py | |
index d18055177..b4c854d58 100644 | |
--- a/easybuild/tools/module_naming_scheme/mns.py | |
+++ b/easybuild/tools/module_naming_scheme/mns.py | |
@@ -162,7 +162,7 @@ class ModuleNamingScheme(BaseModuleNamingScheme): | |
Default implementation checks via a strict regex pattern, and assumes short module names are of the form: | |
<name>/<version>[-<toolchain>] | |
""" | |
- modname_regex = re.compile('^%s(/\S+)?$' % re.escape(name)) | |
+ modname_regex = re.compile(r'^%s(/\S+)?$' % re.escape(name)) | |
res = bool(modname_regex.match(short_modname)) | |
self.log.debug("Checking whether '%s' is a module name for software with name '%s' via regex %s: %s", | |
diff --git a/easybuild/tools/modules.py b/easybuild/tools/modules.py | |
index 8bfc737bc..a21838697 100644 | |
--- a/easybuild/tools/modules.py | |
+++ b/easybuild/tools/modules.py | |
@@ -444,9 +444,9 @@ class ModulesTool(object): | |
idx = 1 | |
while(curr_mod_paths[-idx:] == self.mod_paths[-idx:]): | |
idx += 1 | |
- self.log.debug("Not prepending %d last entries of %s", idx-1, self.mod_paths) | |
+ self.log.debug("Not prepending %d last entries of %s", idx - 1, self.mod_paths) | |
- for mod_path in self.mod_paths[::-1][idx-1:]: | |
+ for mod_path in self.mod_paths[::-1][idx - 1:]: | |
self.prepend_module_path(mod_path) | |
self.log.info("$MODULEPATH set via list of module paths (w/ 'module use'): %s" % os.environ['MODULEPATH']) | |
@@ -1054,7 +1054,7 @@ class ModulesTool(object): | |
if path_matches(full_mod_subdir, full_modpath_exts): | |
# full path to module subdir of dependency is simply path to module file without (short) module name | |
- dep_full_mod_subdir = self.modulefile_path(dep, strip_ext=True)[:-len(dep)-1] | |
+ dep_full_mod_subdir = self.modulefile_path(dep, strip_ext=True)[:-len(dep) - 1] | |
full_mod_subdirs.append(dep_full_mod_subdir) | |
mods_to_top.append(dep) | |
@@ -1545,6 +1545,7 @@ def invalidate_module_caches_for(path): | |
class Modules(EnvironmentModulesC): | |
"""NO LONGER SUPPORTED: interface to modules tool, use modules_tool from easybuild.tools.modules instead""" | |
+ | |
def __init__(self, *args, **kwargs): | |
_log.nosupport("modules.Modules class is now an abstract interface, use modules.modules_tool instead", '2.0') | |
@@ -1557,7 +1558,7 @@ class NoModulesTool(ModulesTool): | |
def exist(self, mod_names, *args, **kwargs): | |
"""No modules, so nothing exists""" | |
- return [False]*len(mod_names) | |
+ return [False] * len(mod_names) | |
def check_loaded_modules(self): | |
"""Nothing to do since no modules""" | |
diff --git a/easybuild/tools/multidiff.py b/easybuild/tools/multidiff.py | |
index 63967244e..a102a3de7 100644 | |
--- a/easybuild/tools/multidiff.py | |
+++ b/easybuild/tools/multidiff.py | |
@@ -69,6 +69,7 @@ class MultiDiff(object): | |
""" | |
Class representing a multi-diff. | |
""" | |
+ | |
def __init__(self, base_fn, base_lines, files, colored=True): | |
""" | |
MultiDiff constructor | |
diff --git a/easybuild/tools/ordereddict.py b/easybuild/tools/ordereddict.py | |
index 5cdd3da4f..34b2a771f 100644 | |
--- a/easybuild/tools/ordereddict.py | |
+++ b/easybuild/tools/ordereddict.py | |
@@ -1,4 +1,4 @@ | |
-## http://code.activestate.com/recipes/576693/ (r9) | |
+# http://code.activestate.com/recipes/576693/ (r9) | |
# Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy. | |
# Passes Python2.7's test suite and incorporates all the latest updates. | |
@@ -170,7 +170,7 @@ class OrderedDict(dict): | |
''' | |
if len(args) > 1: | |
raise TypeError('update() takes at most 2 positional ' | |
- 'arguments (%d given)' % (1+len(args),)) | |
+ 'arguments (%d given)' % (1 + len(args),)) | |
# Make progressively weaker assumptions about "other" | |
other = () | |
if len(args) == 1: | |
@@ -255,7 +255,7 @@ class OrderedDict(dict): | |
''' | |
if isinstance(other, OrderedDict): | |
- return len(self)==len(other) and self.items() == other.items() | |
+ return len(self) == len(other) and self.items() == other.items() | |
return dict.__eq__(self, other) | |
def __ne__(self, other): | |
@@ -274,4 +274,3 @@ class OrderedDict(dict): | |
def viewitems(self): | |
"od.viewitems() -> a set-like object providing a view on od's items" | |
return ItemsView(self) | |
- | |
diff --git a/easybuild/tools/py2vs3/py3.py b/easybuild/tools/py2vs3/py3.py | |
index 3ff66d680..3b5076694 100644 | |
--- a/easybuild/tools/py2vs3/py3.py | |
+++ b/easybuild/tools/py2vs3/py3.py | |
@@ -94,7 +94,7 @@ def mk_wrapper_baseclass(metaclass): | |
def safe_cmp_looseversions(v1, v2): | |
"""Safe comparison function for two (values containing) LooseVersion instances.""" | |
- if type(v1) != type(v2): | |
+ if not isinstance(v1, type(v2)): | |
raise TypeError("Can't compare values of different types: %s (%s) vs %s (%s)" % (v1, type(v1), v2, type(v2))) | |
# if we receive two iterative values, we need to recurse | |
@@ -123,7 +123,7 @@ def safe_cmp_looseversions(v1, v2): | |
# implementation based on '14894.patch' patch file provided in https://bugs.python.org/issue14894 | |
for ver1_part, ver2_part in zip_longest(v1.version, v2.version, fillvalue=''): | |
# use string comparison if version parts have different type | |
- if type(ver1_part) != type(ver2_part): | |
+ if not isinstance(ver1_part, type(ver2_part)): | |
ver1_part = str(ver1_part) | |
ver2_part = str(ver2_part) | |
diff --git a/easybuild/tools/robot.py b/easybuild/tools/robot.py | |
index 9bf941eda..849b94909 100644 | |
--- a/easybuild/tools/robot.py | |
+++ b/easybuild/tools/robot.py | |
@@ -219,7 +219,7 @@ def check_conflicts(easyconfigs, modtool, check_inter_ec_conflicts=True): | |
for runtime_deps in lists_of_runtime_deps: | |
# also check whether module itself clashes with any of its dependencies | |
for i, dep1 in enumerate(build_deps + runtime_deps + [key]): | |
- for dep2 in (build_deps + runtime_deps)[i+1:]: | |
+ for dep2 in (build_deps + runtime_deps)[i + 1:]: | |
# don't worry about conflicts between module itself and any of its build deps | |
if dep1 != key or dep2 not in build_deps: | |
res |= check_conflict(key, dep1, dep2) | |
diff --git a/easybuild/tools/run.py b/easybuild/tools/run.py | |
index a3471abc0..ed6be6e04 100644 | |
--- a/easybuild/tools/run.py | |
+++ b/easybuild/tools/run.py | |
@@ -338,7 +338,7 @@ def run_cmd_qa(cmd, qa, no_qa=None, log_ok=True, log_all=False, simple=False, re | |
def escape_special(string): | |
return re.sub(r"([\+\?\(\)\[\]\*\.\\\$])", r"\\\1", string) | |
- split = '[\s\n]+' | |
+ split = r'[\s\n]+' | |
regSplit = re.compile(r"" + split) | |
def process_QA(q, a_s): | |
@@ -569,10 +569,10 @@ def parse_log_for_error(txt, regExp=None, stdout=True, msg=None): | |
""" | |
global errors_found_in_log | |
- if regExp and type(regExp) == bool: | |
+ if regExp and isinstance(regExp, bool): | |
regExp = r"(?<![(,-]|\w)(?:error|segmentation fault|failed)(?![(,-]|\.?\w)" | |
_log.debug('Using default regular expression: %s' % regExp) | |
- elif type(regExp) == str: | |
+ elif isinstance(regExp, str): | |
pass | |
else: | |
raise EasyBuildError("parse_log_for_error no valid regExp used: %s", regExp) | |
diff --git a/easybuild/tools/systemtools.py b/easybuild/tools/systemtools.py | |
index 0e114cb0d..b2a9eb425 100644 | |
--- a/easybuild/tools/systemtools.py | |
+++ b/easybuild/tools/systemtools.py | |
@@ -333,7 +333,7 @@ def get_cpu_family(): | |
# Distinguish POWER running in little-endian mode | |
system, node, release, version, machine, processor = platform.uname() | |
- powerle_regex = re.compile("^ppc(\d*)le") | |
+ powerle_regex = re.compile(r"^ppc(\d*)le") | |
if powerle_regex.search(machine): | |
family = POWER_LE | |
@@ -457,11 +457,11 @@ def get_cpu_features(): | |
_log.debug("Found CPU features using regex '%s': %s", flags_regex.pattern, cpu_feat) | |
elif get_cpu_architecture() == POWER: | |
# for Linux@POWER systems, no flags/features are listed, but we can check for Altivec | |
- cpu_altivec_regex = re.compile("^cpu\s*:.*altivec supported", re.M) | |
+ cpu_altivec_regex = re.compile(r"^cpu\s*:.*altivec supported", re.M) | |
if cpu_altivec_regex.search(proc_cpuinfo): | |
cpu_feat.append('altivec') | |
# VSX is supported since POWER7 | |
- cpu_power7_regex = re.compile("^cpu\s*:.*POWER(7|8|9)", re.M) | |
+ cpu_power7_regex = re.compile(r"^cpu\s*:.*POWER(7|8|9)", re.M) | |
if cpu_power7_regex.search(proc_cpuinfo): | |
cpu_feat.append('vsx') | |
else: | |
@@ -700,7 +700,7 @@ def get_gcc_version(): | |
# Fedora: gcc (GCC) 5.1.1 20150618 (Red Hat 5.1.1-4) | |
# Debian: gcc (Debian 4.9.2-10) 4.9.2 | |
- find_version = re.search("^gcc\s+\([^)]+\)\s+(?P<version>[^\s]+)\s+", out) | |
+ find_version = re.search(r"^gcc\s+\([^)]+\)\s+(?P<version>[^\s]+)\s+", out) | |
if find_version: | |
res = find_version.group('version') | |
_log.debug("Found GCC version: %s from %s", res, out) | |
diff --git a/easybuild/tools/toolchain/constants.py b/easybuild/tools/toolchain/constants.py | |
index 0ddd41de7..423154e6b 100644 | |
--- a/easybuild/tools/toolchain/constants.py | |
+++ b/easybuild/tools/toolchain/constants.py | |
@@ -203,5 +203,3 @@ ALL_MAP_CLASSES = [ | |
BLAS_MAP_CLASS, LAPACK_MAP_CLASS, BLACS_MAP_CLASS, SCALAPACK_MAP_CLASS, | |
FFT_MAP_CLASS, FFTW_MAP_CLASS, CO_COMPILER_MAP_CLASS, | |
] | |
- | |
- | |
diff --git a/easybuild/tools/toolchain/linalg.py b/easybuild/tools/toolchain/linalg.py | |
index 8edafd839..411b055f2 100644 | |
--- a/easybuild/tools/toolchain/linalg.py | |
+++ b/easybuild/tools/toolchain/linalg.py | |
@@ -87,7 +87,7 @@ class LinAlg(Toolchain): | |
def set_variables(self): | |
"""Set the variables""" | |
- ## TODO is link order fully preserved with this order ? | |
+ # TODO is link order fully preserved with this order ? | |
self._set_blas_variables() | |
self._set_lapack_variables() | |
if getattr(self, 'MPI_MODULE_NAME', None): | |
@@ -110,7 +110,7 @@ class LinAlg(Toolchain): | |
if 'FLIBS' in self.variables: | |
self.variables.join('LIBBLAS', 'FLIBS') | |
- ## multi-threaded | |
+ # multi-threaded | |
if self.BLAS_LIB_MT is None: | |
self.variables.join('LIBBLAS_MT', 'LIBBLAS') | |
else: | |
@@ -133,7 +133,7 @@ class LinAlg(Toolchain): | |
self.variables.append_exists('BLAS_LIB_DIR', root, self.BLAS_LIB_DIR) | |
self.variables.append_exists('BLAS_INC_DIR', root, self.BLAS_INCLUDE_DIR) | |
- ## add general dependency variables | |
+ # add general dependency variables | |
self._add_dependency_variables(self.BLAS_MODULE_NAME, ld=self.BLAS_LIB_DIR, cpp=self.BLAS_INCLUDE_DIR) | |
def _set_lapack_variables(self): | |
@@ -160,14 +160,14 @@ class LinAlg(Toolchain): | |
toggle_staticdynamic=self.LAPACK_LIB_STATIC) | |
if self.LAPACK_LIB_MT is None: | |
- ## reuse LAPACK variables | |
+ # reuse LAPACK variables | |
self.variables.join('LIBLAPACK_MT_ONLY', 'LIBLAPACK_ONLY') | |
else: | |
self.variables.nappend('LIBLAPACK_MT_ONLY', self.LAPACK_LIB_MT) | |
if getattr(self, 'LIB_MULTITHREAD', None) is not None: | |
self.variables.nappend('LIBLAPACK_MT_ONLY', self.LIB_MULTITHREAD) | |
- ## need BLAS for LAPACK ? | |
+ # need BLAS for LAPACK ? | |
if self.LAPACK_REQUIRES is not None: | |
self.variables.join('LIBLAPACK', 'LIBLAPACK_ONLY', *self.LAPACK_REQUIRES) | |
lapack_mt = ["%s_MT" % x for x in self.LAPACK_REQUIRES] | |
@@ -195,7 +195,7 @@ class LinAlg(Toolchain): | |
self.variables.join('BLAS_LAPACK_STATIC_LIBS', 'LAPACK_STATIC_LIBS', 'BLAS_STATIC_LIBS') | |
self.variables.join('BLAS_LAPACK_MT_STATIC_LIBS', 'LAPACK_MT_STATIC_LIBS', 'BLAS_MT_STATIC_LIBS') | |
- ## add general dependency variables | |
+ # add general dependency variables | |
self._add_dependency_variables(self.LAPACK_MODULE_NAME, ld=self.LAPACK_LIB_DIR, cpp=self.LAPACK_INCLUDE_DIR) | |
def _set_blacs_variables(self): | |
@@ -207,8 +207,7 @@ class LinAlg(Toolchain): | |
if hasattr(self, 'BLACS_LIB_MAP') and self.BLACS_LIB_MAP is not None: | |
lib_map.update(self.BLACS_LIB_MAP) | |
- | |
- ## BLACS | |
+ # BLACS | |
self.BLACS_LIB = self.variables.nappend('LIBBLACS', [x % lib_map for x in self.BLACS_LIB]) | |
if self.BLACS_LIB is not None: | |
self.variables.add_begin_end_linkerflags(self.BLACS_LIB, | |
@@ -218,7 +217,10 @@ class LinAlg(Toolchain): | |
if self.BLACS_LIB_MT is None: | |
self.variables.join('LIBBLACS_MT', 'LIBBLACS') | |
else: | |
- self.BLACS_LIB_MT = self.variables.nappend('LIBBLACS_MT', [x % self.BLACS_LIB_MAP for x in self.BLACS_LIB_MT]) | |
+ self.BLACS_LIB_MT = self.variables.nappend( | |
+ 'LIBBLACS_MT', [ | |
+ x % | |
+ self.BLACS_LIB_MAP for x in self.BLACS_LIB_MT]) | |
if self.BLACS_LIB_MT is not None: | |
self.variables.add_begin_end_linkerflags(self.BLACS_LIB_MT, | |
toggle_startstopgroup=self.BLACS_LIB_GROUP, | |
@@ -234,7 +236,7 @@ class LinAlg(Toolchain): | |
self.variables.append_exists('BLACS_LIB_DIR', root, self.BLACS_LIB_DIR) | |
self.variables.append_exists('BLACS_INC_DIR', root, self.BLACS_INCLUDE_DIR) | |
- ## add general dependency variables | |
+ # add general dependency variables | |
self._add_dependency_variables(self.BLACS_MODULE_NAME, ld=self.BLACS_LIB_DIR, cpp=self.BLACS_INCLUDE_DIR) | |
def _set_scalapack_variables(self): | |
@@ -259,13 +261,13 @@ class LinAlg(Toolchain): | |
if 'FLIBS' in self.variables: | |
self.variables.join('LIBSCALAPACK_ONLY', 'FLIBS') | |
- ## multi-threaded | |
+ # multi-threaded | |
if self.SCALAPACK_LIB_MT is None: | |
- ## reuse BLAS variables | |
+ # reuse BLAS variables | |
self.variables.join('LIBSCALAPACK_MT_ONLY', 'LIBSCALAPACK_ONLY') | |
else: | |
self.SCALAPACK_LIB_MT = self.variables.nappend('LIBSCALAPACK_MT_ONLY', | |
- [x % lib_map for x in self.SCALAPACK_LIB_MT]) | |
+ [x % lib_map for x in self.SCALAPACK_LIB_MT]) | |
self.variables.add_begin_end_linkerflags(self.SCALAPACK_LIB_MT, | |
toggle_startstopgroup=self.SCALAPACK_LIB_GROUP, | |
toggle_staticdynamic=self.SCALAPACK_LIB_STATIC) | |
diff --git a/easybuild/tools/toolchain/mpi.py b/easybuild/tools/toolchain/mpi.py | |
index 9a30baa33..d381de99c 100644 | |
--- a/easybuild/tools/toolchain/mpi.py | |
+++ b/easybuild/tools/toolchain/mpi.py | |
@@ -60,10 +60,10 @@ class Mpi(Toolchain): | |
MPI_UNIQUE_OPTION_MAP = None | |
MPI_SHARED_OPTION_MAP = { | |
'_opt_MPICC': 'cc=%(CC_base)s', | |
- '_opt_MPICXX':'cxx=%(CXX_base)s', | |
- '_opt_MPIF77':'fc=%(F77_base)s', | |
- '_opt_MPIF90':'f90=%(F90_base)s', | |
- '_opt_MPIFC':'fc=%(FC_base)s', | |
+ '_opt_MPICXX': 'cxx=%(CXX_base)s', | |
+ '_opt_MPIF77': 'fc=%(F77_base)s', | |
+ '_opt_MPIF90': 'f90=%(F90_base)s', | |
+ '_opt_MPIFC': 'fc=%(FC_base)s', | |
} | |
MPI_COMPILER_MPICC = 'mpicc' | |
@@ -82,7 +82,6 @@ class Mpi(Toolchain): | |
super(Mpi, self).__init__(*args, **kwargs) | |
- | |
def _set_mpi_options(self): | |
self.options.add_options(self.MPI_SHARED_OPTS, self.MPI_SHARED_OPTION_MAP) | |
@@ -90,7 +89,6 @@ class Mpi(Toolchain): | |
self.log.devel('_set_mpi_options: all current options %s', self.options) | |
- | |
def set_variables(self): | |
"""Set the variables""" | |
self._set_mpi_compiler_variables() | |
@@ -107,7 +105,7 @@ class Mpi(Toolchain): | |
for var_tuple in COMPILER_VARIABLES: | |
c_var = var_tuple[0] # [1] is the description | |
- var = MPI_COMPILER_TEMPLATE % {'c_var':c_var} | |
+ var = MPI_COMPILER_TEMPLATE % {'c_var': c_var} | |
value = getattr(self, 'MPI_COMPILER_%s' % var.upper(), None) | |
if value is None: | |
@@ -116,7 +114,7 @@ class Mpi(Toolchain): | |
# complete compiler variable template to produce e.g. 'mpicc -cc=icc -X -Y' from 'mpicc -cc=%(CC_base)' | |
templatedict = { | |
- c_var:str(self.variables[c_var]), | |
+ c_var: str(self.variables[c_var]), | |
'%s_base' % c_var: str(self.variables[c_var].get_first()), | |
} | |
@@ -133,7 +131,6 @@ class Mpi(Toolchain): | |
c_var, self.variables[c_var], var, self.variables[var]) | |
self.variables[c_var] = self.variables[var] | |
- | |
if self.options.get('cciscxx', None): | |
self.log.debug("_set_mpi_compiler_variables: cciscxx set: switching MPICXX %s for MPICC value %s", | |
self.variables['MPICXX'], self.variables['MPICC']) | |
diff --git a/easybuild/tools/toolchain/toolchain.py b/easybuild/tools/toolchain/toolchain.py | |
index d05fb4a03..9043676b4 100644 | |
--- a/easybuild/tools/toolchain/toolchain.py | |
+++ b/easybuild/tools/toolchain/toolchain.py | |
@@ -331,8 +331,7 @@ class Toolchain(object): | |
if self.vars is None: | |
self.generate_vars() | |
- var_names = self.variables.keys() | |
- var_names.sort() | |
+ var_names = sorted(self.variables.keys()) | |
res = [] | |
for v in var_names: | |
res.append("%s=%s" % (v, self.variables[v])) | |
@@ -661,8 +660,8 @@ class Toolchain(object): | |
raise EasyBuildError("No module found for toolchain: %s", self.mod_short_name) | |
if self.is_system_toolchain(): | |
- self.log.info("Loading dependencies using system toolchain...") | |
- self._load_dependencies_modules(silent=silent) | |
+ self.log.info("Loading dependencies using system toolchain...") | |
+ self._load_dependencies_modules(silent=silent) | |
else: | |
# load the toolchain and dependencies modules | |
self.log.debug("Loading toolchain module and dependencies...") | |
@@ -675,7 +674,7 @@ class Toolchain(object): | |
dry_run_msg("\nFull list of loaded modules:", silent=silent) | |
if loaded_mods: | |
for i, mod_name in enumerate([m['mod_name'] for m in loaded_mods]): | |
- dry_run_msg(" %d) %s" % (i+1, mod_name), silent=silent) | |
+ dry_run_msg(" %d) %s" % (i + 1, mod_name), silent=silent) | |
else: | |
dry_run_msg(" (none)", silent=silent) | |
dry_run_msg('', silent=silent) | |
diff --git a/easybuild/tools/toolchain/variables.py b/easybuild/tools/toolchain/variables.py | |
index 39d2d0f13..204b6f9e0 100644 | |
--- a/easybuild/tools/toolchain/variables.py | |
+++ b/easybuild/tools/toolchain/variables.py | |
@@ -54,6 +54,7 @@ class CommandFlagList(FlagList): | |
First of the list has no prefix (i.e. the executable) | |
The remainder of the options are considered flags | |
""" | |
+ | |
def _str_self(self): | |
"""Like a regular flag list, but set first element to original value""" | |
tmp_str = [self.str_convert(x) for x in self if self._str_ok(x)] | |
@@ -66,7 +67,7 @@ class LibraryList(StrList): | |
"""Link library list""" | |
PREFIX = "-l" | |
- SANITIZE_REMOVE_DUPLICATE_KEEP = -1 # sanitize from end | |
+ SANITIZE_REMOVE_DUPLICATE_KEEP = -1 # sanitize from end | |
JOIN_BEGIN_END = True | |
@@ -174,5 +175,3 @@ class LinkerFlagList(StrList): | |
self.IS_BEGIN, self.PREFIX, self.BEGIN) | |
super(LinkerFlagList, self).sanitize() | |
- | |
- | |
diff --git a/easybuild/tools/variables.py b/easybuild/tools/variables.py | |
index d1bdab930..210290a17 100644 | |
--- a/easybuild/tools/variables.py | |
+++ b/easybuild/tools/variables.py | |
@@ -52,7 +52,7 @@ def get_class(name, default_class, map_class=None): | |
if name is not None: | |
try: | |
klass = map_class[name] | |
- except: | |
+ except BaseException: | |
for k, v in map_class.items(): | |
if type(k) in (type,) and name in v: | |
klass = k | |
@@ -154,7 +154,7 @@ class CommaList(StrList): | |
class AbsPathList(StrList): | |
"""Absolute paths (eg -L or -I)""" | |
- SANITIZE_REMOVE_DUPLICATE_KEEP = -1 # sanitize from end | |
+ SANITIZE_REMOVE_DUPLICATE_KEEP = -1 # sanitize from end | |
def append_exists(self, prefix, paths, suffix=None, filename=None, append_all=False): | |
""" | |
@@ -225,11 +225,11 @@ class ListOfLists(list): | |
self.protected_classes = self.PROTECTED_CLASSES[:] | |
if self.PROTECT_CLASS_SELF: | |
- if not self.DEFAULT_CLASS in self.protected_classes: | |
+ if self.DEFAULT_CLASS not in self.protected_classes: | |
self.protected_classes.append(self.DEFAULT_CLASS) | |
self.protected_instances = self.PROTECTED_INSTANCES[:] | |
if self.PROTECT_INSTANCE_SELF: | |
- if not self.DEFAULT_CLASS in self.protected_instances: | |
+ if self.DEFAULT_CLASS not in self.protected_instances: | |
self.protected_instances.append(self.DEFAULT_CLASS) | |
def append_empty(self): | |
@@ -287,11 +287,11 @@ class ListOfLists(list): | |
try: | |
# this might work, but probably not | |
newvalue = klass(value, **kwargs) | |
- except: | |
+ except BaseException: | |
newvalue = klass(**kwargs) | |
if value is not None: | |
newvalue.append(value) | |
- if not position is None: | |
+ if position is not None: | |
newvalue.POSITION = position | |
if self._str_ok(newvalue) or append_empty: | |
self.append(newvalue) | |
@@ -328,7 +328,7 @@ class ListOfLists(list): | |
try: | |
# this might work, but probably not | |
newvalue = klass(el) | |
- except: | |
+ except BaseException: | |
newvalue = klass() | |
if value is not None: | |
newvalue.append(el) | |
@@ -378,7 +378,8 @@ class ListOfLists(list): | |
to_remove = [] | |
# work in reversed order; don't check last one (ie real el 0), it has no next element | |
for idx in range(1, len(self))[::-1]: | |
- if self[idx].BEGIN is None or self[idx].END is None: continue | |
+ if self[idx].BEGIN is None or self[idx].END is None: | |
+ continue | |
self.log.devel("idx %s len %s", idx, len(self)) | |
# do check POSITION, sorting already done | |
if self[idx].BEGIN == self[idx - 1].BEGIN and self[idx].END == self[idx - 1].END: | |
@@ -564,4 +565,3 @@ class Variables(dict): | |
return _passthrough | |
else: | |
return super(Variables, self).__getattribute__(attr_name) | |
- | |
diff --git a/test/framework/config.py b/test/framework/config.py | |
index 63ce53700..71fac496e 100644 | |
--- a/test/framework/config.py | |
+++ b/test/framework/config.py | |
@@ -190,7 +190,7 @@ class EasyBuildConfigTest(EnhancedTestCase): | |
os.environ['EASYBUILD_THERESNOSUCHCONFIGURATIONOPTION'] = 'whatever' | |
error = r"Found 2 environment variable\(s\) that are prefixed with %s " % CONFIG_ENV_VAR_PREFIX | |
- error += "but do not match valid option\(s\): " | |
+ error += r"but do not match valid option\(s\): " | |
error += ','.join(['EASYBUILD_FOO', 'EASYBUILD_THERESNOSUCHCONFIGURATIONOPTION']) | |
self.assertErrorRegex(EasyBuildError, error, init_config) | |
@@ -365,7 +365,7 @@ class EasyBuildConfigTest(EnhancedTestCase): | |
# only valid keys can be set | |
BuildOptions.__class__._instances.clear() | |
- msg = "Encountered unknown keys .* \(known keys: .*" | |
+ msg = r"Encountered unknown keys .* \(known keys: .*" | |
self.assertErrorRegex(KeyError, msg, BuildOptions, {'thisisclearlynotavalidbuildoption': 'FAIL'}) | |
# test init_build_options and build_option functions | |
diff --git a/test/framework/containers.py b/test/framework/containers.py | |
index b89d5882e..73d0df22e 100644 | |
--- a/test/framework/containers.py | |
+++ b/test/framework/containers.py | |
@@ -362,7 +362,7 @@ class ContainersTest(EnhancedTestCase): | |
args.append('--container-tmpdir=%s' % self.test_prefix) | |
stdout, stderr = self.run_main(args) | |
self.assertFalse(stderr) | |
- regexs[-3] = "^== Running 'sudo\s*SINGULARITY_TMPDIR=%s \S*/singularity build .*" % self.test_prefix | |
+ regexs[-3] = r"^== Running 'sudo\s*SINGULARITY_TMPDIR=%s \S*/singularity build .*" % self.test_prefix | |
self.check_regexs(regexs, stdout) | |
def test_end2end_dockerfile(self): | |
@@ -460,8 +460,8 @@ class ContainersTest(EnhancedTestCase): | |
self.assertFalse(stderr) | |
regexs = [ | |
"^== docker tool found at %s/bin/docker" % self.test_prefix, | |
- "^== Dockerfile definition file created at %s/containers/Dockerfile\.toy-0.0" % self.test_prefix, | |
- "^== Running 'sudo docker build -f .* -t .* \.', you may need to enter your 'sudo' password...", | |
+ r"^== Dockerfile definition file created at %s/containers/Dockerfile\.toy-0.0" % self.test_prefix, | |
+ r"^== Running 'sudo docker build -f .* -t .* \.', you may need to enter your 'sudo' password...", | |
"^== Docker image created at toy-0.0:latest", | |
] | |
self.check_regexs(regexs, stdout) | |
diff --git a/test/framework/docs.py b/test/framework/docs.py | |
index 7a12ed04d..f6716ea17 100644 | |
--- a/test/framework/docs.py | |
+++ b/test/framework/docs.py | |
@@ -109,7 +109,7 @@ class DocsTest(EnhancedTestCase): | |
self.assertTrue(gplv3 in lic_docs, "%s found in: %s" % (gplv3, lic_docs)) | |
lic_docs = avail_easyconfig_licenses(output_format='rst') | |
- regex = re.compile("^``GPLv3``\s*The GNU General Public License", re.M) | |
+ regex = re.compile(r"^``GPLv3``\s*The GNU General Public License", re.M) | |
self.assertTrue(regex.search(lic_docs), "%s found in: %s" % (regex.pattern, lic_docs)) | |
def test_list_software(self): | |
@@ -260,7 +260,7 @@ class DocsTest(EnhancedTestCase): | |
] | |
txt = list_software(output_format='txt', detailed=True) | |
lines = txt.split('\n') | |
- expected_found = any([lines[i:i+len(expected)] == expected for i in range(len(lines))]) | |
+ expected_found = any([lines[i:i + len(expected)] == expected for i in range(len(lines))]) | |
self.assertTrue(expected_found, "%s found in: %s" % (expected, lines)) | |
expected = [ | |
@@ -283,7 +283,7 @@ class DocsTest(EnhancedTestCase): | |
] | |
txt = list_software(output_format='rst', detailed=True) | |
lines = txt.split('\n') | |
- expected_found = any([lines[i:i+len(expected)] == expected for i in range(len(lines))]) | |
+ expected_found = any([lines[i:i + len(expected)] == expected for i in range(len(lines))]) | |
self.assertTrue(expected_found, "%s found in: %s" % (expected, lines)) | |
diff --git a/test/framework/easyblock.py b/test/framework/easyblock.py | |
index 057bcfb56..3dc2c68cc 100644 | |
--- a/test/framework/easyblock.py | |
+++ b/test/framework/easyblock.py | |
@@ -53,6 +53,7 @@ from easybuild.tools.utilities import time2str | |
from easybuild.tools.version import get_git_revision, this_is_easybuild | |
from easybuild.tools.py2vs3 import string_type | |
+ | |
class EasyBlockTest(EnhancedTestCase): | |
""" Baseclass for easyblock testcases """ | |
@@ -287,7 +288,7 @@ class EasyBlockTest(EnhancedTestCase): | |
elif get_module_syntax() == 'Lua': | |
regexs = [r'^prepend_path\("MODULEPATH", ".*/modules/funky/Compiler/pi/3.14/%s"\)$' % c for c in modclasses] | |
home = r'os.getenv\("HOME"\)' | |
- pj_usermodsdir = 'pathJoin\("%s", "funky", "Compiler/pi/3.14"\)' % usermodsdir | |
+ pj_usermodsdir = r'pathJoin\("%s", "funky", "Compiler/pi/3.14"\)' % usermodsdir | |
regexs.extend([ | |
# extension for user modules is guarded | |
r'if isDir\(pathJoin\(%s, %s\)\) then' % (home, pj_usermodsdir), | |
@@ -993,7 +994,7 @@ class EasyBlockTest(EnhancedTestCase): | |
# [==[ or ]==] in description is fatal | |
if get_module_syntax() == 'Lua': | |
- error_pattern = "Found unwanted '\[==\[' or '\]==\]' in: .*" | |
+ error_pattern = r"Found unwanted '\[==\[' or '\]==\]' in: .*" | |
for descr in ["test [==[", "]==] foo"]: | |
ectxt = read_file(self.eb_file) | |
write_file(self.eb_file, re.sub('description.*', 'description = "%s"' % descr, ectxt)) | |
@@ -1195,7 +1196,7 @@ class EasyBlockTest(EnhancedTestCase): | |
# old format for specifying source with custom extract command is deprecated | |
eb.src = [] | |
- error_msg = "DEPRECATED \(since v4.0\).*Using a 2-element list/tuple.*" | |
+ error_msg = r"DEPRECATED \(since v4.0\).*Using a 2-element list/tuple.*" | |
self.assertErrorRegex(EasyBuildError, error_msg, eb.fetch_sources, | |
[('toy-0.0_gzip.patch.gz', "gunzip %s")], checksums=[]) | |
diff --git a/test/framework/easyconfig.py b/test/framework/easyconfig.py | |
index 0f45797bc..f3239de88 100644 | |
--- a/test/framework/easyconfig.py | |
+++ b/test/framework/easyconfig.py | |
@@ -558,12 +558,12 @@ class EasyConfigTest(EnhancedTestCase): | |
homepage = "http://www.justatest.com" | |
tweaks = { | |
- 'version': ver, | |
- 'versionprefix': verpref, | |
- 'versionsuffix': versuff, | |
- 'toolchain_version': tcver, | |
- 'patches': new_patches | |
- } | |
+ 'version': ver, | |
+ 'versionprefix': verpref, | |
+ 'versionsuffix': versuff, | |
+ 'toolchain_version': tcver, | |
+ 'patches': new_patches | |
+ } | |
tweak_one(self.eb_file, tweaked_fn, tweaks) | |
eb = EasyConfig(tweaked_fn) | |
@@ -939,11 +939,11 @@ class EasyConfigTest(EnhancedTestCase): | |
def test_templating(self): | |
""" test easyconfig templating """ | |
inp = { | |
- 'name': 'PI', | |
- # purposely using minor version that starts with a 0, to check for correct version_minor value | |
- 'version': '3.04', | |
- 'namelower': 'pi', | |
- 'cmd': 'tar xfvz %s', | |
+ 'name': 'PI', | |
+ # purposely using minor version that starts with a 0, to check for correct version_minor value | |
+ 'version': '3.04', | |
+ 'namelower': 'pi', | |
+ 'cmd': 'tar xfvz %s', | |
} | |
# don't use any escaping insanity here, since it is templated itself | |
self.contents = '\n'.join([ | |
@@ -1028,8 +1028,8 @@ class EasyConfigTest(EnhancedTestCase): | |
doc = avail_easyconfig_constants() | |
# expected length: 1 per constant and 1 extra per constantgroup | |
temps = [ | |
- easyconfig.constants.EASYCONFIG_CONSTANTS, | |
- ] | |
+ easyconfig.constants.EASYCONFIG_CONSTANTS, | |
+ ] | |
self.assertEqual(len(doc.split('\n')), sum([len(temps)] + [len(x) for x in temps])) | |
def test_build_options(self): | |
@@ -1987,17 +1987,17 @@ class EasyConfigTest(EnhancedTestCase): | |
# check internal structure to keep track of comments | |
self.assertEqual(ec.parser._formatter.comments['above'], { | |
- 'dependencies': [ | |
- '# this is a multiline comment above dependencies', | |
- '# I said multiline', | |
- '# multi > 3', | |
- ], | |
- 'sanity_check_paths': ['# how about comments above and in a dict value?'], | |
- 'source_urls': ['# how about # a comment with # multple additional hashes'], | |
- 'sources': ['# after toolchain, before sources comment', | |
- '', | |
- '# this comment contains another #, uh-oh...'], | |
- 'version': ["# the version doesn't matter much here"], | |
+ 'dependencies': [ | |
+ '# this is a multiline comment above dependencies', | |
+ '# I said multiline', | |
+ '# multi > 3', | |
+ ], | |
+ 'sanity_check_paths': ['# how about comments above and in a dict value?'], | |
+ 'source_urls': ['# how about # a comment with # multple additional hashes'], | |
+ 'sources': ['# after toolchain, before sources comment', | |
+ '', | |
+ '# this comment contains another #, uh-oh...'], | |
+ 'version': ["# the version doesn't matter much here"], | |
}) | |
self.assertEqual(ec.parser._formatter.comments['header'], [ | |
'# this is a header', | |
diff --git a/test/framework/easyconfigversion.py b/test/framework/easyconfigversion.py | |
index 2fc9b0c60..8547b2ce6 100644 | |
--- a/test/framework/easyconfigversion.py | |
+++ b/test/framework/easyconfigversion.py | |
@@ -215,7 +215,7 @@ class EasyConfigVersion(EnhancedTestCase): | |
(tc, '1.2.2', False), # version not ok, name ok | |
('x' + tc, '1.2.3', False), # version ok, name not ok | |
('x' + tc, '1.2.2', False), # version not ok, name not ok | |
- )), | |
+ )), | |
] | |
for txt, subtests in tests: | |
tcversop = ToolchainVersionOperator(txt) | |
diff --git a/test/framework/general.py b/test/framework/general.py | |
index 0f2227226..07e8c3601 100644 | |
--- a/test/framework/general.py | |
+++ b/test/framework/general.py | |
@@ -49,9 +49,9 @@ class GeneralTest(EnhancedTestCase): | |
easybuild_loc = os.path.dirname(os.path.dirname(os.path.abspath(easybuild.framework.__file__))) | |
log_method_regexes = [ | |
- re.compile("log\.error\("), | |
- re.compile("log\.exception\("), | |
- re.compile("log\.raiseException\("), | |
+ re.compile(r"log\.error\("), | |
+ re.compile(r"log\.exception\("), | |
+ re.compile(r"log\.raiseException\("), | |
] | |
for dirpath, _, filenames in os.walk(easybuild_loc): | |
diff --git a/test/framework/github.py b/test/framework/github.py | |
index bb1e4be68..fe5cf22c8 100644 | |
--- a/test/framework/github.py | |
+++ b/test/framework/github.py | |
@@ -87,7 +87,7 @@ class GithubTest(EnhancedTestCase): | |
try: | |
expected = [(None, ['a_directory', 'second_dir'], ['README.md']), | |
('a_directory', ['a_subdirectory'], ['a_file.txt']), ('a_directory/a_subdirectory', [], | |
- ['a_file.txt']), ('second_dir', [], ['a_file.txt'])] | |
+ ['a_file.txt']), ('second_dir', [], ['a_file.txt'])] | |
self.assertEqual([x for x in self.ghfs.walk(None)], expected) | |
except IOError: | |
pass | |
@@ -403,7 +403,7 @@ class GithubTest(EnhancedTestCase): | |
print("Skipping test_find_easybuild_easyconfig, no GitHub token available?") | |
return | |
path = gh.find_easybuild_easyconfig(github_user=GITHUB_TEST_ACCOUNT) | |
- expected = os.path.join('e', 'EasyBuild', 'EasyBuild-[1-9]+\.[0-9]+\.[0-9]+\.eb') | |
+ expected = os.path.join('e', 'EasyBuild', r'EasyBuild-[1-9]+\.[0-9]+\.[0-9]+\.eb') | |
regex = re.compile(expected) | |
self.assertTrue(regex.search(path), "Pattern '%s' found in '%s'" % (regex.pattern, path)) | |
self.assertTrue(os.path.exists(path), "Path %s exists" % path) | |
@@ -542,9 +542,9 @@ class GithubTest(EnhancedTestCase): | |
patch_paths = [os.path.join(self.test_prefix, p) for p in ['1.patch', '2.patch', '3.patch']] | |
file_info = {'ecs': [ | |
- {'name': 'A', 'patches': ['1.patch'], 'exts_list': []}, | |
- {'name': 'B', 'patches': [], 'exts_list': []}, | |
- ] | |
+ {'name': 'A', 'patches': ['1.patch'], 'exts_list': []}, | |
+ {'name': 'B', 'patches': [], 'exts_list': []}, | |
+ ] | |
} | |
error_pattern = "Failed to determine software name to which patch file .*/2.patch relates" | |
self.mock_stdout(True) | |
diff --git a/test/framework/include.py b/test/framework/include.py | |
index 9bf791e50..16dd73986 100644 | |
--- a/test/framework/include.py | |
+++ b/test/framework/include.py | |
@@ -41,7 +41,7 @@ from easybuild.tools.include import is_software_specific_easyblock | |
def up(path, cnt): | |
"""Return path N times up.""" | |
if cnt > 0: | |
- path = up(os.path.dirname(path), cnt-1) | |
+ path = up(os.path.dirname(path), cnt - 1) | |
return path | |
diff --git a/test/framework/lib.py b/test/framework/lib.py | |
index ae1122582..5bd099ed3 100644 | |
--- a/test/framework/lib.py | |
+++ b/test/framework/lib.py | |
@@ -80,7 +80,7 @@ class EasyBuildLibTest(TestCase): | |
"""Test use of run_cmd function in the context of using EasyBuild framework as a library.""" | |
error_pattern = "Undefined build option: .*" | |
- error_pattern += " Make sure you have set up the EasyBuild configuration using set_up_configuration\(\)" | |
+ error_pattern += r" Make sure you have set up the EasyBuild configuration using set_up_configuration\(\)" | |
self.assertErrorRegex(EasyBuildError, error_pattern, run_cmd, "echo hello") | |
self.configure() | |
@@ -96,7 +96,7 @@ class EasyBuildLibTest(TestCase): | |
test_dir = os.path.join(self.tmpdir, 'test123') | |
error_pattern = "Undefined build option: .*" | |
- error_pattern += " Make sure you have set up the EasyBuild configuration using set_up_configuration\(\)" | |
+ error_pattern += r" Make sure you have set up the EasyBuild configuration using set_up_configuration\(\)" | |
self.assertErrorRegex(EasyBuildError, error_pattern, mkdir, test_dir) | |
self.configure() | |
@@ -110,7 +110,7 @@ class EasyBuildLibTest(TestCase): | |
"""Test use of modules_tool function in the context of using EasyBuild framework as a library.""" | |
error_pattern = "Undefined build option: .*" | |
- error_pattern += " Make sure you have set up the EasyBuild configuration using set_up_configuration\(\)" | |
+ error_pattern += r" Make sure you have set up the EasyBuild configuration using set_up_configuration\(\)" | |
self.assertErrorRegex(EasyBuildError, error_pattern, modules_tool) | |
self.configure() | |
diff --git a/test/framework/module_generator.py b/test/framework/module_generator.py | |
index 81ce79421..1b73ec3f1 100644 | |
--- a/test/framework/module_generator.py | |
+++ b/test/framework/module_generator.py | |
@@ -1322,11 +1322,11 @@ class ModuleGeneratorTest(EnhancedTestCase): | |
init_config(build_options=build_options) | |
test_ecs = { | |
- 'GCC-6.4.0-2.28.eb': ('compiler/GCC/6.4.0-2.28', '', [], [], []), | |
+ 'GCC-6.4.0-2.28.eb': ('compiler/GCC/6.4.0-2.28', '', [], [], []), | |
'OpenMPI-2.1.2-GCC-6.4.0-2.28.eb': ('mpi/OpenMPI/2.1.2-GCC-6.4.0-2.28', '', [], [], []), | |
- 'gzip-1.5-foss-2018a.eb': ('tools/gzip/1.5-foss-2018a', '', [], [], []), | |
- 'foss-2018a.eb': ('toolchain/foss/2018a', '', [], [], []), | |
- 'impi-5.1.2.150.eb': ('mpi/impi/5.1.2.150', '', [], [], []), | |
+ 'gzip-1.5-foss-2018a.eb': ('tools/gzip/1.5-foss-2018a', '', [], [], []), | |
+ 'foss-2018a.eb': ('toolchain/foss/2018a', '', [], [], []), | |
+ 'impi-5.1.2.150.eb': ('mpi/impi/5.1.2.150', '', [], [], []), | |
} | |
for ecfile, mns_vals in test_ecs.items(): | |
test_ec(ecfile, *mns_vals) | |
diff --git a/test/framework/modules.py b/test/framework/modules.py | |
index ca3d826e7..072efe64e 100644 | |
--- a/test/framework/modules.py | |
+++ b/test/framework/modules.py | |
@@ -890,7 +890,7 @@ class ModulesTest(EnhancedTestCase): | |
# exact error message depends on Lmod version | |
load_err_msg = '|'.join([ | |
r'These[\s\sn]*module\(s\)[\s\sn]*exist[\s\sn]*but[\s\sn]*cannot[\s\sn]*be', | |
- 'The[\s\sn]*following[\s\sn]*module\(s\)[\s\sn]*are[\s\sn]*unknown', | |
+ r'The[\s\sn]*following[\s\sn]*module\(s\)[\s\sn]*are[\s\sn]*unknown', | |
]) | |
else: | |
load_err_msg = "Unable to locate a modulefile" | |
@@ -1100,7 +1100,7 @@ class ModulesTest(EnhancedTestCase): | |
r"^\* GCC/6.4.0-2.28", | |
r"^\* hwloc/1.11.8-GCC-6.4.0-2.28", | |
r"^\* OpenMPI/2.1.2-GCC-6.4.0-2.28", | |
- "This is not recommended since it may affect the installation procedure\(s\) performed by EasyBuild.", | |
+ r"This is not recommended since it may affect the installation procedure\(s\) performed by EasyBuild.", | |
"To make EasyBuild allow particular loaded modules, use the --allow-loaded-modules configuration option.", | |
"To specify action to take when loaded modules are detected, use " | |
"--detect-loaded-modules={error,ignore,purge,unload,warn}", | |
@@ -1118,7 +1118,7 @@ class ModulesTest(EnhancedTestCase): | |
# error mentioning 1 non-allowed module (OpenMPI), both GCC and hwloc loaded modules are allowed | |
error_pattern = r"Found one or more non-allowed loaded .* module.*\n" | |
- error_pattern += "\* OpenMPI/2.1.2-GCC-6.4.0-2.28\n\nThis is not" | |
+ error_pattern += r"\* OpenMPI/2.1.2-GCC-6.4.0-2.28\n\nThis is not" | |
self.assertErrorRegex(EasyBuildError, error_pattern, self.modtool.check_loaded_modules) | |
# check for warning message when purge is being run on loaded modules | |
diff --git a/test/framework/options.py b/test/framework/options.py | |
index e4eed050d..e6c8e557a 100644 | |
--- a/test/framework/options.py | |
+++ b/test/framework/options.py | |
@@ -125,12 +125,12 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
if txt is None: | |
topt = EasyBuildOptions( | |
- go_args=['-h'], | |
- go_nosystemexit=True, # when printing help, optparse ends with sys.exit | |
- go_columns=100, # fix col size for reproducible unittest output | |
- help_to_string=True, # don't print to stdout, but to StingIO fh, | |
- prog='easybuildoptions_test', # generate as if called from generaloption.py | |
- ) | |
+ go_args=['-h'], | |
+ go_nosystemexit=True, # when printing help, optparse ends with sys.exit | |
+ go_columns=100, # fix col size for reproducible unittest output | |
+ help_to_string=True, # don't print to stdout, but to StingIO fh, | |
+ prog='easybuildoptions_test', # generate as if called from generaloption.py | |
+ ) | |
outtxt = topt.parser.help_to_file.getvalue() | |
else: | |
@@ -148,12 +148,12 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
"""Test long help message.""" | |
topt = EasyBuildOptions( | |
- go_args=['-H'], | |
- go_nosystemexit=True, # when printing help, optparse ends with sys.exit | |
- go_columns=200, # fix col size for reproducible unittest output | |
- help_to_string=True, # don't print to stdout, but to StingIO fh, | |
- prog='easybuildoptions_test', # generate as if called from generaloption.py | |
- ) | |
+ go_args=['-H'], | |
+ go_nosystemexit=True, # when printing help, optparse ends with sys.exit | |
+ go_columns=200, # fix col size for reproducible unittest output | |
+ help_to_string=True, # don't print to stdout, but to StingIO fh, | |
+ prog='easybuildoptions_test', # generate as if called from generaloption.py | |
+ ) | |
outtxt = topt.parser.help_to_file.getvalue() | |
self.assertTrue(re.search("-H OUTPUT_FORMAT, --help=OUTPUT_FORMAT", outtxt), | |
@@ -198,9 +198,9 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
for info_arg in ['--info']: | |
args = [ | |
- 'nosuchfile.eb', | |
- info_arg, | |
- ] | |
+ 'nosuchfile.eb', | |
+ info_arg, | |
+ ] | |
outtxt = self.eb_main(args) | |
error_tmpl = "%s log messages are included when using %s ( out: %s)" | |
@@ -236,9 +236,9 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
# check log message without --force | |
args = [ | |
- eb_file, | |
- '--debug', | |
- ] | |
+ eb_file, | |
+ '--debug', | |
+ ] | |
outtxt, error_thrown = self.eb_main(args, return_error=True) | |
error_msg = "No error is thrown if software is already installed (error_thrown: %s)" % error_thrown | |
@@ -317,7 +317,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
# make sure that sanity check is *NOT* skipped under --skip | |
test_ec = os.path.join(self.test_prefix, 'test.eb') | |
test_ec_txt = read_file(toy_ec) | |
- regex = re.compile("sanity_check_paths = \{(.|\n)*\}", re.M) | |
+ regex = re.compile(r"sanity_check_paths = \{(.|\n)*\}", re.M) | |
test_ec_txt = regex.sub("sanity_check_paths = {'files': ['bin/nosuchfile'], 'dirs': []}", test_ec_txt) | |
write_file(test_ec, test_ec_txt) | |
args = [ | |
@@ -350,12 +350,12 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
write_file(self.logfile, '') | |
args = [ | |
- eb_file, | |
- '--job', | |
- ] + job_args | |
+ eb_file, | |
+ '--job', | |
+ ] + job_args | |
outtxt = self.eb_main(args) | |
- job_msg = "INFO.* Command template for jobs: .* && eb %%\(spec\)s.* %s.*\n" % ' .*'.join(passed_args) | |
+ job_msg = r"INFO.* Command template for jobs: .* && eb %%\(spec\)s.* %s.*\n" % ' .*'.join(passed_args) | |
assertmsg = "Info log msg with job command template for --job (job_msg: %s, outtxt: %s)" % (job_msg, outtxt) | |
self.assertTrue(re.search(job_msg, outtxt), assertmsg) | |
@@ -462,7 +462,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
param_start = 0 | |
for param in params: | |
# regex for parameter name (with optional '*') & description, matches both txt and rst formats | |
- regex = re.compile("^[`]*%s(?:\*)?[`]*\s+\w+" % param, re.M) | |
+ regex = re.compile(r"^[`]*%s(?:\*)?[`]*\s+\w+" % param, re.M) | |
tup = (param, avail_arg, args, regex.pattern, logtxt) | |
msg = "Parameter %s is listed with help in output of eb %s (args: %s, regex: %s): %s" % tup | |
res = regex.search(logtxt) | |
@@ -490,9 +490,9 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
os.close(fd) | |
args = [ | |
- '--list-toolchains', | |
- '--unittest-file=%s' % self.logfile, | |
- ] | |
+ '--list-toolchains', | |
+ '--unittest-file=%s' % self.logfile, | |
+ ] | |
self.eb_main(args, logfile=dummylogfn, raise_error=True) | |
info_msg = r"INFO List of known toolchains \(toolchainname: module\[,module\.\.\.\]\):" | |
@@ -505,7 +505,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
'intel': ['icc', 'ifort', 'imkl', 'impi'], | |
} | |
for tc, tcelems in tcs.items(): | |
- res = re.findall("^\s*%s: .*" % tc, logtxt, re.M) | |
+ res = re.findall(r"^\s*%s: .*" % tc, logtxt, re.M) | |
self.assertTrue(res, "Toolchain %s is included in list of known compiler toolchains" % tc) | |
# every toolchain should only be mentioned once | |
n = len(res) | |
@@ -528,9 +528,9 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
} | |
for (name, items) in name_items.items(): | |
args = [ | |
- '--avail-%s' % name, | |
- '--unittest-file=%s' % self.logfile, | |
- ] | |
+ '--avail-%s' % name, | |
+ '--unittest-file=%s' % self.logfile, | |
+ ] | |
self.eb_main(args, logfile=dummylogfn) | |
logtxt = read_file(self.logfile) | |
@@ -538,7 +538,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
info_msg = r"INFO List of supported %s:" % words | |
self.assertTrue(re.search(info_msg, logtxt), "Info message with list of available %s" % words) | |
for item in items: | |
- res = re.findall("^\s*%s" % item, logtxt, re.M) | |
+ res = re.findall(r"^\s*%s" % item, logtxt, re.M) | |
self.assertTrue(res, "%s is included in list of available %s" % (item, words)) | |
# every item should only be mentioned once | |
n = len(res) | |
@@ -594,9 +594,9 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
write_file(self.logfile, '') | |
args = [ | |
- list_arg, | |
- '--unittest-file=%s' % self.logfile, | |
- ] | |
+ list_arg, | |
+ '--unittest-file=%s' % self.logfile, | |
+ ] | |
self.eb_main(args, logfile=dummylogfn) | |
logtxt = read_file(self.logfile) | |
@@ -635,9 +635,9 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
# detailed view | |
args = [ | |
- '--list-easyblocks=detailed', | |
- '--unittest-file=%s' % self.logfile, | |
- ] | |
+ '--list-easyblocks=detailed', | |
+ '--unittest-file=%s' % self.logfile, | |
+ ] | |
self.eb_main(args, logfile=dummylogfn) | |
logtxt = read_file(self.logfile) | |
@@ -738,7 +738,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
txt = self.get_stdout() | |
self.mock_stdout(False) | |
- self.assertTrue(re.search('^CFGS\d+=', txt, re.M), "CFGS line message found in '%s'" % txt) | |
+ self.assertTrue(re.search(r'^CFGS\d+=', txt, re.M), "CFGS line message found in '%s'" % txt) | |
for ec in ["toy-0.0.eb", "toy-0.0-multiple.eb"]: | |
regex = re.compile(r" \* \$CFGS\d+/*%s" % ec, re.M) | |
self.assertTrue(regex.search(txt), "Found pattern '%s' in: %s" % (regex.pattern, txt)) | |
@@ -1063,7 +1063,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
("FFTW-3.3.7-gompi-2018b.eb", "FFTW/3.3.7-gompi-2018b", 'F'), | |
] | |
for ec, mod, mark in ecs_mods: | |
- regex = re.compile("^ \* \[%s\] \S+%s \(module: %s\)$" % (mark, ec, mod), re.M) | |
+ regex = re.compile(r"^ \* \[%s\] \S+%s \(module: %s\)$" % (mark, ec, mod), re.M) | |
self.assertTrue(regex.search(outtxt), "Found match for pattern %s in '%s'" % (regex.pattern, outtxt)) | |
def test_try_toolchain_mapping(self): | |
@@ -1136,7 +1136,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
("gzip-1.5-foss-2018a.eb", "MPI/GCC/6.4.0-2.28/OpenMPI/2.1.2", "gzip/1.5", ' '), | |
] | |
for ec, mod_subdir, mod_name, mark in ecs_mods: | |
- regex = re.compile("^ \* \[%s\] \S+%s \(module: %s \| %s\)$" % (mark, ec, mod_subdir, mod_name), re.M) | |
+ regex = re.compile(r"^ \* \[%s\] \S+%s \(module: %s \| %s\)$" % (mark, ec, mod_subdir, mod_name), re.M) | |
self.assertTrue(regex.search(outtxt), "Found match for pattern %s in '%s'" % (regex.pattern, outtxt)) | |
if os.path.exists(dummylogfn): | |
@@ -1177,7 +1177,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
("gzip-1.5-foss-2018a.eb", "MPI/GCC/6.4.0-2.28/OpenMPI/2.1.2/tools", "gzip/1.5", ' '), | |
] | |
for ec, mod_subdir, mod_name, mark in ecs_mods: | |
- regex = re.compile("^ \* \[%s\] \S+%s \(module: %s \| %s\)$" % (mark, ec, mod_subdir, mod_name), re.M) | |
+ regex = re.compile(r"^ \* \[%s\] \S+%s \(module: %s \| %s\)$" % (mark, ec, mod_subdir, mod_name), re.M) | |
self.assertTrue(regex.search(outtxt), "Found match for pattern %s in '%s'" % (regex.pattern, outtxt)) | |
if os.path.exists(dummylogfn): | |
@@ -1370,10 +1370,10 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
"""Test using no arguments.""" | |
args = [ | |
- '--software-name=nosuchsoftware', | |
- '--robot=.', | |
- '--debug', | |
- ] | |
+ '--software-name=nosuchsoftware', | |
+ '--robot=.', | |
+ '--debug', | |
+ ] | |
outtxt = self.eb_main(args) | |
# error message when template is not found | |
@@ -1539,7 +1539,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
regex = re.compile("Checking OS dependencies") | |
self.assertTrue(regex.search(outtxt), "OS dependencies are checked, outtxt: %s" % outtxt) | |
msg = "One or more OS dependencies were not found: " | |
- msg += "\[\('nosuchosdependency',\), \('nosuchdep_option1', 'nosuchdep_option2'\)\]" | |
+ msg += r"\[\('nosuchosdependency',\), \('nosuchdep_option1', 'nosuchdep_option2'\)\]" | |
regex = re.compile(r'%s' % msg, re.M) | |
self.assertTrue(regex.search(outtxt), "OS dependencies are honored, outtxt: %s" % outtxt) | |
@@ -1764,7 +1764,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
for extra_args, mod in test_cases: | |
outtxt = self.eb_main(args + extra_args, verbose=True, raise_error=True) | |
- mod_regex = re.compile("\(module: %s\)$" % mod, re.M) | |
+ mod_regex = re.compile(r"\(module: %s\)$" % mod, re.M) | |
self.assertTrue(mod_regex.search(outtxt), "Pattern %s found in %s" % (mod_regex.pattern, outtxt)) | |
for extra_arg in ['--try-software=foo', '--try-toolchain=gompi', '--try-toolchain=gomp,2018a,-a-suffix']: | |
@@ -1825,7 +1825,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
outtxt = self.eb_main(args + extra_args, verbose=True, raise_error=True) | |
# toolchain GCC/4.7.2 (subtoolchain of gompi/2018a) should be listed (and present) | |
- tc_regex = re.compile("^ \* \[x\] .*/GCC-6.4.0-2.28.eb \(module: .*GCC/6.4.0-2.28\)$", re.M) | |
+ tc_regex = re.compile(r"^ \* \[x\] .*/GCC-6.4.0-2.28.eb \(module: .*GCC/6.4.0-2.28\)$", re.M) | |
self.assertTrue(tc_regex.search(outtxt), "Pattern %s found in %s" % (tc_regex.pattern, outtxt)) | |
# both toy and gzip dependency should be listed with new toolchains | |
@@ -1837,7 +1837,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
mod = ec_name.replace('-', '/') | |
else: | |
mod = '%s-GCC-6.4.0-2.28' % ec_name.replace('-', '/') | |
- mod_regex = re.compile("^ \* \[ \] \S+/eb-\S+/%s \(module: .*%s\)$" % (ec, mod), re.M) | |
+ mod_regex = re.compile(r"^ \* \[ \] \S+/eb-\S+/%s \(module: .*%s\)$" % (ec, mod), re.M) | |
self.assertTrue(mod_regex.search(outtxt), "Pattern %s found in %s" % (mod_regex.pattern, outtxt)) | |
# clear fictious dependency | |
@@ -1849,10 +1849,10 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
for extra_args in [['--try-software-version=1.2.3'], ['--software-version=1.2.3']]: | |
outtxt = self.eb_main(args + extra_args, raise_error=True) | |
for mod in ['toy/1.2.3-gompi-2018a', 'gompi/2018a', 'GCC/6.4.0-2.28']: | |
- mod_regex = re.compile("\(module: %s\)$" % mod, re.M) | |
+ mod_regex = re.compile(r"\(module: %s\)$" % mod, re.M) | |
self.assertTrue(mod_regex.search(outtxt), "Pattern %s found in %s" % (mod_regex.pattern, outtxt)) | |
for mod in ['gompi/1.2.3', 'GCC/1.2.3']: | |
- mod_regex = re.compile("\(module: %s\)$" % mod, re.M) | |
+ mod_regex = re.compile(r"\(module: %s\)$" % mod, re.M) | |
self.assertFalse(mod_regex.search(outtxt), "Pattern %s found in %s" % (mod_regex.pattern, outtxt)) | |
def test_cleanup_builddir(self): | |
@@ -2053,8 +2053,8 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
'--hide-toolchains=GCC', | |
] | |
outtxt = self.eb_main(args) | |
- self.assertTrue(re.search('module: GCC/\.4\.9\.2', outtxt)) | |
- self.assertTrue(re.search('module: gzip/1\.6-GCC-4\.9\.2', outtxt)) | |
+ self.assertTrue(re.search(r'module: GCC/\.4\.9\.2', outtxt)) | |
+ self.assertTrue(re.search(r'module: gzip/1\.6-GCC-4\.9\.2', outtxt)) | |
def test_test_report_env_filter(self): | |
"""Test use of --test-report-env-filter.""" | |
@@ -2122,7 +2122,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
eb_file, | |
'--robot-paths=%s' % test_ecs_path, | |
] | |
- error_regex = "Missing modules for dependencies .*: toy/\.0.0-deps" | |
+ error_regex = r"Missing modules for dependencies .*: toy/\.0.0-deps" | |
self.assertErrorRegex(EasyBuildError, error_regex, self.eb_main, args, raise_error=True, do_build=True) | |
# enable robot, but without passing path required to resolve toy dependency => FAIL | |
@@ -2771,7 +2771,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
mytmpdir = set_tmpdir(tmpdir=tmpdir) | |
- parent = re.sub('[^\w/.-]', 'X', parent) | |
+ parent = re.sub(r'[^\w/.-]', 'X', parent) | |
for var in ['TMPDIR', 'TEMP', 'TMP']: | |
self.assertTrue(os.environ[var].startswith(os.path.join(parent, 'eb-'))) | |
@@ -2837,8 +2837,8 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
txt = self.get_stdout() | |
self.mock_stdout(False) | |
comp = 'Compiler/GCC/6.4.0-2.28' | |
- sqlite_regex = re.compile("hwloc-1.11.8-GCC-6.4.0-2.28.eb \(module: %s \| hwloc/" % comp, re.M) | |
- sqlite_regex = re.compile("SQLite-3.8.10.2-GCC-6.4.0-2.28.eb \(module: %s \| SQLite/" % comp, re.M) | |
+ sqlite_regex = re.compile(r"hwloc-1.11.8-GCC-6.4.0-2.28.eb \(module: %s \| hwloc/" % comp, re.M) | |
+ sqlite_regex = re.compile(r"SQLite-3.8.10.2-GCC-6.4.0-2.28.eb \(module: %s \| SQLite/" % comp, re.M) | |
self.assertTrue(sqlite_regex.search(txt), "Pattern '%s' found in: %s" % (sqlite_regex.pattern, txt)) | |
def test_extended_dry_run(self): | |
@@ -3218,7 +3218,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
args.append('--pr-commit-msg=this is just a test') | |
txt, _ = self._run_mock_eb(args, do_build=True, raise_error=True, testing=False) | |
- regex = re.compile('^\* title: "this is just a test"', re.M) | |
+ regex = re.compile(r'^\* title: "this is just a test"', re.M) | |
self.assertTrue(regex.search(txt), "Pattern '%s' is found in: %s" % (regex.pattern, txt)) | |
args = [ | |
@@ -3268,7 +3268,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
regexs = [ | |
"# Built with EasyBuild", | |
"# Build statistics", | |
- "buildstats\s*=", | |
+ r"buildstats\s*=", | |
] | |
self._assert_regexs(regexs, txt, assert_true=False) | |
@@ -3658,8 +3658,8 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
patterns = [ | |
"^# Current EasyBuild configuration", | |
- "^module-syntax\s*\(C\) = Tcl", | |
- "^modules-tool\s*\(E\) = EnvironmentModulesC", | |
+ r"^module-syntax\s*\(C\) = Tcl", | |
+ r"^modules-tool\s*\(E\) = EnvironmentModulesC", | |
] | |
for pattern in patterns: | |
regex = re.compile(pattern, re.M) | |
@@ -3680,8 +3680,8 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
patterns = [ | |
"^# Current EasyBuild configuration", | |
- "^module-syntax\s*\(C\) = Tcl", | |
- "^modules-tool\s*\(E\) = EnvironmentModulesC", | |
+ r"^module-syntax\s*\(C\) = Tcl", | |
+ r"^modules-tool\s*\(E\) = EnvironmentModulesC", | |
] | |
# EnvironmentModulesC modules tool + Tcl module syntax is fine | |
@@ -3693,7 +3693,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
# default modules tool (Lmod) with Tcl module syntax is also fine | |
del os.environ['EASYBUILD_MODULES_TOOL'] | |
- patterns[-1] = "^modules-tool\s*\(D\) = Lmod" | |
+ patterns[-1] = r"^modules-tool\s*\(D\) = Lmod" | |
stdout, _ = self._run_mock_eb(args, do_build=True, raise_error=True, testing=False, redo_init_config=False) | |
for pattern in patterns: | |
regex = re.compile(pattern, re.M) | |
@@ -3703,7 +3703,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
"""Test which configuration settings are affected by --prefix.""" | |
txt, _ = self._run_mock_eb(['--show-full-config', '--prefix=%s' % self.test_prefix], raise_error=True) | |
- regex = re.compile("(?P<cfg_opt>\S*).*%s.*" % self.test_prefix, re.M) | |
+ regex = re.compile(r"(?P<cfg_opt>\S*).*%s.*" % self.test_prefix, re.M) | |
expected = ['buildpath', 'containerpath', 'installpath', 'packagepath', 'prefix', 'repositorypath'] | |
self.assertEqual(sorted(regex.findall(txt)), expected) | |
@@ -3789,7 +3789,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
regex = re.compile(pattern, re.M) | |
self.assertTrue(regex.search(stdout), "Pattern '%s' not found in: %s" % (regex.pattern, stdout)) | |
- regex = re.compile("^== creating build dir, resetting environment\.\.\.$") | |
+ regex = re.compile(r"^== creating build dir, resetting environment\.\.\.$") | |
self.assertFalse(regex.search(stdout), "Pattern '%s' found in: %s" % (regex.pattern, stdout)) | |
def test_parse_external_modules_metadata(self): | |
@@ -3943,19 +3943,19 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
def test_list_prs(self): | |
"""Test --list-prs.""" | |
args = ['--list-prs', 'foo'] | |
- error_msg = "must be one of \['open', 'closed', 'all'\]" | |
+ error_msg = r"must be one of \['open', 'closed', 'all'\]" | |
self.assertErrorRegex(EasyBuildError, error_msg, self.eb_main, args, raise_error=True) | |
args = ['--list-prs', 'open,foo'] | |
- error_msg = "must be one of \['created', 'updated', 'popularity', 'long-running'\]" | |
+ error_msg = r"must be one of \['created', 'updated', 'popularity', 'long-running'\]" | |
self.assertErrorRegex(EasyBuildError, error_msg, self.eb_main, args, raise_error=True) | |
args = ['--list-prs', 'open,created,foo'] | |
- error_msg = "must be one of \['asc', 'desc'\]" | |
+ error_msg = r"must be one of \['asc', 'desc'\]" | |
self.assertErrorRegex(EasyBuildError, error_msg, self.eb_main, args, raise_error=True) | |
args = ['--list-prs', 'open,created,asc,foo'] | |
- error_msg = "must be in the format 'state\[,order\[,direction\]\]" | |
+ error_msg = r"must be in the format 'state\[,order\[,direction\]\]" | |
self.assertErrorRegex(EasyBuildError, error_msg, self.eb_main, args, raise_error=True) | |
args = ['--list-prs', 'closed,updated,asc'] | |
@@ -4368,17 +4368,17 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
bar_patch_bis = 'bar-0.0_fix-very-silly-typo-in-printf-statement.patch' | |
bar_patch_bis_sha256 = 'd0bf102f9c5878445178c5f49b7cd7546e704c33fe2060c7354b7e473cfeb52b' | |
patterns = [ | |
- "^== injecting sha256 checksums in .*/test\.eb$", | |
- "^== fetching sources & patches for test\.eb\.\.\.$", | |
- "^== backup of easyconfig file saved to .*/test\.eb\.bak_[0-9]+_[0-9]+\.\.\.$", | |
- "^== injecting sha256 checksums for sources & patches in test\.eb\.\.\.$", | |
- "^== \* toy-0.0\.tar\.gz: %s$" % toy_source_sha256, | |
- "^== \* toy-0\.0_fix-silly-typo-in-printf-statement\.patch: %s$" % toy_patch_sha256, | |
- "^== injecting sha256 checksums for extensions in test\.eb\.\.\.$", | |
- "^== \* bar-0\.0\.tar\.gz: %s$" % bar_tar_gz_sha256, | |
- "^== \* %s: %s$" % (bar_patch, bar_patch_sha256), | |
- "^== \* %s: %s$" % (bar_patch_bis, bar_patch_bis_sha256), | |
- "^== \* barbar-0\.0\.tar\.gz: a33100d1837d6d54edff7d19f195056c4bd9a4c8d399e72feaf90f0216c4c91c$", | |
+ r"^== injecting sha256 checksums in .*/test\.eb$", | |
+ r"^== fetching sources & patches for test\.eb\.\.\.$", | |
+ r"^== backup of easyconfig file saved to .*/test\.eb\.bak_[0-9]+_[0-9]+\.\.\.$", | |
+ r"^== injecting sha256 checksums for sources & patches in test\.eb\.\.\.$", | |
+ r"^== \* toy-0.0\.tar\.gz: %s$" % toy_source_sha256, | |
+ r"^== \* toy-0\.0_fix-silly-typo-in-printf-statement\.patch: %s$" % toy_patch_sha256, | |
+ r"^== injecting sha256 checksums for extensions in test\.eb\.\.\.$", | |
+ r"^== \* bar-0\.0\.tar\.gz: %s$" % bar_tar_gz_sha256, | |
+ r"^== \* %s: %s$" % (bar_patch, bar_patch_sha256), | |
+ r"^== \* %s: %s$" % (bar_patch_bis, bar_patch_bis_sha256), | |
+ r"^== \* barbar-0\.0\.tar\.gz: a33100d1837d6d54edff7d19f195056c4bd9a4c8d399e72feaf90f0216c4c91c$", | |
] | |
for pattern in patterns: | |
regex = re.compile(pattern, re.M) | |
@@ -4481,7 +4481,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
toy_ec_txt = read_file(toy_ec) | |
# get rid of existing checksums | |
- regex = re.compile('^checksums(?:.|\n)*?\]\s*$', re.M) | |
+ regex = re.compile(r'^checksums(?:.|\n)*?\]\s*$', re.M) | |
toy_ec_txt = regex.sub('', toy_ec_txt) | |
self.assertFalse('checksums = ' in toy_ec_txt) | |
@@ -4491,13 +4491,13 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
stdout, stderr = self._run_mock_eb(args, raise_error=True, strip=True) | |
patterns = [ | |
- "^== injecting md5 checksums in .*/test\.eb$", | |
- "^== fetching sources & patches for test\.eb\.\.\.$", | |
- "^== backup of easyconfig file saved to .*/test\.eb\.bak_[0-9]+_[0-9]+\.\.\.$", | |
- "^== injecting md5 checksums for sources & patches in test\.eb\.\.\.$", | |
- "^== \* toy-0.0\.tar\.gz: be662daa971a640e40be5c804d9d7d10$", | |
- "^== \* toy-0\.0_fix-silly-typo-in-printf-statement\.patch: e6785e1a721fc8bf79892e3ef41557c0$", | |
- "^== \* toy-extra\.txt: 3b0787b3bf36603ae1398c4a49097893$", | |
+ r"^== injecting md5 checksums in .*/test\.eb$", | |
+ r"^== fetching sources & patches for test\.eb\.\.\.$", | |
+ r"^== backup of easyconfig file saved to .*/test\.eb\.bak_[0-9]+_[0-9]+\.\.\.$", | |
+ r"^== injecting md5 checksums for sources & patches in test\.eb\.\.\.$", | |
+ r"^== \* toy-0.0\.tar\.gz: be662daa971a640e40be5c804d9d7d10$", | |
+ r"^== \* toy-0\.0_fix-silly-typo-in-printf-statement\.patch: e6785e1a721fc8bf79892e3ef41557c0$", | |
+ r"^== \* toy-extra\.txt: 3b0787b3bf36603ae1398c4a49097893$", | |
] | |
for pattern in patterns: | |
regex = re.compile(pattern, re.M) | |
@@ -4552,7 +4552,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
] | |
stdout, stderr = self._run_mock_eb(args, do_build=True, raise_error=True, verbose=True, strip=True) | |
self.assertEqual(stdout, '') | |
- regex = re.compile("^WARNING: Found file toy-0.0.tar.gz at .*, but re-downloading it anyway\.\.\.$") | |
+ regex = re.compile(r"^WARNING: Found file toy-0.0.tar.gz at .*, but re-downloading it anyway\.\.\.$") | |
self.assertTrue(regex.match(stderr), "Pattern '%s' matches: %s" % (regex.pattern, stderr)) | |
# check that existing source tarball was backed up | |
@@ -4574,7 +4574,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
# checksum is missing for patch of 'bar' extension, so --enforce-checksums should result in an error | |
copy_file(toy_ec, test_ec) | |
- error_pattern = "Missing checksum for bar-0.0[^ ]*\.patch" | |
+ error_pattern = r"Missing checksum for bar-0.0[^ ]*\.patch" | |
self.assertErrorRegex(EasyBuildError, error_pattern, self.eb_main, args, do_build=True, raise_error=True) | |
# get rid of checksums for extensions, should result in different error message | |
@@ -4583,13 +4583,13 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
test_ec_txt = regex.sub('', read_file(test_ec)) | |
self.assertFalse("'checksums':" in test_ec_txt) | |
write_file(test_ec, test_ec_txt) | |
- error_pattern = "Missing checksum for bar-0\.0\.tar\.gz" | |
+ error_pattern = r"Missing checksum for bar-0\.0\.tar\.gz" | |
self.assertErrorRegex(EasyBuildError, error_pattern, self.eb_main, args, do_build=True, raise_error=True) | |
# wipe both exts_list and checksums, so we can check whether missing checksum for main source is caught | |
test_ec_txt = read_file(test_ec) | |
for param in ['checksums', 'exts_list']: | |
- regex = re.compile('^%s(?:.|\n)*?\]\s*$' % param, re.M) | |
+ regex = re.compile(r'^%s(?:.|\n)*?\]\s*$' % param, re.M) | |
test_ec_txt = regex.sub('', test_ec_txt) | |
self.assertFalse('%s = ' % param in test_ec_txt) | |
@@ -4601,13 +4601,13 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
"""Test for --show-system-info.""" | |
txt, _ = self._run_mock_eb(['--show-system-info'], raise_error=True) | |
patterns = [ | |
- "^System information \(.*\):$", | |
- "^\* OS:$", | |
+ r"^System information \(.*\):$", | |
+ r"^\* OS:$", | |
"^ -> name: ", | |
"^ -> type: ", | |
"^ -> version: ", | |
"^ -> platform name: ", | |
- "^\* CPU:$", | |
+ r"^\* CPU:$", | |
"^ -> vendor: ", | |
"^ -> architecture: ", | |
"^ -> family: ", | |
@@ -4615,7 +4615,7 @@ class CommandLineOptionsTest(EnhancedTestCase): | |
"^ -> speed: [0-9.]+", | |
"^ -> cores: [0-9]+", | |
"^ -> features: ", | |
- "^\* software:$", | |
+ r"^\* software:$", | |
"^ -> glibc version: ", | |
"^ -> Python binary: .*/[pP]ython[0-9]?", | |
"^ -> Python version: [0-9.]+", | |
diff --git a/test/framework/parallelbuild.py b/test/framework/parallelbuild.py | |
index 9487b63e8..ed1eb04f2 100644 | |
--- a/test/framework/parallelbuild.py | |
+++ b/test/framework/parallelbuild.py | |
@@ -86,6 +86,7 @@ def mock(*args, **kwargs): | |
class MockPbsJob(object): | |
"""Mocking class for PbsJob.""" | |
+ | |
def __init__(self, *args, **kwargs): | |
self.deps = [] | |
self.jobid = None | |
@@ -173,7 +174,7 @@ class ParallelBuildTest(EnhancedTestCase): | |
# dependencies for gzip/1.4-GCC-4.6.3: GCC/4.6.3 (toolchain) + toy/.0.0-deps | |
self.assertTrue('gzip-1.4-GCC-4.6.3.eb' in jobs[3].script) | |
self.assertEqual(len(jobs[3].deps), 2) | |
- regex = re.compile('toy-0.0-deps.eb\s* --hidden') | |
+ regex = re.compile(r'toy-0.0-deps.eb\s* --hidden') | |
self.assertTrue(regex.search(jobs[3].deps[0].script)) | |
self.assertTrue('GCC-4.6.3.eb' in jobs[3].deps[1].script) | |
@@ -303,9 +304,9 @@ class ParallelBuildTest(EnhancedTestCase): | |
# (unparsed) optarch value got wrapped in single quotes, double quotes got stripped | |
" --optarch='GCC:O3 -mtune=generic;Intel:O3 -xHost' ", | |
# templates to be completed via build_easyconfigs_in_parallel -> create_job | |
- ' eb %\(spec\)s ', | |
- ' %\(add_opts\)s ', | |
- ' --testoutput=%\(output_dir\)s', | |
+ r' eb %\(spec\)s ', | |
+ r' %\(add_opts\)s ', | |
+ r' --testoutput=%\(output_dir\)s', | |
] | |
for regex in regexs: | |
regex = re.compile(regex) | |
diff --git a/test/framework/robot.py b/test/framework/robot.py | |
index fc94a8485..129684b42 100644 | |
--- a/test/framework/robot.py | |
+++ b/test/framework/robot.py | |
@@ -574,7 +574,7 @@ class RobotTest(EnhancedTestCase): | |
}], | |
} | |
- error = "Missing dependencies: somedep/4.5.6 \(no easyconfig file or existing module found\)" | |
+ error = r"Missing dependencies: somedep/4.5.6 \(no easyconfig file or existing module found\)" | |
self.assertErrorRegex(EasyBuildError, error, resolve_dependencies, [ec], self.modtool) | |
# check behaviour if only module file is available | |
@@ -583,7 +583,7 @@ class RobotTest(EnhancedTestCase): | |
self.assertEqual(len(res), 1) | |
self.assertEqual(res[0]['full_mod_name'], 'test/123') | |
- error = "Missing dependencies: somedep/4.5.6 \(no easyconfig file found in robot search path\)" | |
+ error = r"Missing dependencies: somedep/4.5.6 \(no easyconfig file found in robot search path\)" | |
self.assertErrorRegex(EasyBuildError, error, resolve_dependencies, [ec], self.modtool, retain_all_deps=True) | |
res = resolve_dependencies([ec], self.modtool, retain_all_deps=True, raise_error_missing_ecs=False) | |
diff --git a/test/framework/run.py b/test/framework/run.py | |
index e7d608c7b..f0c7db6e5 100644 | |
--- a/test/framework/run.py | |
+++ b/test/framework/run.py | |
@@ -228,7 +228,7 @@ class RunTest(EnhancedTestCase): | |
# a more 'complex' command to run, make sure all required output is there | |
(out, ec) = run_cmd("for j in `seq 1 3`; do for i in `seq 1 100`; do echo hello; done; sleep 1.4; done") | |
self.assertTrue(out.startswith('hello\nhello\n')) | |
- self.assertEqual(len(out), len("hello\n"*300)) | |
+ self.assertEqual(len(out), len("hello\n" * 300)) | |
self.assertEqual(ec, 0) | |
def test_run_cmd_log_output(self): | |
diff --git a/test/framework/sandbox/easybuild/easyblocks/g/gcc.py b/test/framework/sandbox/easybuild/easyblocks/g/gcc.py | |
index 02d96ef2d..232489178 100644 | |
--- a/test/framework/sandbox/easybuild/easyblocks/g/gcc.py | |
+++ b/test/framework/sandbox/easybuild/easyblocks/g/gcc.py | |
@@ -29,5 +29,6 @@ Dummy easyblock for GCC | |
""" | |
from easybuild.framework.easyblock import EasyBlock | |
+ | |
class EB_GCC(EasyBlock): | |
pass | |
diff --git a/test/framework/sandbox/easybuild/easyblocks/generic/configuremake.py b/test/framework/sandbox/easybuild/easyblocks/generic/configuremake.py | |
index ae580258a..099e2e3e1 100644 | |
--- a/test/framework/sandbox/easybuild/easyblocks/generic/configuremake.py | |
+++ b/test/framework/sandbox/easybuild/easyblocks/generic/configuremake.py | |
@@ -31,6 +31,7 @@ i.e. configure/make/make install. | |
from easybuild.framework.easyblock import EasyBlock | |
from easybuild.framework.easyconfig import CUSTOM | |
+ | |
class ConfigureMake(EasyBlock): | |
"""Dummy support for building and installing applications with configure/make/make install.""" | |
diff --git a/test/framework/sandbox/easybuild/easyblocks/generic/dummyextension.py b/test/framework/sandbox/easybuild/easyblocks/generic/dummyextension.py | |
index af97c3f25..88591809f 100644 | |
--- a/test/framework/sandbox/easybuild/easyblocks/generic/dummyextension.py | |
+++ b/test/framework/sandbox/easybuild/easyblocks/generic/dummyextension.py | |
@@ -30,6 +30,7 @@ EasyBuild support for building and installing dummy extensions, implemented as a | |
from easybuild.framework.extensioneasyblock import ExtensionEasyBlock | |
+ | |
class DummyExtension(ExtensionEasyBlock): | |
"""Support for building/installing dummy extensions.""" | |
diff --git a/test/framework/sandbox/easybuild/easyblocks/generic/toolchain.py b/test/framework/sandbox/easybuild/easyblocks/generic/toolchain.py | |
index fd1de3a89..d31635817 100644 | |
--- a/test/framework/sandbox/easybuild/easyblocks/generic/toolchain.py | |
+++ b/test/framework/sandbox/easybuild/easyblocks/generic/toolchain.py | |
@@ -29,13 +29,18 @@ Dummy easyblock for toolchains. | |
""" | |
from easybuild.framework.easyblock import EasyBlock | |
+ | |
class Toolchain(EasyBlock): | |
"""Dummy support for toolchains.""" | |
+ | |
def configure_step(self): | |
pass | |
+ | |
def build_step(self): | |
pass | |
+ | |
def install_step(self): | |
pass | |
+ | |
def sanity_check_step(self): | |
pass | |
diff --git a/test/framework/sandbox/easybuild/easyblocks/h/hpl.py b/test/framework/sandbox/easybuild/easyblocks/h/hpl.py | |
index 0b89ba202..db4e66065 100644 | |
--- a/test/framework/sandbox/easybuild/easyblocks/h/hpl.py | |
+++ b/test/framework/sandbox/easybuild/easyblocks/h/hpl.py | |
@@ -29,5 +29,6 @@ Dummy easyblock for HPL | |
""" | |
from easybuild.framework.easyblock import EasyBlock | |
+ | |
class EB_HPL(EasyBlock): | |
pass | |
diff --git a/test/framework/sandbox/easybuild/easyblocks/s/scalapack.py b/test/framework/sandbox/easybuild/easyblocks/s/scalapack.py | |
index 1dcef0a54..3cf433cb3 100644 | |
--- a/test/framework/sandbox/easybuild/easyblocks/s/scalapack.py | |
+++ b/test/framework/sandbox/easybuild/easyblocks/s/scalapack.py | |
@@ -29,5 +29,6 @@ Dummy easyblock for ScaLAPACK | |
""" | |
from easybuild.framework.easyblock import EasyBlock | |
+ | |
class EB_ScaLAPACK(EasyBlock): | |
pass | |
diff --git a/test/framework/sandbox/easybuild/easyblocks/t/toy_buggy.py b/test/framework/sandbox/easybuild/easyblocks/t/toy_buggy.py | |
index 959ff5b92..731713883 100644 | |
--- a/test/framework/sandbox/easybuild/easyblocks/t/toy_buggy.py | |
+++ b/test/framework/sandbox/easybuild/easyblocks/t/toy_buggy.py | |
@@ -30,6 +30,7 @@ | |
from easybuild.framework.easyblock import EasyBlock | |
+ | |
class EB_toy_buggy(EasyBlock): | |
"""Support for building/installing toy.""" | |
diff --git a/test/framework/sandbox/easybuild/easyblocks/t/toytoy.py b/test/framework/sandbox/easybuild/easyblocks/t/toytoy.py | |
index 3ebbfe724..ee700251a 100644 | |
--- a/test/framework/sandbox/easybuild/easyblocks/t/toytoy.py | |
+++ b/test/framework/sandbox/easybuild/easyblocks/t/toytoy.py | |
@@ -40,5 +40,5 @@ class EB_toytoy(EB_toy): | |
"""Custom easyconfig parameters for toytoy.""" | |
extra_vars = { | |
'toytoy_extra1': [None, "first toytoy-specific easyconfig parameter", CUSTOM], | |
- } | |
+ } | |
return EB_toy.extra_options(extra_vars) | |
diff --git a/test/framework/systemtools.py b/test/framework/systemtools.py | |
index fa1f1331c..acb9b3893 100644 | |
--- a/test/framework/systemtools.py | |
+++ b/test/framework/systemtools.py | |
@@ -280,7 +280,7 @@ MACHINE_NAME = None | |
def mocked_read_file(fp): | |
"""Mocked version of read_file, with specified contents for known filenames.""" | |
known_fps = { | |
- MAX_FREQ_FP: '2850000', | |
+ MAX_FREQ_FP: '2850000', | |
PROC_CPUINFO_FP: PROC_CPUINFO_TXT, | |
PROC_MEMINFO_FP: PROC_MEMINFO_TXT, | |
} | |
diff --git a/test/framework/toolchain.py b/test/framework/toolchain.py | |
index 909bb2f07..11e5eb94f 100644 | |
--- a/test/framework/toolchain.py | |
+++ b/test/framework/toolchain.py | |
@@ -1304,7 +1304,7 @@ class ToolchainTest(EnhancedTestCase): | |
ccache = which('ccache') | |
if ccache is None: | |
- msg = "ccache binary not found in \$PATH, required by --use-compiler-cache" | |
+ msg = r"ccache binary not found in \$PATH, required by --use-compiler-cache" | |
self.assertErrorRegex(EasyBuildError, msg, self.eb_main, args, raise_error=True, do_build=True) | |
# generate shell script to mock ccache/f90cache | |
diff --git a/test/framework/toolchainvariables.py b/test/framework/toolchainvariables.py | |
index 890417c35..7edbdde91 100644 | |
--- a/test/framework/toolchainvariables.py | |
+++ b/test/framework/toolchainvariables.py | |
@@ -125,11 +125,11 @@ class ToolchainVariablesTest(EnhancedTestCase): | |
# e.g. numpy and mkl blas | |
# -Wl:-Bstatic,-Wl:--start-group,mkl_intel_lp64,mkl_intel_thread,mkl_core,-Wl:--end-group,-Wl:-Bdynamic,iomp5 | |
kwargs = { | |
- 'prefix': '', | |
- 'prefix_begin_end': '-Wl:', | |
- 'separator': ',', | |
- 'separator_begin_end': ',', | |
- } | |
+ 'prefix': '', | |
+ 'prefix_begin_end': '-Wl:', | |
+ 'separator': ',', | |
+ 'separator_begin_end': ',', | |
+ } | |
copy_blas_2.try_function_on_element('change', kwargs=kwargs) | |
copy_blas_2.SEPARATOR = ',' | |
diff --git a/test/framework/toy_build.py b/test/framework/toy_build.py | |
index d4a285e7f..e70fbac20 100644 | |
--- a/test/framework/toy_build.py | |
+++ b/test/framework/toy_build.py | |
@@ -229,8 +229,8 @@ class ToyBuildTest(EnhancedTestCase): | |
shutil.copy2(os.path.join(test_ecs_dir, 'test_ecs', 't', 'toy', 'toy-0.0.eb'), ec_file) | |
modloadmsg = 'THANKS FOR LOADING ME\\nI AM %(name)s v%(version)s' | |
- modloadmsg_regex_tcl = 'THANKS.*\n\s*I AM toy v0.0\n\s*"' | |
- modloadmsg_regex_lua = '\[==\[THANKS.*\n\s*I AM toy v0.0\n\s*\]==\]' | |
+ modloadmsg_regex_tcl = r'THANKS.*\n\s*I AM toy v0.0\n\s*"' | |
+ modloadmsg_regex_lua = r'\[==\[THANKS.*\n\s*I AM toy v0.0\n\s*\]==\]' | |
# tweak easyconfig by appending to it | |
ec_extra = '\n'.join([ | |
@@ -357,14 +357,14 @@ class ToyBuildTest(EnhancedTestCase): | |
sys.path.append(tmpdir) | |
args = [ | |
- 'toy-0.0-multiple.eb', | |
- '--sourcepath=%s' % self.test_sourcepath, | |
- '--buildpath=%s' % self.test_buildpath, | |
- '--installpath=%s' % self.test_installpath, | |
- '--debug', | |
- '--unittest-file=%s' % self.logfile, | |
- '--force', | |
- ] | |
+ 'toy-0.0-multiple.eb', | |
+ '--sourcepath=%s' % self.test_sourcepath, | |
+ '--buildpath=%s' % self.test_buildpath, | |
+ '--installpath=%s' % self.test_installpath, | |
+ '--debug', | |
+ '--unittest-file=%s' % self.logfile, | |
+ '--force', | |
+ ] | |
outtxt = self.eb_main(args, logfile=self.dummylogfn, do_build=True, verbose=True) | |
for toy_prefix, toy_version, toy_suffix in [ | |
@@ -700,7 +700,7 @@ class ToyBuildTest(EnhancedTestCase): | |
self.assertTrue(regex.search(outtxt), "Pattern '%s' found in: %s" % (regex.pattern, toy_mod_txt)) | |
else: | |
pattern = "Can't generate robust check in Lua modules for users belonging to group %s. " | |
- pattern += "Lmod version not recent enough \(%s\), should be >= 6.0.8" % lmod_version | |
+ pattern += r"Lmod version not recent enough \(%s\), should be >= 6.0.8" % lmod_version | |
regex = re.compile(pattern % group_name, re.M) | |
self.assertTrue(regex.search(outtxt), "Pattern '%s' found in: %s" % (regex.pattern, outtxt)) | |
else: | |
@@ -807,7 +807,7 @@ class ToyBuildTest(EnhancedTestCase): | |
modtxt = read_file(toy_module_path) | |
modpath_extension = os.path.join(mod_prefix, 'MPI', 'GCC', '6.4.0-2.28', 'toy', '0.0') | |
if get_module_syntax() == 'Tcl': | |
- self.assertTrue(re.search('^module\s*use\s*"%s"' % modpath_extension, modtxt, re.M)) | |
+ self.assertTrue(re.search(r'^module\s*use\s*"%s"' % modpath_extension, modtxt, re.M)) | |
elif get_module_syntax() == 'Lua': | |
fullmodpath_extension = os.path.join(self.test_installpath, modpath_extension) | |
regex = re.compile(r'^prepend_path\("MODULEPATH", "%s"\)' % fullmodpath_extension, re.M) | |
@@ -822,7 +822,7 @@ class ToyBuildTest(EnhancedTestCase): | |
modtxt = read_file(toy_module_path) | |
modpath_extension = os.path.join(mod_prefix, 'MPI', 'GCC', '6.4.0-2.28', 'toy', '0.0') | |
if get_module_syntax() == 'Tcl': | |
- self.assertFalse(re.search('^module\s*use\s*"%s"' % modpath_extension, modtxt, re.M)) | |
+ self.assertFalse(re.search(r'^module\s*use\s*"%s"' % modpath_extension, modtxt, re.M)) | |
elif get_module_syntax() == 'Lua': | |
fullmodpath_extension = os.path.join(self.test_installpath, modpath_extension) | |
regex = re.compile(r'^prepend_path\("MODULEPATH", "%s"\)' % fullmodpath_extension, re.M) | |
@@ -1185,7 +1185,7 @@ class ToyBuildTest(EnhancedTestCase): | |
modloadmsg_lua = [ | |
r'io.stderr:write\(\[==\[THANKS FOR LOADING ME', | |
r'I AM toy v0.0', | |
- '\]==\]\)', | |
+ r'\]==\]\)', | |
] | |
help_txt = '\n'.join([ | |
@@ -1827,7 +1827,7 @@ class ToyBuildTest(EnhancedTestCase): | |
ectxt = read_file(ec_file) | |
# modify test easyconfig: move lib/libtoy.a to lib64/libtoy.a | |
- ectxt = re.sub("\s*'files'.*", "'files': ['bin/toy', ('lib/libtoy.a', 'lib/libfoo.a')],", ectxt) | |
+ ectxt = re.sub(r"\s*'files'.*", "'files': ['bin/toy', ('lib/libtoy.a', 'lib/libfoo.a')],", ectxt) | |
postinstallcmd = "mkdir %(installdir)s/lib64 && mv %(installdir)s/lib/libtoy.a %(installdir)s/lib64/libtoy.a" | |
ectxt = re.sub("postinstallcmds.*", "postinstallcmds = ['%s']" % postinstallcmd, ectxt) | |
@@ -1843,8 +1843,8 @@ class ToyBuildTest(EnhancedTestCase): | |
self.test_toy_build(ec_file=test_ec, raise_error=True) | |
# also check with 'lib' in sanity check dirs (special case) | |
- ectxt = re.sub("\s*'files'.*", "'files': ['bin/toy'],", ectxt) | |
- ectxt = re.sub("\s*'dirs'.*", "'dirs': ['lib'],", ectxt) | |
+ ectxt = re.sub(r"\s*'files'.*", "'files': ['bin/toy'],", ectxt) | |
+ ectxt = re.sub(r"\s*'dirs'.*", "'dirs': ['lib'],", ectxt) | |
write_file(test_ec, ectxt) | |
error_pattern = r"Sanity check failed: no \(non-empty\) directory found at 'lib' in " | |
@@ -1855,7 +1855,7 @@ class ToyBuildTest(EnhancedTestCase): | |
# also check other way around (lib64 -> lib) | |
ectxt = read_file(ec_file) | |
- ectxt = re.sub("\s*'files'.*", "'files': ['bin/toy', 'lib64/libtoy.a'],", ectxt) | |
+ ectxt = re.sub(r"\s*'files'.*", "'files': ['bin/toy', 'lib64/libtoy.a'],", ectxt) | |
write_file(test_ec, ectxt) | |
# sanity check fails if lib64 fallback in sanity check is disabled, since lib64/libtoy.a is not there | |
@@ -1867,8 +1867,8 @@ class ToyBuildTest(EnhancedTestCase): | |
self.test_toy_build(ec_file=test_ec, raise_error=True) | |
# also check with 'lib64' in sanity check dirs (special case) | |
- ectxt = re.sub("\s*'files'.*", "'files': ['bin/toy'],", ectxt) | |
- ectxt = re.sub("\s*'dirs'.*", "'dirs': ['lib64'],", ectxt) | |
+ ectxt = re.sub(r"\s*'files'.*", "'files': ['bin/toy'],", ectxt) | |
+ ectxt = re.sub(r"\s*'dirs'.*", "'dirs': ['lib64'],", ectxt) | |
write_file(test_ec, ectxt) | |
error_pattern = r"Sanity check failed: no \(non-empty\) directory found at 'lib64' in " | |
@@ -1879,7 +1879,7 @@ class ToyBuildTest(EnhancedTestCase): | |
# check whether fallback works for files that's more than 1 subdir deep | |
ectxt = read_file(ec_file) | |
- ectxt = re.sub("\s*'files'.*", "'files': ['bin/toy', 'lib/test/libtoy.a'],", ectxt) | |
+ ectxt = re.sub(r"\s*'files'.*", "'files': ['bin/toy', 'lib/test/libtoy.a'],", ectxt) | |
postinstallcmd = "mkdir -p %(installdir)s/lib64/test && " | |
postinstallcmd += "mv %(installdir)s/lib/libtoy.a %(installdir)s/lib64/test/libtoy.a" | |
ectxt = re.sub("postinstallcmds.*", "postinstallcmds = ['%s']" % postinstallcmd, ectxt) | |
diff --git a/test/framework/type_checking.py b/test/framework/type_checking.py | |
index b1247832c..df75c4940 100644 | |
--- a/test/framework/type_checking.py | |
+++ b/test/framework/type_checking.py | |
@@ -356,7 +356,7 @@ class TypeCheckingTest(EnhancedTestCase): | |
# extra keys ruin it | |
foo_dict.update({'extra_key': 'bogus'}) | |
- self.assertErrorRegex(EasyBuildError, "Found unexpected \(key, value\) pair: .*", to_dependency, foo_dict) | |
+ self.assertErrorRegex(EasyBuildError, r"Found unexpected \(key, value\) pair: .*", to_dependency, foo_dict) | |
# no name/version | |
self.assertErrorRegex(EasyBuildError, "Can not parse dependency without name and version: .*", |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment