summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2017-05-26 16:37:06 -0500
committerGitHub <noreply@github.com>2017-05-26 16:37:06 -0500
commit6f0ac9d54cc8494cdb4a002c7a203622dfe656eb (patch)
treeec23a3f1617c49a7cc975bee611a474d44f73247 /lib
parentf38d250e508ef933a6f0bf1e0e5be89c23e20559 (diff)
downloadspack-6f0ac9d54cc8494cdb4a002c7a203622dfe656eb.tar.gz
spack-6f0ac9d54cc8494cdb4a002c7a203622dfe656eb.tar.bz2
spack-6f0ac9d54cc8494cdb4a002c7a203622dfe656eb.tar.xz
spack-6f0ac9d54cc8494cdb4a002c7a203622dfe656eb.zip
Add --configure-args/vars support to RPackage (#4289)
* Add --configure-args/vars support to RPackage * Docstring formatting change
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_systems/r.py36
-rw-r--r--lib/spack/spack/cmd/create.py6
2 files changed, 37 insertions, 5 deletions
diff --git a/lib/spack/spack/build_systems/r.py b/lib/spack/spack/build_systems/r.py
index 618ba398e1..a659f75b98 100644
--- a/lib/spack/spack/build_systems/r.py
+++ b/lib/spack/spack/build_systems/r.py
@@ -30,7 +30,10 @@ from spack.package import PackageBase, run_after
class RPackage(PackageBase):
- """Specialized class for packages that are built using R
+ """Specialized class for packages that are built using R.
+
+ For more information on the R build system, see:
+ https://stat.ethz.ch/R-manual/R-devel/library/utils/html/INSTALL.html
This class provides a single phase that can be overridden:
@@ -49,12 +52,37 @@ class RPackage(PackageBase):
depends_on('r', type=('build', 'run'))
+ def configure_args(self, spec, prefix):
+ """Arguments to pass to install via ``--configure-args``."""
+ return []
+
+ def configure_vars(self, spec, prefix):
+ """Arguments to pass to install via ``--configure-vars``."""
+ return []
+
def install(self, spec, prefix):
"""Installs an R package."""
- inspect.getmodule(self).R(
- 'CMD', 'INSTALL',
+
+ config_args = self.configure_args(spec, prefix)
+ config_vars = self.configure_vars(spec, prefix)
+
+ args = [
+ 'CMD',
+ 'INSTALL'
+ ]
+
+ if config_args:
+ args.append('--configure-args={0}'.format(' '.join(config_args)))
+
+ if config_vars:
+ args.append('--configure-vars={0}'.format(' '.join(config_vars)))
+
+ args.extend([
'--library={0}'.format(self.module.r_lib_dir),
- self.stage.source_path)
+ self.stage.source_path
+ ])
+
+ inspect.getmodule(self).R(*args)
# Check that self.prefix is there after installation
run_after('install')(PackageBase.sanity_check_prefix)
diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py
index 89ba050a53..648400e41e 100644
--- a/lib/spack/spack/cmd/create.py
+++ b/lib/spack/spack/cmd/create.py
@@ -265,7 +265,11 @@ class RPackageTemplate(PackageTemplate):
# depends_on('r-foo', type=('build', 'run'))"""
body = """\
- # FIXME: Override install() if necessary."""
+ def configure_args(self, spec, prefix):
+ # FIXME: Add arguments to pass to install via --configure-args
+ # FIXME: If not needed delete this function
+ args = []
+ return args"""
def __init__(self, name, *args):
# If the user provided `--name r-rcpp`, don't rename it r-r-rcpp