diff --git a/easybuild/easyblocks/__init__.py b/easybuild/easyblocks/__init__.py index 8c9827dddb..7fa1de2c3c 100644 --- a/easybuild/easyblocks/__init__.py +++ b/easybuild/easyblocks/__init__.py @@ -79,7 +79,7 @@ def get_git_revision(): VERBOSE_VERSION = LooseVersion("%s-r%s" % (VERSION, git_rev)) # extend path so python finds our easyblocks in the subdirectories where they are located -subdirs = [chr(l) for l in range(ord('a'), ord('z') + 1)] + ['0'] +subdirs = [chr(x) for x in range(ord('a'), ord('z') + 1)] + ['0'] for subdir in subdirs: __path__ = extend_path(__path__, '%s.%s' % (__name__, subdir)) diff --git a/easybuild/easyblocks/o/octave.py b/easybuild/easyblocks/o/octave.py index 8d193af422..a05c6416c2 100644 --- a/easybuild/easyblocks/o/octave.py +++ b/easybuild/easyblocks/o/octave.py @@ -30,12 +30,10 @@ """ import os -import easybuild.tools.environment as env from easybuild.easyblocks.generic.configuremake import ConfigureMake from easybuild.framework.easyconfig import CUSTOM from easybuild.tools.build_log import EasyBuildError from easybuild.tools.modules import get_software_root -from easybuild.tools.run import run_cmd EXTS_FILTER_OCTAVE_PACKAGES = ("octave --eval 'pkg list' | grep packages/%(ext_name)s-%(ext_version)s", '') diff --git a/easybuild/easyblocks/o/openifs.py b/easybuild/easyblocks/o/openifs.py index 2531a337ec..4621547875 100644 --- a/easybuild/easyblocks/o/openifs.py +++ b/easybuild/easyblocks/o/openifs.py @@ -52,7 +52,7 @@ def configure_step(self): env.setvar('OIFS_BUILD', 'opt') if self.toolchain.comp_family() == toolchain.GCC: env.setvar('OIFS_COMP', 'gnu') - elif self.toolchain.comp_family() == toolchain.INTELCOMP: + elif self.toolchain.comp_family() == toolchain.INTELCOMP: env.setvar('OIFS_COMP', 'intel') else: raise EasyBuildError("Unknown compiler used, don't know how to set $OIFS_COMP.") @@ -103,4 +103,3 @@ def sanity_check_step(self): } super(EB_OpenIFS, self).sanity_check_step(custom_paths=custom_paths) - diff --git a/easybuild/easyblocks/o/openssl.py b/easybuild/easyblocks/o/openssl.py index 96f66ff826..e536d6584a 100644 --- a/easybuild/easyblocks/o/openssl.py +++ b/easybuild/easyblocks/o/openssl.py @@ -44,7 +44,7 @@ def configure_step(self, cmd_prefix=''): """ Configure step """ - + cmd = "%s %s./config --prefix=%s threads shared %s" % (self.cfg['preconfigopts'], cmd_prefix, self.installdir, self.cfg['configopts']) @@ -65,16 +65,17 @@ def sanity_check_step(self): custom_paths = { 'files': [os.path.join(libdir, x) for x in ['libcrypto.a', 'libcrypto.so', 'libssl.a', 'libssl.so']] + - ['bin/openssl'], + ['bin/openssl'], 'dirs': [], } if LooseVersion(self.version) < LooseVersion("1.1"): - custom_paths['files'].extend([os.path.join(libdir, 'libcrypto.so.1.0.0'), os.path.join(libdir, 'libssl.so.1.0.0')]) + custom_paths['files'].extend([os.path.join(libdir, 'libcrypto.so.1.0.0'), + os.path.join(libdir, 'libssl.so.1.0.0')]) custom_paths['dirs'].append(os.path.join(libdir, 'engines')) else: - custom_paths['files'].extend([os.path.join(libdir, 'libcrypto.so.1.1'), os.path.join(libdir, 'libssl.so.1.1')]) + custom_paths['files'].extend([os.path.join(libdir, 'libcrypto.so.1.1'), + os.path.join(libdir, 'libssl.so.1.1')]) custom_paths['dirs'].append(os.path.join(libdir, 'engines-1.1')) super(EB_OpenSSL, self).sanity_check_step(custom_paths=custom_paths) - diff --git a/easybuild/easyblocks/p/parmetis.py b/easybuild/easyblocks/p/parmetis.py index 9e5755ba22..6f4a965596 100644 --- a/easybuild/easyblocks/p/parmetis.py +++ b/easybuild/easyblocks/p/parmetis.py @@ -148,7 +148,7 @@ def install_step(self): # libraries try: - src = os.path.join(self.cfg['start_dir'], 'build' ,'libmetis' ,'libmetis.a') + src = os.path.join(self.cfg['start_dir'], 'build', 'libmetis', 'libmetis.a') dst = os.path.join(libdir, 'libmetis.a') shutil.copy2(src, dst) except OSError as err: diff --git a/easybuild/easyblocks/p/pasha.py b/easybuild/easyblocks/p/pasha.py index 8d8044b95e..860517290c 100644 --- a/easybuild/easyblocks/p/pasha.py +++ b/easybuild/easyblocks/p/pasha.py @@ -47,7 +47,8 @@ def configure_step(self): raise EasyBuildError("TBB module not loaded.") self.cfg.update('buildopts', "TBB_DIR=%s/tbb MPI_DIR='' MPI_INC='' " % tbb) - self.cfg.update('buildopts', 'MPI_CXX="%s" OPM_FLAG="%s"' % (os.getenv('MPICXX'), self.toolchain.get_flag('openmp'))) + self.cfg.update('buildopts', 'MPI_CXX="%s"' % os.getenv('MPICXX')) + self.cfg.update('buildopts', 'OPM_FLAG="%s"' % self.toolchain.get_flag('openmp')) self.cfg.update('buildopts', 'MPI_LIB="" MY_CXX="%s" MPICH_IGNORE_CXX_SEEK=1' % os.getenv('CXX')) def install_step(self): @@ -60,8 +61,8 @@ def sanity_check_step(self): """Custom sanity check for Pasha""" custom_paths = { - 'files':["bin/pasha-%s" % x for x in ["kmergen", "pregraph", "graph"]], - 'dirs':[], - } + 'files': ["bin/pasha-%s" % x for x in ["kmergen", "pregraph", "graph"]], + 'dirs': [], + } super(EB_Pasha, self).sanity_check_step(custom_paths=custom_paths) diff --git a/easybuild/easyblocks/p/pbdmpi.py b/easybuild/easyblocks/p/pbdmpi.py index 3a15873dac..431452b4ea 100644 --- a/easybuild/easyblocks/p/pbdmpi.py +++ b/easybuild/easyblocks/p/pbdmpi.py @@ -32,6 +32,7 @@ import easybuild.tools.toolchain as toolchain from easybuild.easyblocks.generic.rpackage import RPackage + class EB_pbdMPI(RPackage): """Support for building/installing pbdMPI.""" diff --git a/easybuild/easyblocks/p/pbdslap.py b/easybuild/easyblocks/p/pbdslap.py index d15db0a8fc..ea2e797f33 100644 --- a/easybuild/easyblocks/p/pbdslap.py +++ b/easybuild/easyblocks/p/pbdslap.py @@ -30,6 +30,7 @@ from easybuild.easyblocks.generic.rpackage import RPackage + class EB_pbdSLAP(RPackage): """Support for building/installing pbdSLAP.""" diff --git a/easybuild/easyblocks/p/petsc.py b/easybuild/easyblocks/p/petsc.py index 023486b9ca..3308a33166 100644 --- a/easybuild/easyblocks/p/petsc.py +++ b/easybuild/easyblocks/p/petsc.py @@ -40,6 +40,7 @@ from easybuild.tools.modules import get_software_root from easybuild.tools.run import run_cmd from easybuild.tools.systemtools import get_shared_lib_ext +from easybuild.tools.py2vs3 import string_type NO_MPI_CXX_EXT_FLAGS = '-DOMPI_SKIP_MPICXX -DMPICH_SKIP_MPICXX' @@ -126,7 +127,7 @@ def configure_step(self): self.cfg.update('configopts', '--with-cxxflags="%s"' % cxxflags) self.cfg.update('configopts', '--with-fcflags="%s"' % os.getenv('F90FLAGS')) - if not self.toolchain.comp_family() == toolchain.GCC: #@UndefinedVariable + if not self.toolchain.comp_family() == toolchain.GCC: # @UndefinedVariable self.cfg.update('configopts', '--with-gnu-compilers=0') # MPI @@ -193,7 +194,7 @@ def configure_step(self): deps = [dep['name'] for dep in self.cfg.dependencies() if not dep['name'] in depfilter] for dep in deps: - if type(dep) == str: + if isinstance(dep, string_type): dep = (dep, dep) deproot = get_software_root(dep[0]) if deproot: @@ -211,13 +212,13 @@ def configure_step(self): # specified order of libs matters! ss_libs = ["UMFPACK", "KLU", "CHOLMOD", "BTF", "CCOLAMD", "COLAMD", "CAMD", "AMD"] - suitesparse_inc = [os.path.join(suitesparse, l, "Include") - for l in ss_libs] + suitesparse_inc = [os.path.join(suitesparse, x, "Include") + for x in ss_libs] suitesparse_inc.append(os.path.join(suitesparse, "SuiteSparse_config")) inc_spec = "-include=[%s]" % ','.join(suitesparse_inc) - suitesparse_libs = [os.path.join(suitesparse, l, "Lib", "lib%s.a" % l.lower()) - for l in ss_libs] + suitesparse_libs = [os.path.join(suitesparse, x, "Lib", "lib%s.a" % x.lower()) + for x in ss_libs] suitesparse_libs.append(os.path.join(suitesparse, "SuiteSparse_config", "libsuitesparseconfig.a")) lib_spec = "-lib=[%s]" % ','.join(suitesparse_libs) else: @@ -225,8 +226,8 @@ def configure_step(self): withdep = "--with-umfpack" inc_spec = "-include=%s" % os.path.join(suitesparse, "UMFPACK", "Include") # specified order of libs matters! - umfpack_libs = [os.path.join(suitesparse, l, "Lib", "lib%s.a" % l.lower()) - for l in ["UMFPACK", "CHOLMOD", "COLAMD", "AMD"]] + umfpack_libs = [os.path.join(suitesparse, x, "Lib", "lib%s.a" % x.lower()) + for x in ["UMFPACK", "CHOLMOD", "COLAMD", "AMD"]] lib_spec = "-lib=[%s]" % ','.join(umfpack_libs) self.cfg.update('configopts', ' '.join([withdep + spec for spec in ['=1', inc_spec, lib_spec]])) @@ -249,7 +250,7 @@ def configure_step(self): if self.cfg['sourceinstall']: # figure out PETSC_ARCH setting - petsc_arch_regex = re.compile("^\s*PETSC_ARCH:\s*(\S+)$", re.M) + petsc_arch_regex = re.compile(r"^\s*PETSC_ARCH:\s*(\S+)$", re.M) res = petsc_arch_regex.search(out) if res: self.petsc_arch = res.group(1) diff --git a/easybuild/easyblocks/p/pgi.py b/easybuild/easyblocks/p/pgi.py index d420a6f861..931d0a85e5 100644 --- a/easybuild/easyblocks/p/pgi.py +++ b/easybuild/easyblocks/p/pgi.py @@ -82,7 +82,7 @@ class EB_PGI(PackedBinary): def extra_options(): extra_vars = { 'install_amd': [True, "Install AMD software components", CUSTOM], - 'install_java': [True, "Install Java JRE for graphical debugger", CUSTOM], + 'install_java': [True, "Install Java JRE for graphical debugger", CUSTOM], 'install_managed': [True, "Install OpenACC Unified Memory Evaluation package", CUSTOM], 'install_nvidia': [True, "Install CUDA Toolkit Components", CUSTOM], } @@ -133,7 +133,7 @@ def install_step(self): 'PGI_INSTALL_MANAGED': str(self.cfg['install_managed']).lower(), 'PGI_INSTALL_NVIDIA': str(self.cfg['install_nvidia']).lower(), 'PGI_SILENT': 'true', - } + } cmd = "%s ./install" % ' '.join(['%s=%s' % x for x in sorted(pgi_env_vars.items())]) run_cmd(cmd, log_all=True, simple=True) diff --git a/easybuild/easyblocks/p/primer3.py b/easybuild/easyblocks/p/primer3.py index 14012aca8e..ce6a497406 100644 --- a/easybuild/easyblocks/p/primer3.py +++ b/easybuild/easyblocks/p/primer3.py @@ -60,9 +60,10 @@ def guess_start_dir(self): def configure_step(self): """Configure Primer3 build by setting make options.""" - self.cfg.update('buildopts', 'CC="%s" CPP="%s" O_OPTS="%s" all' % (os.getenv('CC'), - os.getenv('CXX'), - os.getenv('CFLAGS'))) + self.cfg.update('buildopts', 'CC="%s"' % (os.getenv('CC'))) + self.cfg.update('buildopts', 'CPP="%s"' % (os.getenv('CXX'))) + self.cfg.update('buildopts', 'O_OPTS="%s"' % (os.getenv('CFLAGS'))) + self.cfg.update('buildopts', 'all') # default build_step should be fine @@ -74,10 +75,10 @@ def sanity_check_step(self): """Custom sanity check for Primer3.""" custom_paths = { - 'files':["%s/%s" % (self.bindir, x) for x in ["primer3_core", "ntdpal", - "oligotm", "long_seq_tm_test"]], - 'dirs':[] - } + 'files': ["%s/%s" % (self.bindir, x) for x in ["primer3_core", "ntdpal", + "oligotm", "long_seq_tm_test"]], + 'dirs': [] + } super(EB_Primer3, self).sanity_check_step(custom_paths=custom_paths) diff --git a/easybuild/easyblocks/p/psmpi.py b/easybuild/easyblocks/p/psmpi.py index bf7e0b7e1d..5b02ace362 100644 --- a/easybuild/easyblocks/p/psmpi.py +++ b/easybuild/easyblocks/p/psmpi.py @@ -73,7 +73,7 @@ def configure_step(self): toolchain.GCC: 'gcc', toolchain.INTELCOMP: 'intel', # TODO: Include PGI as soon as it is available as toolchain - #toolchain.PGI: 'pgi', + # toolchain.PGI: 'pgi', } # Set confset diff --git a/easybuild/easyblocks/p/pyquante.py b/easybuild/easyblocks/p/pyquante.py index 5491578ddf..2b2bddc990 100644 --- a/easybuild/easyblocks/p/pyquante.py +++ b/easybuild/easyblocks/p/pyquante.py @@ -46,4 +46,3 @@ def configure_step(self): self.log.warn("Not building Libint extension") super(EB_PyQuante, self).configure_step() - diff --git a/easybuild/easyblocks/p/pyzmq.py b/easybuild/easyblocks/p/pyzmq.py index b302b791a7..d238bdd33e 100644 --- a/easybuild/easyblocks/p/pyzmq.py +++ b/easybuild/easyblocks/p/pyzmq.py @@ -44,9 +44,8 @@ def configure_step(self): self.sitecfg = """[build_ext] library_dirs = %(zmq)s/lib include_dirs = %(zmq)s/include -""" % { 'zmq': root_zmq } +""" % {'zmq': root_zmq} else: self.log.info("External ZeroMQ not found, PyZMQ will (try to) use shipped ZeroMQ.") super(EB_PyZMQ, self).configure_step() - diff --git a/easybuild/easyblocks/q/qscintilla.py b/easybuild/easyblocks/q/qscintilla.py index d2d28e5efd..c735a800f0 100644 --- a/easybuild/easyblocks/q/qscintilla.py +++ b/easybuild/easyblocks/q/qscintilla.py @@ -88,7 +88,7 @@ def build_step(self): """Custom build procedure for QScintilla.""" # make sure that $CXXFLAGS is being passed down - self.cfg.update('buildopts', 'CXXFLAGS="$CXXFLAGS \$(DEFINES)"') + self.cfg.update('buildopts', r'CXXFLAGS="$CXXFLAGS \$(DEFINES)"') super(EB_QScintilla, self).build_step() @@ -117,7 +117,7 @@ def install_step(self): # in case PyQt5's sip was installed in directories that are specific to each version of python # as could happen with multi_deps pyqt_sipdir = find_glob_pattern(os.path.join(self.pyqt_root, 'share', 'python%s*' % pyshortver, - 'site-packages', 'sip', self.pyqt_pkg_name), False) + 'site-packages', 'sip', self.pyqt_pkg_name), False) # fall back to a single sipdir if not pyqt_sipdir: pyqt_sipdir = os.path.join(self.pyqt_root, 'share', 'sip', self.pyqt_pkg_name) diff --git a/easybuild/easyblocks/q/qt.py b/easybuild/easyblocks/q/qt.py index 3e9649fafb..76f99b584e 100644 --- a/easybuild/easyblocks/q/qt.py +++ b/easybuild/easyblocks/q/qt.py @@ -175,7 +175,7 @@ def sanity_check_step(self): elif myarch == POWER: self.log.debug("Skipping check for qtwebengine, since it is not supported on POWER.") else: - qtwebengine_libs = ['libQt%s%s.%s' % (libversion, l, shlib_ext) for l in ['WebEngine', 'WebEngineCore']] + qtwebengine_libs = ['libQt%s%s.%s' % (libversion, x, shlib_ext) for x in ['WebEngine', 'WebEngineCore']] custom_paths['files'].extend([os.path.join('lib', lib) for lib in qtwebengine_libs]) if LooseVersion(self.version) >= LooseVersion('4'): diff --git a/easybuild/easyblocks/r/__init__.py b/easybuild/easyblocks/r/__init__.py index 73567e3646..6dda569ca9 100644 --- a/easybuild/easyblocks/r/__init__.py +++ b/easybuild/easyblocks/r/__init__.py @@ -27,4 +27,4 @@ author: Kenneth Hoste (Ghent University) """ -from easybuild.easyblocks.r.r import * +from easybuild.easyblocks.r.r import * # noqa diff --git a/easybuild/easyblocks/r/r.py b/easybuild/easyblocks/r/r.py index 93d632c285..bfae7eebea 100644 --- a/easybuild/easyblocks/r/r.py +++ b/easybuild/easyblocks/r/r.py @@ -91,7 +91,7 @@ def configure_step(self): out = ConfigureMake.configure_step(self) # check output of configure command to verify BLAS/LAPACK settings - ext_libs_regex = re.compile("External libraries:.*BLAS\((?P.*)\).*LAPACK\((?P.*)\)") + ext_libs_regex = re.compile(r"External libraries:.*BLAS\((?P.*)\).*LAPACK\((?P.*)\)") res = ext_libs_regex.search(out) if res: for lib in ['BLAS', 'LAPACK']: @@ -135,7 +135,7 @@ def sanity_check_step(self): custom_paths = { 'files': ['bin/%s' % x for x in ['R', 'Rscript']] + - [(os.path.join('lib64', 'R', f), os.path.join('lib', 'R', f)) for f in libfiles], + [(os.path.join('lib64', 'R', f), os.path.join('lib', 'R', f)) for f in libfiles], 'dirs': [], } super(EB_R, self).sanity_check_step(custom_paths=custom_paths) diff --git a/easybuild/easyblocks/r/rmpi.py b/easybuild/easyblocks/r/rmpi.py index b5d3754aa3..87efc71014 100644 --- a/easybuild/easyblocks/r/rmpi.py +++ b/easybuild/easyblocks/r/rmpi.py @@ -46,15 +46,15 @@ def run(self): mpi_types = { toolchain.MPI_TYPE_OPENMPI: "OPENMPI", toolchain.MPI_TYPE_MPICH: "MPICH", - #toolchain.MPI_TYPE_LAM: "LAM", # no support for LAM yet + # toolchain.MPI_TYPE_LAM: "LAM", # no support for LAM yet } # type of MPI # MPI_TYPE does not distinguish between MPICH and IntelMPI, which is why we also check mpi_family() mpi_type = self.toolchain.mpi_family() Rmpi_type = mpi_types[self.toolchain.MPI_TYPE] - # Rmpi versions 0.6-4 and up support INTELMPI (using --with-Rmpi-type=INTELMPI) + # Rmpi versions 0.6-4 and up support INTELMPI (using --with-Rmpi-type=INTELMPI) if ((LooseVersion(self.version) >= LooseVersion('0.6-4')) and (mpi_type == toolchain.INTELMPI)): - Rmpi_type = 'INTELMPI' + Rmpi_type = 'INTELMPI' self.log.debug("Setting configure args for Rmpi") self.configureargs = [ diff --git a/easybuild/easyblocks/r/rosetta.py b/easybuild/easyblocks/r/rosetta.py index 0e22c06d51..436ee4ac91 100644 --- a/easybuild/easyblocks/r/rosetta.py +++ b/easybuild/easyblocks/r/rosetta.py @@ -100,9 +100,9 @@ def configure_step(self): self.detect_cxx() cxx_ver = None - if self.toolchain.comp_family() in [toolchain.GCC]: #@UndefinedVariable + if self.toolchain.comp_family() in [toolchain.GCC]: # @UndefinedVariable cxx_ver = '.'.join(get_software_version('GCC').split('.')[:2]) - elif self.toolchain.comp_family() in [toolchain.INTELCOMP]: #@UndefinedVariable + elif self.toolchain.comp_family() in [toolchain.INTELCOMP]: # @UndefinedVariable cxx_ver = '.'.join(get_icc_version().split('.')[:2]) else: raise EasyBuildError("Don't know how to determine C++ compiler version.") @@ -137,7 +137,7 @@ def configure_step(self): " 'program_path': %s," % str(paths), " 'flags': {", " 'compile': %s," % str(flags), - #" 'mode': %s," % str(o_flags), + # " 'mode': %s," % str(o_flags), " },", " 'defines': %s," % str(defines), " },", @@ -166,7 +166,7 @@ def configure_step(self): # make sure specified compiler version is accepted by patching it in os_fp = os.path.join(self.srcdir, "tools/build/options.settings") - cxxver_re = re.compile('(.*"%s".*)(,\s*"\*"\s*],.*)' % self.cxx, re.M) + cxxver_re = re.compile(r'(.*"%s".*)(,\s*"\*"\s*],.*)' % self.cxx, re.M) for line in fileinput.input(os_fp, inplace=1, backup='.orig.eb'): line = cxxver_re.sub(r'\1, "%s"\2' % cxx_ver, line) sys.stdout.write(line) @@ -208,7 +208,7 @@ def install_step(self): except OSError as err: raise EasyBuildError("Failed to walk build/src dir: %s", err) # copy binaries/libraries to install dir - lib_re = re.compile("^lib.*\.%s$" % shlib_ext) + lib_re = re.compile(r"^lib.*\.%s$" % shlib_ext) try: for fil in os.listdir(builddir): srcfile = os.path.join(builddir, fil) @@ -278,7 +278,7 @@ def sanity_check_step(self): binaries = ["AbinitioRelax", "backrub", "cluster", "combine_silent", "extract_pdbs", "idealize_jd2", "packstat", "relax", "score_jd2", "score"] custom_paths = { - 'files':["bin/%s.%slinux%srelease" % (x, infix, self.cxx) for x in binaries], - 'dirs':[], + 'files': ["bin/%s.%slinux%srelease" % (x, infix, self.cxx) for x in binaries], + 'dirs': [], } super(EB_Rosetta, self).sanity_check_step(custom_paths=custom_paths) diff --git a/easybuild/easyblocks/r/ruby.py b/easybuild/easyblocks/r/ruby.py index 995830518a..b2edcb8d92 100644 --- a/easybuild/easyblocks/r/ruby.py +++ b/easybuild/easyblocks/r/ruby.py @@ -38,7 +38,7 @@ class EB_Ruby(ConfigureMake): """Building and installing Ruby including support for gems""" - + def prepare_for_extensions(self): """Sets default class and filter for gems""" self.cfg['exts_defaultclass'] = 'RubyGem' diff --git a/easybuild/easyblocks/s/samtools.py b/easybuild/easyblocks/s/samtools.py index 9cf4e4dfa3..33547b0553 100644 --- a/easybuild/easyblocks/s/samtools.py +++ b/easybuild/easyblocks/s/samtools.py @@ -59,7 +59,7 @@ def __init__(self, *args, **kwargs): if LooseVersion(self.version) < LooseVersion('1.0'): self.bin_files += ["bcftools/vcfutils.pl", "bcftools/bcftools"] - self.include_files += ["bgzf.h", "faidx.h", "khash.h", "klist.h", "knetfile.h", "razf.h", + self.include_files += ["bgzf.h", "faidx.h", "khash.h", "klist.h", "knetfile.h", "razf.h", "kseq.h", "ksort.h", "kstring.h"] elif LooseVersion(self.version) >= LooseVersion('1.0'): self.bin_files += ["misc/plot-bamstats", "misc/seq_cache_populate.pl"] diff --git a/easybuild/easyblocks/s/sas.py b/easybuild/easyblocks/s/sas.py index a14f000432..7222252024 100644 --- a/easybuild/easyblocks/s/sas.py +++ b/easybuild/easyblocks/s/sas.py @@ -76,20 +76,20 @@ def install_step(self): "Sample Library:": os.path.join(self.installdir, 'cstSampleLibrary'), } std_qa = { - "Incomplete Deployment\s*(.*[^:])+Selection:": '2', # 2: Ignore previous deployment and start again - "Select a language(.*[^:]\s*\n)+Selection:": '', - "Select Deployment Task\s*(.*[^:]\s*\n)+Selection:": '', - "Specify SAS Home\s*(.*[^:]\s*\n)+Selection:": '2', # Create a new SAS Home - "Select Deployment Type\s*(.*[^:]\n)+Selection:": '2', # 2: Install SAS Foundation - "Select Products to Install\s*(.*[^:]\n)+Selection:": '1', # SAS Foundation - "Product\s*(.*[^:]\n)+Selections:": '', - "Select Language Support\s*(.*[^:]\n)+Selections:": '', - "Select Regional Settings\s*(.*[^:]\n)+Selection:": '', - "Select Support Option\s*(.*[^:]\n)+Selection:": '2', # 2: Do Not Send - "Select SAS Foundation Products(.*[^:]\s*\n)+Selection:": '', + r"Incomplete Deployment\s*(.*[^:])+Selection:": '2', # 2: Ignore previous deployment and start again + r"Select a language(.*[^:]\s*\n)+Selection:": '', + r"Select Deployment Task\s*(.*[^:]\s*\n)+Selection:": '', + r"Specify SAS Home\s*(.*[^:]\s*\n)+Selection:": '2', # Create a new SAS Home + r"Select Deployment Type\s*(.*[^:]\n)+Selection:": '2', # 2: Install SAS Foundation + r"Select Products to Install\s*(.*[^:]\n)+Selection:": '1', # SAS Foundation + r"Product\s*(.*[^:]\n)+Selections:": '', + r"Select Language Support\s*(.*[^:]\n)+Selections:": '', + r"Select Regional Settings\s*(.*[^:]\n)+Selection:": '', + r"Select Support Option\s*(.*[^:]\n)+Selection:": '2', # 2: Do Not Send + r"Select SAS Foundation Products(.*[^:]\s*\n)+Selection:": '', } no_qa = [ - "\.\.\.$", + r"\.\.\.$", ] run_cmd_qa("./setup.sh -console", qa, no_qa=no_qa, std_qa=std_qa, log_all=True, simple=True) diff --git a/easybuild/easyblocks/s/scalapack.py b/easybuild/easyblocks/s/scalapack.py index d7a0c0e5d7..41ab2952c2 100644 --- a/easybuild/easyblocks/s/scalapack.py +++ b/easybuild/easyblocks/s/scalapack.py @@ -37,7 +37,7 @@ from distutils.version import LooseVersion import easybuild.tools.toolchain as toolchain -from easybuild.easyblocks.blacs import det_interface #@UnresolvedImport +from easybuild.easyblocks.blacs import det_interface # @UnresolvedImport from easybuild.easyblocks.generic.configuremake import ConfigureMake from easybuild.toolchains.linalg.acml import Acml from easybuild.toolchains.linalg.atlas import Atlas @@ -75,9 +75,9 @@ def build_step(self): """Build ScaLAPACK using make after setting make options.""" # MPI compiler commands - known_mpi_libs = [toolchain.MPICH, toolchain.MPICH2, toolchain.MVAPICH2] #@UndefinedVariable - known_mpi_libs += [toolchain.OPENMPI, toolchain.QLOGICMPI] #@UndefinedVariable - known_mpi_libs += [toolchain.INTELMPI] #@UndefinedVariable + known_mpi_libs = [toolchain.MPICH, toolchain.MPICH2, toolchain.MVAPICH2] # @UndefinedVariable + known_mpi_libs += [toolchain.OPENMPI, toolchain.QLOGICMPI] # @UndefinedVariable + known_mpi_libs += [toolchain.INTELMPI] # @UndefinedVariable if os.getenv('MPICC') and os.getenv('MPIF77') and os.getenv('MPIF90'): mpicc = os.getenv('MPICC') mpif77 = os.getenv('MPIF77') @@ -223,8 +223,8 @@ def install_step(self): # include files and libraries path_info = [ - ('SRC', 'include', '.h'), # include files - ('', 'lib', '.a'), # libraries + ('SRC', 'include', '.h'), # include files + ('', 'lib', '.a'), # libraries ] for (srcdir, destdir, ext) in path_info: diff --git a/easybuild/easyblocks/s/scotch.py b/easybuild/easyblocks/s/scotch.py index dec34d255b..d45e47dd31 100644 --- a/easybuild/easyblocks/s/scotch.py +++ b/easybuild/easyblocks/s/scotch.py @@ -80,9 +80,9 @@ def configure_step(self): (r"^CCP\s*=.*$", "CCP\t= $(MPICC)"), (r"^CCD\s*=.*$", "CCD\t= $(MPICC)"), # append -lpthread to LDFLAGS - (r"^LDFLAGS\s*=(?P.*$)", "LDFLAGS\t=\g -lpthread"), + (r"^LDFLAGS\s*=(?P.*$)", r"LDFLAGS\t=\g -lpthread"), # prepend -L${EBROOTZLIB}/lib to LDFLAGS - (r"^LDFLAGS\s*=(?P.*$)", "LDFLAGS\t=-L${EBROOTZLIB}/lib \g"), + (r"^LDFLAGS\s*=(?P.*$)", r"LDFLAGS\t=-L${EBROOTZLIB}/lib \g"), ] apply_regex_substitutions(makefile_inc, regex_subs) @@ -156,14 +156,14 @@ def sanity_check_step(self): 'dggath', 'dgmap', 'dgord', 'dgpart', 'dgscat', 'dgtst', 'gbase', 'gcv', 'gmap', 'gmk_hy', 'gmk_m2', 'gmk_m3', 'gmk_msh', 'gmk_ub2', 'gmtst', 'gord', 'gotst', 'gout', 'gpart', 'gscat', 'gtst', 'mcv', 'mmk_m2', 'mmk_m3', 'mord', 'mtst'] - custom_paths['files'].extend([os.path.join('bin', b) for b in binaries]) + custom_paths['files'].extend([os.path.join('bin', x) for x in binaries]) headers = ['esmumps', 'ptscotch', 'ptscotchf', 'scotch', 'scotchf'] - custom_paths['files'].extend([os.path.join('include', '%s.h' % h) for h in headers]) + custom_paths['files'].extend([os.path.join('include', '%s.h' % x) for x in headers]) libraries = ['esmumps', 'ptesmumps', 'ptscotch', 'ptscotcherr', 'ptscotcherrexit', 'scotch', 'scotch_group', 'scotcherr', 'scotcherrexit'] - custom_paths['files'].extend([os.path.join('lib', 'lib%s.a' % l) for l in libraries]) + custom_paths['files'].extend([os.path.join('lib', 'lib%s.a' % x) for x in libraries]) custom_commands = [] diff --git a/easybuild/easyblocks/s/siesta.py b/easybuild/easyblocks/s/siesta.py index 3a59b7aa2c..d235f9072e 100644 --- a/easybuild/easyblocks/s/siesta.py +++ b/easybuild/easyblocks/s/siesta.py @@ -343,7 +343,7 @@ def configure_step(self): 'SiestaSubroutine/SimpleTest/Src/simple_pipes_serial', 'SiestaSubroutine/SimpleTest/Src/simple_sockets_parallel', 'SiestaSubroutine/SimpleTest/Src/simple_sockets_serial', - ]) + ]) expected_utils.extend([ 'Sockets/f2fmaster', 'Sockets/f2fslave', ]) diff --git a/easybuild/easyblocks/s/snphylo.py b/easybuild/easyblocks/s/snphylo.py index 9b4cce1e78..4039951175 100644 --- a/easybuild/easyblocks/s/snphylo.py +++ b/easybuild/easyblocks/s/snphylo.py @@ -30,7 +30,6 @@ """ import os import re -import shutil import stat from distutils.version import LooseVersion diff --git a/easybuild/easyblocks/s/soapdenovo.py b/easybuild/easyblocks/s/soapdenovo.py index 268ac25e7a..9f7984643b 100644 --- a/easybuild/easyblocks/s/soapdenovo.py +++ b/easybuild/easyblocks/s/soapdenovo.py @@ -36,7 +36,7 @@ def __init__(self, *args, **kwargs): def configure_step(self): """ - Skip the configure as not part of this build process + Skip the configure as not part of this build process """ pass @@ -59,8 +59,8 @@ def sanity_check_step(self): """Custom sanity check for SOAPdenovo.""" custom_paths = { - 'files': ['bin/SOAPdenovo-%s' % x for x in self.bin_suffixes], - 'dirs': [] - } + 'files': ['bin/SOAPdenovo-%s' % x for x in self.bin_suffixes], + 'dirs': [] + } super(EB_SOAPdenovo, self).sanity_check_step(custom_paths=custom_paths) diff --git a/easybuild/easyblocks/s/stata.py b/easybuild/easyblocks/s/stata.py index 8c1c13cfc7..adae036394 100644 --- a/easybuild/easyblocks/s/stata.py +++ b/easybuild/easyblocks/s/stata.py @@ -41,14 +41,14 @@ class EB_Stata(PackedBinary): def install_step(self): """Custom install procedure for Stata.""" - + change_dir(self.installdir) cmd = os.path.join(self.cfg['start_dir'], 'install') std_qa = { - "Do you wish to continue\?\s*\(y/n or q to quit\)": 'y', - "Are you sure you want to install into .*\?\s*\(y/n or q\)": 'y', - "Okay to proceed\s*\(y/n or q to quit\)": 'y', + r"Do you wish to continue\?\s*\(y/n or q to quit\)": 'y', + r"Are you sure you want to install into .*\?\s*\(y/n or q\)": 'y', + r"Okay to proceed\s*\(y/n or q to quit\)": 'y', } no_qa = [ "About to proceed with installation:", @@ -58,7 +58,8 @@ def install_step(self): ] run_cmd_qa(cmd, {}, no_qa=no_qa, std_qa=std_qa, log_all=True, simple=True) - print_msg("Note: you need to manually run ./stinit in %s to initialise the license for Stata!" % self.installdir) + print_msg("Note: you need to manually run ./stinit in %s to initialise the license for Stata!", + self.installdir) def sanity_check_step(self): """Custom sanity check for Stata.""" diff --git a/easybuild/easyblocks/s/suitesparse.py b/easybuild/easyblocks/s/suitesparse.py index 5afbd39dc1..f129df0d7e 100644 --- a/easybuild/easyblocks/s/suitesparse.py +++ b/easybuild/easyblocks/s/suitesparse.py @@ -216,7 +216,7 @@ def sanity_check_step(self): # Latest version of SuiteSparse also compiles shared library and put them in 'lib' shlib_ext = get_shared_lib_ext() if LooseVersion(self.version) >= LooseVersion('4.5.1'): - libs += [os.path.join('lib', 'lib%s.%s' % (l.lower(), shlib_ext)) for l in libnames] + libs += [os.path.join('lib', 'lib%s.%s' % (x.lower(), shlib_ext)) for x in libnames] custom_paths = { 'files': libs, diff --git a/easybuild/easyblocks/t/tau.py b/easybuild/easyblocks/t/tau.py index 83d538fbc9..df382a0a7f 100644 --- a/easybuild/easyblocks/t/tau.py +++ b/easybuild/easyblocks/t/tau.py @@ -196,7 +196,7 @@ def configure_step(self): raise EasyBuildError("Failed to determine MPI include/library paths, no MPI available in toolchain?") # make sure selected default TAU makefile will be available - avail_makefiles = ['Makefile.' + l for l in self.variant_labels] + avail_makefiles = ['Makefile.' + x for x in self.variant_labels] if self.cfg['tau_makefile'] not in avail_makefiles: raise EasyBuildError("Specified tau_makefile %s will not be available (only: %s)", self.cfg['tau_makefile'], avail_makefiles) @@ -251,8 +251,8 @@ def sanity_check_step(self): 'files': [os.path.join('bin', 'pprof'), os.path.join('include', 'TAU.h'), os.path.join('lib', 'libTAU.%s' % get_shared_lib_ext())] + - [os.path.join('lib', 'lib%s.a' % l) for l in self.variant_labels] + - [os.path.join('lib', 'Makefile.' + l) for l in self.variant_labels], + [os.path.join('lib', 'lib%s.a' % x) for x in self.variant_labels] + + [os.path.join('lib', 'Makefile.' + x) for x in self.variant_labels], 'dirs': [], } super(EB_TAU, self).sanity_check_step(custom_paths=custom_paths) diff --git a/easybuild/easyblocks/t/tornado.py b/easybuild/easyblocks/t/tornado.py index 9a9e701229..84137d77ce 100644 --- a/easybuild/easyblocks/t/tornado.py +++ b/easybuild/easyblocks/t/tornado.py @@ -30,6 +30,7 @@ import os from easybuild.easyblocks.generic.packedbinary import PackedBinary + class EB_Tornado(PackedBinary): """EasyBlock for Tornado""" diff --git a/easybuild/easyblocks/t/totalview.py b/easybuild/easyblocks/t/totalview.py index d797411f00..fcc26afcc0 100644 --- a/easybuild/easyblocks/t/totalview.py +++ b/easybuild/easyblocks/t/totalview.py @@ -23,7 +23,6 @@ from easybuild.framework.easyconfig.types import ensure_iterable_license_specs from easybuild.tools.build_log import EasyBuildError from easybuild.tools.filetools import find_flexlm_license -from easybuild.tools.modules import get_software_root from easybuild.tools.run import run_cmd @@ -57,7 +56,7 @@ def configure_step(self): env.setvar(self.license_env_var, self.license_file) else: - raise EasyBuildError("No viable license specifications found; specify 'license_file' or "+ + raise EasyBuildError("No viable license specifications found; specify 'license_file' or " + "define $LM_LICENSE_FILE") def install_step(self): @@ -93,5 +92,6 @@ def make_module_req_guess(self): def make_module_extra(self): """Add extra environment variables for license file and anything else.""" txt = super(EB_TotalView, self).make_module_extra() - txt += self.module_generator.prepend_paths(self.license_env_var, [self.license_file], allow_abs=True, expand_relpaths=False) + txt += self.module_generator.prepend_paths(self.license_env_var, [self.license_file], + allow_abs=True, expand_relpaths=False) return txt diff --git a/easybuild/easyblocks/t/trilinos.py b/easybuild/easyblocks/t/trilinos.py index 86d135c6a7..406ed69551 100644 --- a/easybuild/easyblocks/t/trilinos.py +++ b/easybuild/easyblocks/t/trilinos.py @@ -81,7 +81,8 @@ def configure_step(self): cxxflags = [os.getenv('CXXFLAGS')] fflags = [os.getenv('FFLAGS')] - ignore_cxx_seek_mpis = [toolchain.INTELMPI, toolchain.MPICH, toolchain.MPICH2, toolchain.MVAPICH2] #@UndefinedVariable + ignore_cxx_seek_mpis = [toolchain.INTELMPI, toolchain.MPICH, + toolchain.MPICH2, toolchain.MVAPICH2] # @UndefinedVariable ignore_cxx_seek_flag = "-DMPICH_IGNORE_CXX_SEEK" if self.toolchain.mpi_family() in ignore_cxx_seek_mpis: cflags.append(ignore_cxx_seek_flag) @@ -115,15 +116,15 @@ def configure_step(self): for dep in ["BLAS", "LAPACK"]: self.cfg.update('configopts', '-DTPL_ENABLE_%s:BOOL=ON' % dep) libdirs = os.getenv('%s_LIB_DIR' % dep) - if self.toolchain.comp_family() == toolchain.GCC: #@UndefinedVariable + if self.toolchain.comp_family() == toolchain.GCC: # @UndefinedVariable libdirs += ";%s/lib64" % get_software_root('GCC') self.cfg.update('configopts', '-D%s_LIBRARY_DIRS="%s"' % (dep, libdirs)) if self.cfg['openmp']: libs = os.getenv('%s_MT_STATIC_LIBS' % dep).split(',') else: libs = os.getenv('%s_STATIC_LIBS' % dep).split(',') - lib_names = ';'.join([lib_re.search(l).group(1) for l in libs]) - if self.toolchain.comp_family() == toolchain.GCC: #@UndefinedVariable + lib_names = ';'.join([lib_re.search(x).group(1) for x in libs]) + if self.toolchain.comp_family() == toolchain.GCC: # @UndefinedVariable # explicitely specify static lib! lib_names += ";libgfortran.a" self.cfg.update('configopts', '-D%s_LIBRARY_NAMES="%s"' % (dep, lib_names)) @@ -178,7 +179,7 @@ def configure_step(self): self.cfg.update('configopts', "-DTPL_ENABLE_SCALAPACK:BOOL=ON") self.cfg.update('configopts', '-DSCALAPACK_INCLUDE_DIRS:PATH="%s"' % os.getenv('SCALAPACK_INC_DIR')) self.cfg.update('configopts', '-DSCALAPACK_LIBRARY_DIRS:PATH="%s;%s"' % (os.getenv('SCALAPACK_LIB_DIR'), - os.getenv('BLACS_LIB_DIR'))) + os.getenv('BLACS_LIB_DIR'))) # PETSc petsc = get_software_root('PETSc') if petsc: @@ -186,14 +187,14 @@ def configure_step(self): incdirs = [os.path.join(petsc, "include")] self.cfg.update('configopts', '-DPETSC_INCLUDE_DIRS:PATH="%s"' % ';'.join(incdirs)) petsc_libdirs = [ - os.path.join(petsc, "lib"), - os.path.join(suitesparse, "UMFPACK", "Lib"), - os.path.join(suitesparse, "CHOLMOD", "Lib"), - os.path.join(suitesparse, "COLAMD", "Lib"), - os.path.join(suitesparse, "AMD", "Lib"), - os.getenv('FFTW_LIB_DIR'), - os.path.join(get_software_root('ParMETIS'), "Lib") - ] + os.path.join(petsc, "lib"), + os.path.join(suitesparse, "UMFPACK", "Lib"), + os.path.join(suitesparse, "CHOLMOD", "Lib"), + os.path.join(suitesparse, "COLAMD", "Lib"), + os.path.join(suitesparse, "AMD", "Lib"), + os.getenv('FFTW_LIB_DIR'), + os.path.join(get_software_root('ParMETIS'), "Lib") + ] self.cfg.update('configopts', '-DPETSC_LIBRARY_DIRS:PATH="%s"' % ';'.join(petsc_libdirs)) petsc_libnames = ["petsc", "umfpack", "cholmod", "colamd", "amd", "parmetis", "metis"] petsc_libnames += [lib_re.search(x).group(1) for x in os.getenv('FFTW_STATIC_LIBS').split(',')] @@ -207,8 +208,8 @@ def configure_step(self): deproot = get_software_root(dep) if deproot: depmap = { - 'SCOTCH': 'Scotch', - } + 'SCOTCH': 'Scotch', + } dep = depmap.get(dep, dep) self.cfg.update('configopts', "-DTPL_ENABLE_%s:BOOL=ON" % dep) incdir = os.path.join(deproot, "include") @@ -267,10 +268,10 @@ def sanity_check_step(self): "Pamgen", "RTOp", "Rythmos", "Sacado", "Shards", "Stratimikos", "Teuchos", "Tpetra", "Triutils", "Zoltan"] - libs = [l for l in libs if not l in self.cfg['skip_exts']] + libs = [x for x in libs if x not in self.cfg['skip_exts']] # Teuchos was refactored in 11.2 - if LooseVersion(self.version) >= LooseVersion('11.2') and 'Teuchos' in libs: + if LooseVersion(self.version) >= LooseVersion('11.2') and 'Teuchos' in libs: libs.remove('Teuchos') libs.extend(['teuchoscomm', 'teuchoscore', 'teuchosnumerics', 'teuchosparameterlist', 'teuchosremainder']) @@ -291,7 +292,7 @@ def sanity_check_step(self): lib_ext = 'a' custom_paths = { - 'files': [os.path.join('lib', 'lib%s.%s' % (l.lower(), lib_ext)) for l in libs], + 'files': [os.path.join('lib', 'lib%s.%s' % (x.lower(), lib_ext)) for x in libs], 'dirs': ['bin', 'include'] } diff --git a/easybuild/easyblocks/t/trinity.py b/easybuild/easyblocks/t/trinity.py index 4c84080482..76200ad3a3 100644 --- a/easybuild/easyblocks/t/trinity.py +++ b/easybuild/easyblocks/t/trinity.py @@ -35,9 +35,7 @@ """ import glob import os -import re import shutil -import sys from distutils.version import LooseVersion import easybuild.tools.toolchain as toolchain diff --git a/easybuild/easyblocks/u/ufc.py b/easybuild/easyblocks/u/ufc.py index 8897058faf..92cef99a19 100644 --- a/easybuild/easyblocks/u/ufc.py +++ b/easybuild/easyblocks/u/ufc.py @@ -56,7 +56,7 @@ def configure_step(self): if not deproot: raise EasyBuildError("%s module not loaded?", dep) else: - depsdict.update({dep:deproot}) + depsdict.update({dep: deproot}) # SWIG version more recent than 2.0.4 have a regression # which causes problems with e.g. DOLFIN if UFC was built with it diff --git a/easybuild/easyblocks/v/velvet.py b/easybuild/easyblocks/v/velvet.py index 23e5a54728..136e357d5c 100644 --- a/easybuild/easyblocks/v/velvet.py +++ b/easybuild/easyblocks/v/velvet.py @@ -39,7 +39,11 @@ def install_step(self): srcdir = self.cfg['start_dir'] destdir = os.path.join(self.installdir, 'bin') srcfile = None - # Get executable files: for i in $(find . -maxdepth 1 -type f -perm +111 -print | sed -e 's/\.\///g' | awk '{print "\""$0"\""}' | grep -vE "\.sh|\.html"); do echo -ne "$i, "; done && echo + # Get executable files: + # for i in $(find . -maxdepth 1 -type f -perm +111 -print | sed -e 's/\.\///g' | awk '{print "\""$0"\""}' \ + # | grep -vE "\.sh|\.html"); do + # echo -ne "$i, " + # done && echo try: os.makedirs(destdir) for filename in ["velveth", "velvetg"]: diff --git a/setup.py b/setup.py index 33e196ed98..2af8179857 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ from distutils.core import setup sys.path.append('easybuild') -from easyblocks import VERSION +from easyblocks import VERSION # noqa FRAMEWORK_MAJVER = str(VERSION).split('.')[0] @@ -58,7 +58,8 @@ def read(fname): version=str(VERSION), author="EasyBuild community", author_email="easybuild@lists.ugent.be", - description="""Python modules which implement support for installing particular (groups of) software packages with EasyBuild.""", + description="""Python modules which implement support for installing particular + (groups of) software packages with EasyBuild.""", license="GPLv2", keywords="software build building installation installing compilation HPC scientific", url="https://easybuilders.github.io/easybuild", diff --git a/test/__init__.py b/test/__init__.py index d90fcf4771..b67524e91b 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -35,4 +35,4 @@ from pkgutil import extend_path # we're not the only ones in this namespace -__path__ = extend_path(__path__, __name__) #@ReservedAssignment +__path__ = extend_path(__path__, __name__) # @ReservedAssignment diff --git a/test/easyblocks/general.py b/test/easyblocks/general.py index 407ed7dd23..2303c9ef8f 100644 --- a/test/easyblocks/general.py +++ b/test/easyblocks/general.py @@ -101,7 +101,8 @@ def test_custom_easyblocks_repo(self): # determine path to where easybuild.framework is imported from, so we can hard set $PYTHONPATH # this is required to dance around issues with easy-install.pth files determining the actual Python search path - # see also http://blog.olgabotvinnik.com/blog/2014/03/03/2014-03-03-pythonpath-is-a-liar-site-py-and-easy-install-pth-tell/ + # see also + # http://blog.olgabotvinnik.com/blog/2014/03/03/2014-03-03-pythonpath-is-a-liar-site-py-and-easy-install-pth-tell/ import easybuild.framework framework_path = up(easybuild.framework.__file__, 3) diff --git a/test/easyblocks/init_easyblocks.py b/test/easyblocks/init_easyblocks.py index 76a812f599..62f968edd4 100644 --- a/test/easyblocks/init_easyblocks.py +++ b/test/easyblocks/init_easyblocks.py @@ -108,7 +108,7 @@ def check_extra_options_format(extra_options): self.assertTrue(isinstance(extra_options[key], list)) self.assertTrue(len(extra_options[key]), 3) - class_regex = re.compile("^class (.*)\(.*", re.M) + class_regex = re.compile(r"^class (.*)\(.*", re.M) self.log.debug("easyblock: %s" % easyblock) @@ -136,7 +136,7 @@ def check_extra_options_format(extra_options): if re.search('def prepare_step', txt): regex = re.compile(r"def prepare_step\(self, \*args, \*\*kwargs\):") self.assertTrue(regex.search(txt), "Pattern '%s' found in %s" % (regex.pattern, easyblock)) - if re.search('\.prepare_step\(', txt): + if re.search(r'\.prepare_step\(', txt): regex = re.compile(r"\.prepare_step\(.*\*args,.*\*\*kwargs\.*\)") self.assertTrue(regex.search(txt), "Pattern '%s' found in %s" % (regex.pattern, easyblock)) @@ -189,6 +189,10 @@ def check_extra_options_format(extra_options): def suite(): """Return all easyblock initialisation tests.""" + def make_inner_test(easyblock, **kwargs): + def innertest(self): + template_init_test(self, easyblock, **kwargs) + return innertest # dynamically generate a separate test for each of the available easyblocks easyblocks_path = get_paths_for("easyblocks")[0] @@ -199,14 +203,12 @@ def suite(): # dynamically define new inner functions that can be added as class methods to InitTest if os.path.basename(easyblock) == 'systemcompiler.py': # use GCC as name when testing SystemCompiler easyblock - code = "def innertest(self): template_init_test(self, '%s', name='GCC', version='system')" % easyblock + innertest = make_inner_test(easyblock, name='GCC', version='system') elif os.path.basename(easyblock) == 'systemmpi.py': # use OpenMPI as name when testing SystemMPI easyblock - code = "def innertest(self): template_init_test(self, '%s', name='OpenMPI', version='system')" % easyblock + innertest = make_inner_test(easyblock, name='OpenMPI', version='system') else: - code = "def innertest(self): template_init_test(self, '%s')" % easyblock - - exec(code, globals()) + innertest = make_inner_test(easyblock) innertest.__doc__ = "Test for initialisation of easyblock %s" % easyblock innertest.__name__ = "test_easyblock_%s" % '_'.join(easyblock.replace('.py', '').split('/')) diff --git a/test/easyblocks/module.py b/test/easyblocks/module.py index b3a955a021..d49ccee99e 100644 --- a/test/easyblocks/module.py +++ b/test/easyblocks/module.py @@ -199,7 +199,7 @@ def template_module_only_test(self, easyblock, name='foo', version='1.3.2', extr tmpdir = tempfile.mkdtemp() - class_regex = re.compile("^class (.*)\(.*", re.M) + class_regex = re.compile(r"^class (.*)\(.*", re.M) self.log.debug("easyblock: %s" % easyblock) @@ -331,6 +331,11 @@ def template_module_only_test(self, easyblock, name='foo', version='1.3.2', extr def suite(): """Return all easyblock --module-only tests.""" + def make_inner_test(easyblock, **kwargs): + def innertest(self): + template_module_only_test(self, easyblock, **kwargs) + return innertest + # initialize configuration (required for e.g. default modules_tool setting) cleanup() eb_go = eboptions.parse_options(args=['--prefix=%s' % TMPDIR]) @@ -368,26 +373,20 @@ def suite(): # dynamically define new inner functions that can be added as class methods to ModuleOnlyTest if os.path.basename(easyblock) == 'systemcompiler.py': # use GCC as name when testing SystemCompiler easyblock - code = "def innertest(self): " - code += "template_module_only_test(self, '%s', name='GCC', version='system')" % easyblock + innertest = make_inner_test(easyblock, name='GCC', version='system') elif os.path.basename(easyblock) == 'systemmpi.py': # use OpenMPI as name when testing SystemMPI easyblock - code = "def innertest(self): " - code += "template_module_only_test(self, '%s', name='OpenMPI', version='system')" % easyblock + innertest = make_inner_test(easyblock, name='OpenMPI', version='system') elif os.path.basename(easyblock) == 'craytoolchain.py': # make sure that a (known) PrgEnv is included as a dependency extra_txt = 'dependencies = [("PrgEnv-gnu/1.2.3", EXTERNAL_MODULE)]' - code = "def innertest(self): " - code += "template_module_only_test(self, '%s', extra_txt='%s')" % (easyblock, extra_txt) + innertest = make_inner_test(easyblock, extra_txt=extra_txt) elif os.path.basename(easyblock) == 'modulerc.py': # exactly one dependency is included with ModuleRC generic easyblock (and name must match) extra_txt = 'dependencies = [("foo", "1.2.3.4.5")]' - code = "def innertest(self): " - code += "template_module_only_test(self, '%s', version='1.2.3.4', extra_txt='%s')" % (easyblock, extra_txt) + innertest = make_inner_test(easyblock, version='1.2.3.4', extra_txt=extra_txt) else: - code = "def innertest(self): template_module_only_test(self, '%s')" % easyblock - - exec(code, globals()) + innertest = make_inner_test(easyblock) innertest.__doc__ = "Test for using --module-only with easyblock %s" % easyblock innertest.__name__ = "test_easyblock_%s" % '_'.join(easyblock.replace('.py', '').split('/'))