summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/__init__.py4
-rw-r--r--lib/spack/spack/build_systems/r.py57
-rw-r--r--lib/spack/spack/cmd/create.py9
3 files changed, 62 insertions, 8 deletions
diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py
index 771fc7b32a..1e38376f5e 100644
--- a/lib/spack/spack/__init__.py
+++ b/lib/spack/spack/__init__.py
@@ -159,7 +159,9 @@ from spack.package import Package
from spack.build_systems.makefile import MakefilePackage
from spack.build_systems.autotools import AutotoolsPackage
from spack.build_systems.cmake import CMakePackage
-__all__ += ['Package', 'CMakePackage', 'AutotoolsPackage', 'MakefilePackage']
+from spack.build_systems.r import RPackage
+__all__ += ['Package', 'CMakePackage', 'AutotoolsPackage', 'MakefilePackage',
+ 'RPackage']
from spack.version import Version, ver
__all__ += ['Version', 'ver']
diff --git a/lib/spack/spack/build_systems/r.py b/lib/spack/spack/build_systems/r.py
new file mode 100644
index 0000000000..52b3d82c60
--- /dev/null
+++ b/lib/spack/spack/build_systems/r.py
@@ -0,0 +1,57 @@
+##############################################################################
+# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
+# Produced at the Lawrence Livermore National Laboratory.
+#
+# This file is part of Spack.
+# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
+# LLNL-CODE-647188
+#
+# For details, see https://github.com/llnl/spack
+# Please also see the LICENSE file for our notice and the LGPL.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License (as
+# published by the Free Software Foundation) version 2.1, February 1999.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
+# conditions of the GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# 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 inspect
+
+from spack.directives import extends
+from spack.package import PackageBase
+
+
+class RPackage(PackageBase):
+ """Specialized class for packages that are built using R
+
+ This class provides a single phase that can be overridden:
+ * install
+
+ It has sensible defaults and for many packages the only thing
+ necessary will be to add dependencies
+ """
+ phases = ['install']
+
+ # To be used in UI queries that require to know which
+ # build-system class we are using
+ build_system_class = 'RPackage'
+
+ extends('r')
+
+ def install(self, spec, prefix):
+ """Install the R package"""
+ inspect.getmodule(self).R(
+ 'CMD', 'INSTALL',
+ '--library={0}'.format(self.module.r_lib_dir),
+ self.stage.source_path)
+
+ # Check that self.prefix is there after installation
+ PackageBase.sanity_check('install')(PackageBase.sanity_check_prefix)
diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py
index f1a5bc5cdb..2607daaeb5 100644
--- a/lib/spack/spack/cmd/create.py
+++ b/lib/spack/spack/cmd/create.py
@@ -215,16 +215,11 @@ class PythonGuess(DefaultGuess):
class RGuess(DefaultGuess):
"""Provides appropriate overrides for R extensions"""
dependencies = """\
- extends('r')
-
- # FIXME: Add additional dependencies if required.
+ # FIXME: Add dependencies if required.
# depends_on('r-foo', type=nolink)"""
body = """\
- def install(self, spec, prefix):
- # FIXME: Add logic to build and install here.
- R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
- self.stage.source_path)"""
+ # FIXME: Override install() if necessary."""
def __init__(self, name, *args):
name = 'r-{0}'.format(name)