summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2017-01-07 18:28:52 -0600
committerTodd Gamblin <tgamblin@llnl.gov>2017-01-07 16:28:52 -0800
commitdaff3c0908717eedf6a3e192dc37b8aa23111042 (patch)
tree150e510c0176de96b809fcf91a708c130b5538f7 /lib
parentf379697985f0b09a3856e12fff3cf69972a31cc1 (diff)
downloadspack-daff3c0908717eedf6a3e192dc37b8aa23111042.tar.gz
spack-daff3c0908717eedf6a3e192dc37b8aa23111042.tar.bz2
spack-daff3c0908717eedf6a3e192dc37b8aa23111042.tar.xz
spack-daff3c0908717eedf6a3e192dc37b8aa23111042.zip
Preliminary RPackage class (#2761)
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)