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.
This commit is contained in:
parent
ea1df6a9b4
commit
28949787e9
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user