Preliminary RPackage class (#2761)

This commit is contained in:
Adam J. Stewart
2017-01-07 18:28:52 -06:00
committed by Todd Gamblin
parent f379697985
commit daff3c0908
173 changed files with 238 additions and 1213 deletions

View File

@@ -159,7 +159,9 @@
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']

View File

@@ -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)

View File

@@ -215,16 +215,11 @@ def __init__(self, name, *args):
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)