Skip to content

Commit

Permalink
Merge pull request #3064 from boegel/install_extension
Browse files Browse the repository at this point in the history
rename `run` method to `install_extension`, and likewise for `prerun` to `pre_install_extension`, `postrun` to `post_install_extension`, and `run_async` to `install_extension_async`
  • Loading branch information
lexming authored Mar 11, 2024
2 parents 7ff6d2a + 34bfca6 commit e2c3d37
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 40 deletions.
4 changes: 2 additions & 2 deletions easybuild/easyblocks/generic/juliapackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ def install_step(self):

return res.output

def run(self):
def install_extension(self):
"""Install Julia package as an extension."""

if not self.src:
errmsg = "No source found for Julia package %s, required for installation. (src: %s)"
raise EasyBuildError(errmsg, self.name, self.src)
ExtensionEasyBlock.run(self, unpack_src=True)
ExtensionEasyBlock.install_extension(self, unpack_src=True)

self.set_pkg_offline()
self.set_depot_path() # all extensions share common depot in installdir
Expand Down
2 changes: 1 addition & 1 deletion easybuild/easyblocks/generic/ocamlpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def configure_step(self):
"""Raise error when configure step is run: installing OCaml packages stand-alone is not supported (yet)"""
raise EasyBuildError("Installing OCaml packages stand-alone is not supported (yet)")

def run(self):
def install_extension(self):
"""Perform OCaml package installation (as extension)."""
# install using 'opam install'
run_shell_cmd("eval `opam config env` && opam install -yv %s.%s" % (self.name, self.version))
Expand Down
4 changes: 2 additions & 2 deletions easybuild/easyblocks/generic/octavepackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ def configure_step(self):
"""Raise error when configure step is run: installing Octave toolboxes stand-alone is not supported (yet)"""
raise EasyBuildError("Installing Octave toolboxes stand-alone is not supported (yet)")

def run(self):
def install_extension(self):
"""Perform Octave package installation (as extension)."""

# if patches are specified, we need to unpack the source tarball, apply the patch,
# and create a temporary tarball to use for installation
if self.patches:
# call out to ExtensionEasyBlock to unpack & apply patches
super(OctavePackage, self).run(unpack_src=True)
super(OctavePackage, self).install_extension(unpack_src=True)

# create temporary tarball from unpacked & patched source
src = os.path.join(tempfile.gettempdir(), '%s-%s-patched.tar.gz' % (self.name, self.version))
Expand Down
4 changes: 2 additions & 2 deletions easybuild/easyblocks/generic/perlmodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ def install_perl_module(self):
run_shell_cmd('%s perl Build %s %s' % (self.cfg['pretestopts'], runtest, self.cfg['testopts']))
run_shell_cmd('%s perl Build install %s' % (self.cfg['preinstallopts'], self.cfg['installopts']))

def run(self):
def install_extension(self):
"""Perform the actual Perl module build/installation procedure"""

if not self.src:
raise EasyBuildError("No source found for Perl module %s, required for installation. (src: %s)",
self.name, self.src)
ExtensionEasyBlock.run(self, unpack_src=True)
ExtensionEasyBlock.install_extension(self, unpack_src=True)

self.install_perl_module()

Expand Down
8 changes: 4 additions & 4 deletions easybuild/easyblocks/generic/pythonpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,9 +684,9 @@ def extract_step(self):
if self._should_unpack_source():
super(PythonPackage, self).extract_step()

def prerun(self):
def pre_install_extension(self):
"""Prepare for installing Python package."""
super(PythonPackage, self).prerun()
super(PythonPackage, self).pre_install_extension()
self.prepare_python()

def prepare_step(self, *args, **kwargs):
Expand Down Expand Up @@ -903,15 +903,15 @@ def install_step(self):
if value is not None:
env.setvar(name, value, verbose=False)

def run(self, *args, **kwargs):
def install_extension(self, *args, **kwargs):
"""Perform the actual Python package build/installation procedure"""

if not self.src:
raise EasyBuildError("No source found for Python package %s, required for installation. (src: %s)",
self.name, self.src)
# we unpack unless explicitly told otherwise
kwargs.setdefault('unpack_src', self._should_unpack_source())
super(PythonPackage, self).run(*args, **kwargs)
super(PythonPackage, self).install_extension(*args, **kwargs)

# configure, build, test, install
# See EasyBlock.get_steps
Expand Down
6 changes: 3 additions & 3 deletions easybuild/easyblocks/generic/rpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def prepare_r_ext_install(self):
mkdir(lib_install_prefix, parents=True)

if self.src:
super(RPackage, self).run(unpack_src=True)
super(RPackage, self).install_extension(unpack_src=True)
self.ext_src = self.src
self.update_config_guess(self.ext_dir)
self.log.debug("Installing R package %s version %s." % (self.name, self.version))
Expand All @@ -293,14 +293,14 @@ def prepare_r_ext_install(self):

return cmd, stdin

def run(self):
def install_extension(self):
"""
Install R package as an extension.
"""
cmd, stdin = self.prepare_r_ext_install()
self.install_R_package(cmd, inp=stdin)

def run_async(self, thread_pool):
def install_extension_async(self, thread_pool):
"""
Start installation of R package as an extension asynchronously.
"""
Expand Down
4 changes: 2 additions & 2 deletions easybuild/easyblocks/generic/rubygem.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ def __init__(self, *args, **kwargs):
super(RubyGem, self).__init__(*args, **kwargs)
self.ext_src = None

def run(self):
def install_extension(self):
"""Perform the actual Ruby gem build/install"""
if not self.src:
raise EasyBuildError("No source found for Ruby Gem %s, required for installation.", self.name)

super(RubyGem, self).run()
super(RubyGem, self).install_extension()

