summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorJustin M Wozniak <woz@anl.gov>2019-07-03 13:24:21 -0500
committerPeter Scheibel <scheibel1@llnl.gov>2019-07-03 11:24:20 -0700
commit28949787e903813b652deab1fcfce42d718d3258 (patch)
tree1330a661af118a7f71d9e731fff399e3c4e0c275 /var
parentea1df6a9b45a653e29707bc1de6146402405dffa (diff)
downloadspack-28949787e903813b652deab1fcfce42d718d3258.tar.gz
spack-28949787e903813b652deab1fcfce42d718d3258.tar.bz2
spack-28949787e903813b652deab1fcfce42d718d3258.tar.xz
spack-28949787e903813b652deab1fcfce42d718d3258.zip
turbine: Better auto-detection of R location (#11711)
If R is provided by the system with a module (i.e. registered in packages.yaml with a "module" entry) and has no discernible prefix, this allows turbine to still make use of R.
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/turbine/package.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/var/spack/repos/builtin/packages/turbine/package.py b/var/spack/repos/builtin/packages/turbine/package.py
index 636f3cec48..07a575c126 100644
--- a/var/spack/repos/builtin/packages/turbine/package.py
+++ b/var/spack/repos/builtin/packages/turbine/package.py
@@ -6,6 +6,8 @@
from spack import *
+import os
+
class Turbine(AutotoolsPackage):
"""Turbine: The Swift/T runtime"""
@@ -71,6 +73,13 @@ class Turbine(AutotoolsPackage):
args.append('--with-python-exe={0}'.format(
self.spec['python'].command.path))
if '+r' in self.spec:
- args.append('--with-r={0}/rlib/R'.format(
- self.spec['r'].prefix))
+ r_location = '{0}/rlib/R'.format(self.spec['r'].prefix)
+ if not os.path.exists(r_location):
+ rscript = which('Rscript')
+ if rscript is not None:
+ r_location = rscript('-e', 'cat(R.home())', output=str)
+ else:
+ msg = 'Could not locate Rscript on your PATH!'
+ raise RuntimeError(msg)
+ args.append('--with-r={0}'.format(r_location))
return args