From 28949787e903813b652deab1fcfce42d718d3258 Mon Sep 17 00:00:00 2001 From: Justin M Wozniak Date: Wed, 3 Jul 2019 13:24:21 -0500 Subject: 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. --- var/spack/repos/builtin/packages/turbine/package.py | 13 +++++++++++-- 1 file 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 -- cgit v1.2.3-60-g2f50