Skip to content
Snippets Groups Projects
Commit 28949787 authored by Justin M Wozniak's avatar Justin M Wozniak Committed by Peter Scheibel
Browse files

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.
parent ea1df6a9
Branches
Tags
No related merge requests found
......@@ -6,6 +6,8 @@
from spack import *
import os
class Turbine(AutotoolsPackage):
"""Turbine: The Swift/T runtime"""
......@@ -71,6 +73,13 @@ def configure_args(self):
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment