summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDenis Davydov <davydden@gmail.com>2018-01-03 03:03:27 +0100
committerAdam J. Stewart <ajstewart426@gmail.com>2018-01-02 20:03:27 -0600
commit4b5fe75bc38b9e4f45d077aabb6909daca31a70f (patch)
tree689c0156e352c690e138b6bc46b9805def134d03 /lib
parentfd6b9ac3af077bd35a66dfd5aaf0fe48375304ff (diff)
downloadspack-4b5fe75bc38b9e4f45d077aabb6909daca31a70f.tar.gz
spack-4b5fe75bc38b9e4f45d077aabb6909daca31a70f.tar.bz2
spack-4b5fe75bc38b9e4f45d077aabb6909daca31a70f.tar.xz
spack-4b5fe75bc38b9e4f45d077aabb6909daca31a70f.zip
add OctavePackage (#6746)
* add OctavePackage 1. remove import CudaPackage which is not needed anymore 2. mention CudaPackage and OctavePackage in packaging guide 3. adjust OctavePackageTemplate 4. add clue file for Octave build 5. sanity check on self.prefix * use setup_environment
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/docs/packaging_guide.rst7
-rw-r--r--lib/spack/spack/__init__.py4
-rw-r--r--lib/spack/spack/build_systems/octave.py71
-rw-r--r--lib/spack/spack/cmd/create.py12
4 files changed, 85 insertions, 9 deletions
diff --git a/lib/spack/docs/packaging_guide.rst b/lib/spack/docs/packaging_guide.rst
index 09bd2632b3..b46caa82e9 100644
--- a/lib/spack/docs/packaging_guide.rst
+++ b/lib/spack/docs/packaging_guide.rst
@@ -2240,6 +2240,10 @@ The classes that are currently provided by Spack are:
| :py:class:`.CMakePackage` | Specialized class for packages |
| | built using CMake |
+-------------------------------+----------------------------------+
+ | :py:class:`.CudaPackage` | A helper class for packages that |
+ | | use CUDA. It is intended to be |
+ | | used in combination with others |
+ +-------------------------------+----------------------------------+
| :py:class:`.QMakePackage` | Specialized class for packages |
| | build using QMake |
+-------------------------------+----------------------------------+
@@ -2252,6 +2256,9 @@ The classes that are currently provided by Spack are:
| :py:class:`.RPackage` | Specialized class for |
| | :py:class:`.R` extensions |
+-------------------------------+----------------------------------+
+ | :py:class:`.OctavePackage` | Specialized class for |
+ | | :py:class:`.Octave` packages |
+ +-------------------------------+----------------------------------+
| :py:class:`.PythonPackage` | Specialized class for |
| | :py:class:`.Python` extensions |
+-------------------------------+----------------------------------+
diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py
index 03eee6daf6..f52dc8c2a7 100644
--- a/lib/spack/spack/__init__.py
+++ b/lib/spack/spack/__init__.py
@@ -184,9 +184,11 @@ from spack.build_systems.makefile import MakefilePackage
from spack.build_systems.aspell_dict import AspellDictPackage
from spack.build_systems.autotools import AutotoolsPackage
from spack.build_systems.cmake import CMakePackage
+from spack.build_systems.cuda import CudaPackage
from spack.build_systems.qmake import QMakePackage
from spack.build_systems.scons import SConsPackage
from spack.build_systems.waf import WafPackage
+from spack.build_systems.octave import OctavePackage
from spack.build_systems.python import PythonPackage
from spack.build_systems.r import RPackage
from spack.build_systems.perl import PerlPackage
@@ -201,9 +203,11 @@ __all__ += [
'AspellDictPackage',
'AutotoolsPackage',
'CMakePackage',
+ 'CudaPackage',
'QMakePackage',
'SConsPackage',
'WafPackage',
+ 'OctavePackage',
'PythonPackage',
'RPackage',
'PerlPackage',
diff --git a/lib/spack/spack/build_systems/octave.py b/lib/spack/spack/build_systems/octave.py
new file mode 100644
index 0000000000..af4651d1e1
--- /dev/null
+++ b/lib/spack/spack/build_systems/octave.py
@@ -0,0 +1,71 @@
+##############################################################################
+# Copyright (c) 2013-2017, 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/spack/spack
+# Please also see the NOTICE and LICENSE files 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 depends_on, extends
+from spack.package import PackageBase, run_after
+
+
+class OctavePackage(PackageBase):
+ """Specialized class for Octave packages. See
+ https://www.gnu.org/software/octave/doc/v4.2.0/Installing-and-Removing-Packages.html
+ for more information.
+
+ This class provides the following phases that can be overridden:
+
+ 1. :py:meth:`~.OctavePackage.install`
+
+ """
+ # Default phases
+ phases = ['install']
+
+ # To be used in UI queries that require to know which
+ # build-system class we are using
+ build_system_class = 'OctavePackage'
+
+ extends('octave')
+ depends_on('octave', type=('build', 'run'))
+
+ def setup_environment(self, spack_env, run_env):
+ """Set up the compile and runtime environments for a package."""
+ # octave does not like those environment variables to be set:
+ spack_env.unset('CC')
+ spack_env.unset('CXX')
+ spack_env.unset('FC')
+
+ def install(self, spec, prefix):
+ """Install the package from the archive file"""
+ inspect.getmodule(self).octave(
+ '--quiet',
+ '--norc',
+ '--built-in-docstrings-file=/dev/null',
+ '--texi-macros-file=/dev/null',
+ '--eval', 'pkg prefix %s; pkg install %s' %
+ (prefix, self.stage.archive_file))
+
+ # Testing
+
+ # Check that self.prefix is there after installation
+ run_after('install')(PackageBase.sanity_check_prefix)
diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py
index 2e67b7648b..897355e807 100644
--- a/lib/spack/spack/cmd/create.py
+++ b/lib/spack/spack/cmd/create.py
@@ -332,21 +332,14 @@ class PerlbuildPackageTemplate(PerlmakePackageTemplate):
class OctavePackageTemplate(PackageTemplate):
"""Provides appropriate overrides for octave packages"""
+ base_class_name = 'OctavePackage'
+
dependencies = """\
extends('octave')
# FIXME: Add additional dependencies if required.
# depends_on('octave-foo', type=('build', 'run'))"""
- body = """\
- def install(self, spec, prefix):
- # FIXME: Add logic to build and install here.
- octave('--quiet', '--norc',
- '--built-in-docstrings-file=/dev/null',
- '--texi-macros-file=/dev/null',
- '--eval', 'pkg prefix {0}; pkg install {1}'.format(
- prefix, self.stage.archive_file))"""
-
def __init__(self, name, *args):
# If the user provided `--name octave-splines`, don't rename it
# octave-octave-splines
@@ -464,6 +457,7 @@ class BuildSystemGuesser:
(r'/Makefile\.PL$', 'perlmake'),
(r'/.*\.pro$', 'qmake'),
(r'/(GNU)?[Mm]akefile$', 'makefile'),
+ (r'/DESCRIPTION$', 'octave'),
]
# Peek inside the compressed file.