summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorbecker33 <becker33@llnl.gov>2016-08-01 13:51:13 -0700
committerGitHub <noreply@github.com>2016-08-01 13:51:13 -0700
commitb892cebe8ae1b65e45a14c8b4ffb33357237fbb8 (patch)
tree02f36d5aaaae5d0b2919ee2d3414a1617d3eb1c6 /var
parent49e47966a86c88d6b066e37e2382eb436dd5c6b6 (diff)
parent8dc26bbcd957a7a00c4a370c434136e59b52aa87 (diff)
downloadspack-b892cebe8ae1b65e45a14c8b4ffb33357237fbb8.tar.gz
spack-b892cebe8ae1b65e45a14c8b4ffb33357237fbb8.tar.bz2
spack-b892cebe8ae1b65e45a14c8b4ffb33357237fbb8.tar.xz
spack-b892cebe8ae1b65e45a14c8b4ffb33357237fbb8.zip
Merge pull request #1343 from glennpj/r_unfilter
R extension dependencies with compiler wrapper
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/R/package.py44
1 files changed, 29 insertions, 15 deletions
diff --git a/var/spack/repos/builtin/packages/R/package.py b/var/spack/repos/builtin/packages/R/package.py
index ad06c2ca48..e880a3aa66 100644
--- a/var/spack/repos/builtin/packages/R/package.py
+++ b/var/spack/repos/builtin/packages/R/package.py
@@ -22,10 +22,9 @@
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
-import os
-
from spack import *
from spack.util.environment import *
+import shutil
class R(Package):
@@ -74,6 +73,10 @@ class R(Package):
depends_on('pcre')
depends_on('jdk')
+ @property
+ def etcdir(self):
+ return join_path(prefix, 'rlib', 'R', 'etc')
+
def install(self, spec, prefix):
rlibdir = join_path(prefix, 'rlib')
configure_args = ['--prefix=%s' % prefix,
@@ -88,6 +91,12 @@ class R(Package):
make()
make('install')
+ # Make a copy of Makeconf because it will be needed to properly build R
+ # dependencies in Spack.
+ src_makeconf = join_path(self.etcdir, 'Makeconf')
+ dst_makeconf = join_path(self.etcdir, 'Makeconf.spack')
+ shutil.copy(src_makeconf, dst_makeconf)
+
self.filter_compilers(spec, prefix)
def filter_compilers(self, spec, prefix):
@@ -98,18 +107,16 @@ class R(Package):
cc and c++. We want them to be bound to whatever compiler
they were built with."""
- etcdir = join_path(prefix, 'rlib', 'R', 'etc')
-
kwargs = {'ignore_absent': True, 'backup': False, 'string': True}
- filter_file(env['CC'], self.compiler.cc,
- join_path(etcdir, 'Makeconf'), **kwargs)
+ filter_file(env['CC'], self.compiler.cc,
+ join_path(self.etcdir, 'Makeconf'), **kwargs)
filter_file(env['CXX'], self.compiler.cxx,
- join_path(etcdir, 'Makeconf'), **kwargs)
+ join_path(self.etcdir, 'Makeconf'), **kwargs)
filter_file(env['F77'], self.compiler.f77,
- join_path(etcdir, 'Makeconf'), **kwargs)
+ join_path(self.etcdir, 'Makeconf'), **kwargs)
filter_file(env['FC'], self.compiler.fc,
- join_path(etcdir, 'Makeconf'), **kwargs)
+ join_path(self.etcdir, 'Makeconf'), **kwargs)
# ========================================================================
# Set up environment to make install easy for R extensions.
@@ -117,7 +124,7 @@ class R(Package):
@property
def r_lib_dir(self):
- return os.path.join('rlib', 'R', 'library')
+ return join_path('rlib', 'R', 'library')
def setup_dependent_environment(self, spack_env, run_env, extension_spec):
# Set R_LIBS to include the library dir for the
@@ -125,15 +132,21 @@ class R(Package):
r_libs_path = []
for d in extension_spec.traverse(deptype=nolink, deptype_query='run'):
if d.package.extends(self.spec):
- r_libs_path.append(os.path.join(d.prefix, self.r_lib_dir))
+ r_libs_path.append(join_path(d.prefix, self.r_lib_dir))
r_libs_path = ':'.join(r_libs_path)
spack_env.set('R_LIBS', r_libs_path)
+ spack_env.set('R_MAKEVARS_SITE',
+ join_path(self.etcdir, 'Makeconf.spack'))
+
+ # Use the number of make_jobs set in spack. The make program will
+ # determine how many jobs can actually be started.
+ spack_env.set('MAKEFLAGS', '-j{0}'.format(make_jobs))
# For run time environment set only the path for extension_spec and
# prepend it to R_LIBS
if extension_spec.package.extends(self.spec):
- run_env.prepend_path('R_LIBS', os.path.join(
+ run_env.prepend_path('R_LIBS', join_path(
extension_spec.prefix, self.r_lib_dir))
def setup_environment(self, spack_env, run_env):
@@ -147,13 +160,14 @@ class R(Package):
def setup_dependent_package(self, module, ext_spec):
"""Called before R modules' install() methods. In most cases,
extensions will only need to have one line:
- R('CMD', 'INSTALL', '--library=%s' % self.module.r_lib_dir, '%s' %
- self.stage.source_path)"""
+ R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+ self.stage.source_path)"""
+
# R extension builds can have a global R executable function
module.R = Executable(join_path(self.spec.prefix.bin, 'R'))
# Add variable for library directry
- module.r_lib_dir = os.path.join(ext_spec.prefix, self.r_lib_dir)
+ module.r_lib_dir = join_path(ext_spec.prefix, self.r_lib_dir)
# Make the site packages directory for extensions, if it does not exist
# already.