Skip to content

Commit

Permalink
Merge pull request #2132 from Flamefire/flake8_clean_generic
Browse files Browse the repository at this point in the history
fix code style issues in generic/*.py
  • Loading branch information
boegel authored Aug 20, 2020
2 parents 4c0de27 + ce7d548 commit 00453ad
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 22 deletions.
3 changes: 1 addition & 2 deletions easybuild/easyblocks/generic/binariestarball.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@ def install_step(self):
if os.path.isfile(item):
shutil.copy2(os.path.join(self.cfg['start_dir'], item), bindir)
# make sure binary has executable permissions
adjust_permissions(os.path.join(bindir, item), stat.S_IXUSR|stat.S_IXGRP|stat.S_IXOTH, add=True)
adjust_permissions(os.path.join(bindir, item), stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH, add=True)
self.log.debug("Copied %s to %s and fixed permissions" % (item, bindir))
else:
self.log.warning("Skipping non-file %s in %s, not copying it." % (item, self.cfg['start_dir']))
except OSError as err:
raise EasyBuildError("Copying binaries in %s to install dir 'bin' failed: %s", self.cfg['start_dir'], err)

1 change: 1 addition & 0 deletions easybuild/easyblocks/generic/binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

PREPEND_TO_PATH_DEFAULT = ['']


class Binary(EasyBlock):
"""
Support for installing software that comes in binary form.
Expand Down
1 change: 1 addition & 0 deletions easybuild/easyblocks/generic/buildenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class BuildEnv(Bundle):
"""
Build environment of toolchain: only generate module file
"""

def make_module_extra(self):
"""Add all the build environment variables."""
txt = super(BuildEnv, self).make_module_extra()
Expand Down
3 changes: 2 additions & 1 deletion easybuild/easyblocks/generic/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ def install_step(self):
comp_cnt = len(self.cfg['components'])
for idx, cfg in enumerate(self.comp_cfgs):

print_msg("installing bundle component %s v%s (%d/%d)..." % (cfg['name'], cfg['version'], idx+1, comp_cnt))
print_msg("installing bundle component %s v%s (%d/%d)..." %
(cfg['name'], cfg['version'], idx + 1, comp_cnt))
self.log.info("Installing component %s v%s using easyblock %s", cfg['name'], cfg['version'], cfg.easyblock)

comp = cfg.easyblock(cfg)
Expand Down
16 changes: 8 additions & 8 deletions easybuild/easyblocks/generic/cmakemake.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,16 @@ def configure_step(self, srcdir=None, builddir=None):

if self.cfg.get('configure_cmd') == DEFAULT_CONFIGURE_CMD:
command = ' '.join([
self.cfg['preconfigopts'],
DEFAULT_CONFIGURE_CMD,
options_string,
self.cfg['configopts'],
srcdir])
self.cfg['preconfigopts'],
DEFAULT_CONFIGURE_CMD,
options_string,
self.cfg['configopts'],
srcdir])
else:
command = ' '.join([
self.cfg['preconfigopts'],
self.cfg.get('configure_cmd'),
self.cfg['configopts']])
self.cfg['preconfigopts'],
self.cfg.get('configure_cmd'),
self.cfg['configopts']])

(out, _) = run_cmd(command, log_all=True, simple=False)

Expand Down
2 changes: 1 addition & 1 deletion easybuild/easyblocks/generic/cmakepythonpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CMakePythonPackage(CMakeMake, PythonPackage):
Some packages use cmake to first build and install C Python packages
and then put the Python package in lib/pythonX.Y/site-packages.
We install this in a seperate location and generate a module file
We install this in a seperate location and generate a module file
which sets the PYTHONPATH.
We use the default CMake implementation, and use make_module_extra from PythonPackage.
Expand Down
1 change: 0 additions & 1 deletion easybuild/easyblocks/generic/conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

from easybuild.easyblocks.generic.binary import Binary
from easybuild.framework.easyconfig import CUSTOM
import easybuild.tools.environment as env
from easybuild.tools.run import run_cmd


Expand Down
3 changes: 2 additions & 1 deletion easybuild/easyblocks/generic/configuremakepythonpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
##
"""
EasyBuild support for Python packages that are configured with 'python configure/make/make install', implemented as an easyblock
EasyBuild support for Python packages that are configured with 'python configure/make/make install',
implemented as an easyblock
@author: Bart Verleye (Centre for eResearch, Auckland)
@author: Kenneth Hoste (Ghent University)
Expand Down
1 change: 1 addition & 0 deletions easybuild/easyblocks/generic/craytoolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class CrayToolchain(Bundle):
"""
Compiler toolchain: generate module file only, nothing to build/install
"""

def prepare_step(self, *args, **kwargs):
"""Prepare build environment (skip loaded of dependencies)."""

Expand Down
1 change: 0 additions & 1 deletion easybuild/easyblocks/generic/packedbinary.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,3 @@ def install_step(self):
raise EasyBuildError("Path %s is not a file nor a directory?", srcpath)
except OSError as err:
raise EasyBuildError("Failed to copy unpacked sources to install directory: %s", err)

5 changes: 4 additions & 1 deletion easybuild/easyblocks/generic/pythonbundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ def make_module_extra(self, *args, **kwargs):
if self.current_step == 'extensions':
new_pylibdirs = self.all_pylibdirs
else:
new_pylibdirs = [l for l in self.all_pylibdirs if os.path.exists(os.path.join(self.installdir, l))]
new_pylibdirs = [
lib_dir for lib_dir in self.all_pylibdirs
if os.path.exists(os.path.join(self.installdir, lib_dir))
]

for pylibdir in new_pylibdirs:
txt += self.module_generator.prepend_paths('PYTHONPATH', pylibdir)
Expand Down
2 changes: 1 addition & 1 deletion easybuild/easyblocks/generic/pythonpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ def sanity_check_step(self, *args, **kwargs):
self.log.info("Detection of downloaded depenencies enabled, checking output of installation command...")
patterns = [
'Downloading .*/packages/.*', # setuptools
'Collecting .* \(from.*', # pip
r'Collecting .* \(from.*', # pip
]
downloaded_deps = []
for pattern in patterns:
Expand Down
10 changes: 5 additions & 5 deletions easybuild/easyblocks/generic/rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def configure_step(self):
cmd = "rpm --version"
(out, _) = run_cmd(cmd, log_all=True, simple=False)

rpmver_re = re.compile("^RPM\s+version\s+(?P<version>[0-9.]+).*")
rpmver_re = re.compile(r"^RPM\s+version\s+(?P<version>[0-9.]+).*")
res = rpmver_re.match(out)
self.log.debug("RPM version found: %s" % res.group())

Expand Down Expand Up @@ -220,9 +220,9 @@ def make_module_req_guess(self):
guesses = super(Rpm, self).make_module_req_guess()

guesses.update({
'PATH': guesses.get('PATH', []) + ['usr/bin', 'sbin', 'usr/sbin'],
'LD_LIBRARY_PATH': guesses.get('LD_LIBRARY_PATH', []) + ['usr/lib', 'usr/lib64'],
'MANPATH': guesses.get('MANPATH', []) + ['usr/share/man'],
})
'PATH': guesses.get('PATH', []) + ['usr/bin', 'sbin', 'usr/sbin'],
'LD_LIBRARY_PATH': guesses.get('LD_LIBRARY_PATH', []) + ['usr/lib', 'usr/lib64'],
'MANPATH': guesses.get('MANPATH', []) + ['usr/share/man'],
})

return guesses

0 comments on commit 00453ad

Please sign in to comment.