self.ext_src = self.src
self.log.debug("Installing Ruby gem %s version %s." % (self.name, self.version))
Expand Down
2 changes: 1 addition & 1 deletion easybuild/easyblocks/generic/tarball.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def build_step(self):
"""
pass

def run(self, *args, **kwargs):
def install_extension(self, *args, **kwargs):
"""Install as extension: unpack sources and copy (via install step)."""
if self.cfg['install_type'] is None:
self.log.info("Auto-enabled install_type=merge because Tarball is being used to install an extension")
Expand Down
14 changes: 7 additions & 7 deletions easybuild/easyblocks/m/mxnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ def extensions_step(self):
self.py_ext.src = os.path.join(self.mxnet_src_dir, "python")
change_dir(self.py_ext.src)

self.py_ext.prerun()
self.py_ext.run(unpack_src=False)
self.py_ext.postrun()
self.py_ext.pre_install_extension()
self.py_ext.install_extension(unpack_src=False)
self.py_ext.post_install_extension()

if self.cfg['install_r_ext']:
# This is off by default, because it's been working in the old version of MXNet and now it's not.
Expand All @@ -212,18 +212,18 @@ def install_r_ext(self):
# MXNet doesn't provide a list of its R dependencies by default
write_file("NAMESPACE", R_NAMESPACE)
change_dir(self.mxnet_src_dir)
self.r_ext.prerun()
self.r_ext.pre_install_extension()
# MXNet is just weird. To install the R extension, we have to:
# - First install the extension like it is
# - Let R export the extension again. By doing this, all the dependencies get
# correctly filled and some mappings are done
# - Reinstal the exported version
self.r_ext.run()
self.r_ext.install_extension()
cmd = "R_LIBS=%s Rscript -e \"require(mxnet); mxnet:::mxnet.export(\\\"R-package\\\")\""
run_shell_cmd(cmd % self.installdir)
change_dir(self.r_ext.src)
self.r_ext.run()
self.r_ext.postrun()
self.r_ext.install_extension()
self.r_ext.post_install_extension()

def sanity_check_step(self):
"""Check for main library files for MXNet"""
Expand Down
4 changes: 2 additions & 2 deletions easybuild/easyblocks/n/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,9 @@ def install_step(self):
except OSError as err:
raise EasyBuildError("Failed to clean up numpy build dir %s: %s", builddir, err)

def run(self):
def install_extension(self):
"""Install numpy as an extension"""
super(EB_numpy, self).run()
super(EB_numpy, self).install_extension()

return self.make_module_extra_numpy_include()

Expand Down
4 changes: 2 additions & 2 deletions easybuild/easyblocks/p/pbdmpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def configure_step(self):

super(EB_pbdMPI, self).configure_step()

def run(self):
def install_extension(self):
"""Configure before installing pbdMPI as an extension."""
self.configure_step()
super(EB_pbdMPI, self).run()
super(EB_pbdMPI, self).install_extension()
4 changes: 2 additions & 2 deletions easybuild/easyblocks/r/reticulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
class EB_reticulate(RPackage):
"""Support for installing the reticulate R package."""

def run(self):
def install_extension(self):
"""Add extra environment variables to modulefile"""

txt = super(EB_reticulate, self).run()
txt = super(EB_reticulate, self).install_extension()
if not txt:
txt = ""

Expand Down
8 changes: 4 additions & 4 deletions easybuild/easyblocks/r/rmpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,18 @@ def prepare_rmpi_configureargs(self):
"--with-Rmpi-type=%s" % rmpi_type,
]

def run(self):
def install_extension(self):
"""
Install Rmpi as extension, after seting various configure arguments.
"""
self.prepare_rmpi_configureargs()
# it might be needed to get the R cmd and run it with mympirun...
super(EB_Rmpi, self).run()
super(EB_Rmpi, self).install_extension()

def run_async(self, *args, **kwargs):
def install_extension_async(self, *args, **kwargs):
"""
Asynchronously install Rmpi as extension, after seting various configure arguments.
"""
self.prepare_rmpi_configureargs()
# it might be needed to get the R cmd and run it with mympirun...
return super(EB_Rmpi, self).run_async(*args, **kwargs)
super(EB_Rmpi, self).install_extension_async(*args, **kwargs)
8 changes: 4 additions & 4 deletions easybuild/easyblocks/r/rserve.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
class EB_Rserve(RPackage):
"""Build and install Rserve R library."""

def run(self):
def install_extension(self):
"""Set LIBS environment variable correctly prior to building."""
self.configurevars = ['LIBS="$LIBS -lpthread"']
super(EB_Rserve, self).run()
super(EB_Rserve, self).install_extension()

def run_async(self, *args, **kwargs):
def install_extension_async(self, *args, **kwargs):
"""Set LIBS environment variable correctly prior to building."""
self.configurevars = ['LIBS="$LIBS -lpthread"']
return super(EB_Rserve, self).run_async(*args, **kwargs)
super(EB_Rserve, self).install_extension_async(*args, **kwargs)
4 changes: 2 additions & 2 deletions easybuild/easyblocks/s/scipion.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ def install_step(self):
linktarget = os.path.join(self.installdir, 'bin', 'scipion')
symlink(os.path.join('..', 'scipion'), linktarget, use_abspath_source=False)

def run(self, *args, **kwargs):
def install_extension(self, *args, **kwargs):
"""Perform the actual Scipion package configure/installation procedure"""

# The ExtensionEasyBlock run does unpack and patch
super(EB_Scipion, self).run(unpack_src=True)
super(EB_Scipion, self).install_extension(unpack_src=True)
self.builddir = self.ext_dir

# configure, build, install
Expand Down

0 comments on commit e2c3d37

Please sign in to comment.