summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/spack/modules.yaml8
-rw-r--r--lib/spack/spack/concretize.py4
-rw-r--r--lib/spack/spack/config.py28
-rw-r--r--lib/spack/spack/modules.py9
-rw-r--r--lib/spack/spack/test/concretize.py9
-rw-r--r--var/spack/repos/builtin.mock/packages/python/package.py43
-rw-r--r--var/spack/repos/builtin/packages/cmake/package.py7
-rw-r--r--var/spack/repos/builtin/packages/cryptopp/package.py10
-rw-r--r--var/spack/repos/builtin/packages/openblas/package.py10
-rw-r--r--var/spack/repos/builtin/packages/p4est/package.py34
-rw-r--r--var/spack/repos/builtin/packages/parmetis/link-to-lm.patch14
-rw-r--r--var/spack/repos/builtin/packages/parmetis/package.py2
-rw-r--r--var/spack/repos/builtin/packages/petsc/package.py4
-rw-r--r--var/spack/repos/builtin/packages/python/package.py11
-rw-r--r--var/spack/repos/builtin/packages/ruby/package.py6
-rw-r--r--var/spack/repos/builtin/packages/silo/package.py23
-rw-r--r--var/spack/repos/builtin/packages/slepc/package.py49
17 files changed, 242 insertions, 29 deletions
diff --git a/etc/spack/modules.yaml b/etc/spack/modules.yaml
new file mode 100644
index 0000000000..aa2a2c3fe2
--- /dev/null
+++ b/etc/spack/modules.yaml
@@ -0,0 +1,8 @@
+# -------------------------------------------------------------------------
+# This is the default spack module files generation configuration.
+#
+# Changes to this file will affect all users of this spack install,
+# although users can override these settings in their ~/.spack/modules.yaml.
+# -------------------------------------------------------------------------
+modules:
+ enable: ['tcl', 'dotkit']
diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py
index 2e576743ec..ed9bf79868 100644
--- a/lib/spack/spack/concretize.py
+++ b/lib/spack/spack/concretize.py
@@ -159,6 +159,10 @@ class DefaultConcretizer(object):
if any(v.satisfies(sv) for sv in spec.versions)],
cmp=cmp_versions)
+ def prefer_key(v):
+ return pkg.versions.get(Version(v)).get('preferred', False)
+ valid_versions.sort(key=prefer_key, reverse=True)
+
if valid_versions:
spec.versions = ver([valid_versions[0]])
else:
diff --git a/lib/spack/spack/config.py b/lib/spack/spack/config.py
index 6afd69b3ac..14e5aaf4fb 100644
--- a/lib/spack/spack/config.py
+++ b/lib/spack/spack/config.py
@@ -237,7 +237,29 @@ section_schemas = {
'type' : 'object',
'default' : {},
}
- },},},},},}
+ },},},},},},
+ 'modules': {
+ '$schema': 'http://json-schema.org/schema#',
+ 'title': 'Spack module file configuration file schema',
+ 'type': 'object',
+ 'additionalProperties': False,
+ 'patternProperties': {
+ r'modules:?': {
+ 'type': 'object',
+ 'default': {},
+ 'additionalProperties': False,
+ 'properties': {
+ 'enable': {
+ 'type': 'array',
+ 'default': [],
+ 'items': {
+ 'type': 'string'
+ }
+ }
+ }
+ },
+ },
+ },
}
"""OrderedDict of config scopes keyed by name.
@@ -405,11 +427,11 @@ def _read_config_file(filename, schema):
validate_section(data, schema)
return data
- except MarkedYAMLError, e:
+ except MarkedYAMLError as e:
raise ConfigFileError(
"Error parsing yaml%s: %s" % (str(e.context_mark), e.problem))
- except IOError, e:
+ except IOError as e:
raise ConfigFileError(
"Error reading configuration file %s: %s" % (filename, str(e)))
diff --git a/lib/spack/spack/modules.py b/lib/spack/spack/modules.py
index 05c93cd3e6..6c32937c3c 100644
--- a/lib/spack/spack/modules.py
+++ b/lib/spack/spack/modules.py
@@ -48,6 +48,7 @@ import textwrap
import llnl.util.tty as tty
import spack
+import spack.config
from llnl.util.filesystem import join_path, mkdirp
from spack.environment import *
@@ -56,6 +57,8 @@ __all__ = ['EnvModule', 'Dotkit', 'TclModule']
# Registry of all types of modules. Entries created by EnvModule's metaclass
module_types = {}
+CONFIGURATION = spack.config.get_config('modules')
+
def print_help():
"""For use by commands to tell user how to activate shell support."""
@@ -115,7 +118,7 @@ class EnvModule(object):
class __metaclass__(type):
def __init__(cls, name, bases, dict):
type.__init__(cls, name, bases, dict)
- if cls.name != 'env_module':
+ if cls.name != 'env_module' and cls.name in CONFIGURATION['enable']:
module_types[cls.name] = cls
def __init__(self, spec=None):
@@ -160,8 +163,8 @@ class EnvModule(object):
# package-specific modifications
for extendee in self.pkg.extendees:
extendee_spec = self.spec[extendee]
- extendee_spec.package.modify_module(
- self.pkg.module, extendee_spec, self.spec)
+ extendee_spec.package.setup_dependent_package(
+ self.pkg.module, self.spec)
# Package-specific environment modifications
spack_env = EnvironmentModifications()
diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py
index 08cce09674..9cd8c969ae 100644
--- a/lib/spack/spack/test/concretize.py
+++ b/lib/spack/spack/test/concretize.py
@@ -24,6 +24,7 @@
##############################################################################
import spack
from spack.spec import Spec, CompilerSpec
+from spack.version import ver
from spack.concretize import find_spec
from spack.test.mock_packages_test import *
@@ -77,6 +78,14 @@ class ConcretizeTest(MockPackagesTest):
self.check_concretize('mpich')
+ def test_concretize_preferred_version(self):
+ spec = self.check_concretize('python')
+ self.assertEqual(spec.versions, ver('2.7.11'))
+
+ spec = self.check_concretize('python@3.5.1')
+ self.assertEqual(spec.versions, ver('3.5.1'))
+
+
def test_concretize_with_virtual(self):
self.check_concretize('mpileaks ^mpi')
self.check_concretize('mpileaks ^mpi@:1.1')
diff --git a/var/spack/repos/builtin.mock/packages/python/package.py b/var/spack/repos/builtin.mock/packages/python/package.py
new file mode 100644
index 0000000000..c5fed52f53
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/python/package.py
@@ -0,0 +1,43 @@
+##############################################################################
+# Copyright (c) 2013-2015, Lawrence Livermore National Security, LLC.
+# Produced at the Lawrence Livermore National Laboratory.
+#
+# This file is part of Spack.
+# Written 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 General Public License (as published by
+# the Free Software Foundation) version 2.1 dated 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 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
+##############################################################################
+from spack import *
+
+class Python(Package):
+ """Dummy Python package to demonstrate preferred versions."""
+ homepage = "http://www.python.org"
+ url = "http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz"
+
+ extendable = True
+
+ version('3.5.1', 'be78e48cdfc1a7ad90efff146dce6cfe')
+ version('3.5.0', 'a56c0c0b45d75a0ec9c6dee933c41c36')
+ version('2.7.11', '6b6076ec9e93f05dd63e47eb9c15728b', preferred=True)
+ version('2.7.10', 'd7547558fd673bd9d38e2108c6b42521')
+ version('2.7.9', '5eebcaa0030dc4061156d3429657fb83')
+ version('2.7.8', 'd4bca0159acb0b44a781292b5231936f')
+
+ def install(self, spec, prefix):
+ pass
+
diff --git a/var/spack/repos/builtin/packages/cmake/package.py b/var/spack/repos/builtin/packages/cmake/package.py
index cc93c7067c..1f93d39769 100644
--- a/var/spack/repos/builtin/packages/cmake/package.py
+++ b/var/spack/repos/builtin/packages/cmake/package.py
@@ -38,10 +38,12 @@ class Cmake(Package):
version('2.8.10.2', '097278785da7182ec0aea8769d06860c')
variant('ncurses', default=True, description='Enables the build of the ncurses gui')
+ variant('openssl', default=True, description="Enables CMake's OpenSSL features")
variant('qt', default=False, description='Enables the build of cmake-gui')
variant('doc', default=False, description='Enables the generation of html and man page documentation')
depends_on('ncurses', when='+ncurses')
+ depends_on('openssl', when='+openssl')
depends_on('qt', when='+qt')
depends_on('python@2.7.11:', when='+doc')
depends_on('py-sphinx', when='+doc')
@@ -77,8 +79,9 @@ class Cmake(Package):
options.append('--sphinx-html')
options.append('--sphinx-man')
- options.append('--')
- options.append('-DCMAKE_USE_OPENSSL=ON')
+ if '+openssl' in spec:
+ options.append('--')
+ options.append('-DCMAKE_USE_OPENSSL=ON')
configure(*options)
make()
diff --git a/var/spack/repos/builtin/packages/cryptopp/package.py b/var/spack/repos/builtin/packages/cryptopp/package.py
index 1693c4b160..bc83cb2b65 100644
--- a/var/spack/repos/builtin/packages/cryptopp/package.py
+++ b/var/spack/repos/builtin/packages/cryptopp/package.py
@@ -8,8 +8,8 @@ class Cryptopp(Package):
public-key encryption (RSA, DSA), and a few obsolete/historical encryption
algorithms (MD5, Panama)."""
- homepage = "http://www.cryptopp.com/"
- url = "http://www.cryptopp.com/cryptopp563.zip"
+ homepage = "http://www.cryptopp.com"
+ base_url = "http://www.cryptopp.com"
version('5.6.3', '3c5b70e2ec98b7a24988734446242d07')
version('5.6.2', '7ed022585698df48e65ce9218f6c6a67')
@@ -25,7 +25,5 @@ class Cryptopp(Package):
install('libcryptopp.a', prefix.lib)
def url_for_version(self, version):
- version_tuple = tuple(v for v in iter(version))
- version_string = reduce(lambda vs, nv: vs + str(nv), version_tuple, "")
-
- return "%scryptopp%s.zip" % (Cryptopp.homepage, version_string)
+ version_string = str(version).replace('.', '')
+ return '%s/cryptopp%s.zip' % (Cryptopp.base_url, version_string)
diff --git a/var/spack/repos/builtin/packages/openblas/package.py b/var/spack/repos/builtin/packages/openblas/package.py
index 781a1e2ec8..1d10f217c4 100644
--- a/var/spack/repos/builtin/packages/openblas/package.py
+++ b/var/spack/repos/builtin/packages/openblas/package.py
@@ -6,6 +6,7 @@ class Openblas(Package):
homepage = "http://www.openblas.net"
url = "http://github.com/xianyi/OpenBLAS/archive/v0.2.15.tar.gz"
+ version('0.2.17', '664a12807f2a2a7cda4781e3ab2ae0e1')
version('0.2.16', 'fef46ab92463bdbb1479dcec594ef6dc')
version('0.2.15', 'b1190f3d3471685f17cfd1ec1d252ac9')
@@ -14,7 +15,14 @@ class Openblas(Package):
provides('lapack')
def install(self, spec, prefix):
- make('libs', 'netlib', 'shared', 'CC=cc', 'FC=f77')
+ extra=[]
+ if spec.satisfies('@0.2.16'):
+ extra.extend([
+ 'BUILD_LAPACK_DEPRECATED=1' # fix missing _dggsvd_ and _sggsvd_
+ ])
+
+ make('libs', 'netlib', 'shared', 'CC=cc', 'FC=f77',*extra)
+ make("tests")
make('install', "PREFIX='%s'" % prefix)
lib_dsuffix = 'dylib' if sys.platform == 'darwin' else 'so'
diff --git a/var/spack/repos/builtin/packages/p4est/package.py b/var/spack/repos/builtin/packages/p4est/package.py
new file mode 100644
index 0000000000..1e2969fe64
--- /dev/null
+++ b/var/spack/repos/builtin/packages/p4est/package.py
@@ -0,0 +1,34 @@
+from spack import *
+
+class P4est(Package):
+ """Dynamic management of a collection (a forest) of adaptive octrees in parallel"""
+ homepage = "http://www.p4est.org"
+ url = "http://p4est.github.io/release/p4est-1.1.tar.gz"
+
+ version('1.1', '37ba7f4410958cfb38a2140339dbf64f')
+
+ # disable by default to make it work on frontend of clusters
+ variant('tests', default=False, description='Run small tests')
+
+ depends_on('mpi')
+
+ def install(self, spec, prefix):
+ options = ['--enable-mpi',
+ '--enable-shared',
+ '--disable-vtk-binary',
+ '--without-blas',
+ 'CPPFLAGS=-DSC_LOG_PRIORITY=SC_LP_ESSENTIAL',
+ 'CFLAGS=-O2',
+ 'CC=%s' % join_path(self.spec['mpi'].prefix.bin, 'mpicc'), # TODO: use ENV variables or MPI class wrappers
+ 'CXX=%s' % join_path(self.spec['mpi'].prefix.bin, 'mpic++'),
+ 'FC=%s' % join_path(self.spec['mpi'].prefix.bin, 'mpif90'),
+ 'F77=%s' % join_path(self.spec['mpi'].prefix.bin, 'mpif77'),
+ ]
+
+ configure('--prefix=%s' % prefix, *options)
+
+ make()
+ if '+tests' in self.spec:
+ make("check")
+
+ make("install")
diff --git a/var/spack/repos/builtin/packages/parmetis/link-to-lm.patch b/var/spack/repos/builtin/packages/parmetis/link-to-lm.patch
new file mode 100644
index 0000000000..faa809231e
--- /dev/null
+++ b/var/spack/repos/builtin/packages/parmetis/link-to-lm.patch
@@ -0,0 +1,14 @@
+diff --git a/libparmetis/CMakeLists.txt b/libparmetis/CMakeLists.txt
+index 9cfc8a7..dfc0125 100644
+--- a/libparmetis/CMakeLists.txt
++++ b/libparmetis/CMakeLists.txt
+@@ -5,7 +5,7 @@ file(GLOB parmetis_sources *.c)
+ # Create libparmetis
+ add_library(parmetis ${ParMETIS_LIBRARY_TYPE} ${parmetis_sources})
+ # Link with metis and MPI libraries.
+-target_link_libraries(parmetis metis ${MPI_LIBRARIES})
++target_link_libraries(parmetis metis ${MPI_LIBRARIES} "-lm")
+ set_target_properties(parmetis PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
+
+ install(TARGETS parmetis
+
diff --git a/var/spack/repos/builtin/packages/parmetis/package.py b/var/spack/repos/builtin/packages/parmetis/package.py
index c691cf4191..bc71fb7299 100644
--- a/var/spack/repos/builtin/packages/parmetis/package.py
+++ b/var/spack/repos/builtin/packages/parmetis/package.py
@@ -52,6 +52,8 @@ class Parmetis(Package):
# https://bitbucket.org/petsc/pkg-parmetis/commits/82409d68aa1d6cbc70740d0f35024aae17f7d5cb/raw/
patch('pkg-parmetis-82409d68aa1d6cbc70740d0f35024aae17f7d5cb.patch')
+ patch('link-to-lm.patch')
+
depends_on('gdb', when='+gdb')
def install(self, spec, prefix):
diff --git a/var/spack/repos/builtin/packages/petsc/package.py b/var/spack/repos/builtin/packages/petsc/package.py
index 7239baaf7f..3dd117eed1 100644
--- a/var/spack/repos/builtin/packages/petsc/package.py
+++ b/var/spack/repos/builtin/packages/petsc/package.py
@@ -100,3 +100,7 @@ class Petsc(Package):
# PETSc has its own way of doing parallel make.
make('MAKE_NP=%s' % make_jobs, parallel=False)
make("install")
+
+ def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
+ # set up PETSC_DIR for everyone using PETSc package
+ spack_env.set('PETSC_DIR', self.prefix)
diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py
index 4f55bc803e..6d9030805b 100644
--- a/var/spack/repos/builtin/packages/python/package.py
+++ b/var/spack/repos/builtin/packages/python/package.py
@@ -108,7 +108,7 @@ class Python(Package):
run_env.set('PYTHONPATH', pythonpath)
- def modify_module(self, module, spec, ext_spec):
+ def setup_dependent_package(self, module, ext_spec):
"""
Called before python modules' install() methods.
@@ -118,17 +118,18 @@ class Python(Package):
"""
# Python extension builds can have a global python executable function
if self.version >= Version("3.0.0") and self.version < Version("4.0.0"):
- module.python = Executable(join_path(spec.prefix.bin, 'python3'))
+ module.python = Executable(join_path(self.spec.prefix.bin, 'python3'))
else:
- module.python = Executable(join_path(spec.prefix.bin, 'python'))
+ module.python = Executable(join_path(self.spec.prefix.bin, 'python'))
# Add variables for lib/pythonX.Y and lib/pythonX.Y/site-packages dirs.
module.python_lib_dir = os.path.join(ext_spec.prefix, self.python_lib_dir)
module.python_include_dir = os.path.join(ext_spec.prefix, self.python_include_dir)
module.site_packages_dir = os.path.join(ext_spec.prefix, self.site_packages_dir)
- # Make the site packages directory if it does not exist already.
- mkdirp(module.site_packages_dir)
+ # Make the site packages directory for extensions, if it does not exist already.
+ if ext_spec.package.is_extension:
+ mkdirp(module.site_packages_dir)
# ========================================================================
# Handle specifics of activating and deactivating python modules.
diff --git a/var/spack/repos/builtin/packages/ruby/package.py b/var/spack/repos/builtin/packages/ruby/package.py
index 7ff1898ce9..e13677e4d2 100644
--- a/var/spack/repos/builtin/packages/ruby/package.py
+++ b/var/spack/repos/builtin/packages/ruby/package.py
@@ -30,7 +30,7 @@ class Ruby(Package):
# The actual installation path for this gem
spack_env.set('GEM_HOME', extension_spec.prefix)
- def modify_module(self, module, spec, ext_spec):
+ def setup_dependent_package(self, module, ext_spec):
"""Called before ruby modules' install() methods. Sets GEM_HOME
and GEM_PATH to values appropriate for the package being built.
@@ -39,5 +39,5 @@ class Ruby(Package):
gem('install', '<gem-name>.gem')
"""
# Ruby extension builds have global ruby and gem functions
- module.ruby = Executable(join_path(spec.prefix.bin, 'ruby'))
- module.gem = Executable(join_path(spec.prefix.bin, 'gem'))
+ module.ruby = Executable(join_path(self.spec.prefix.bin, 'ruby'))
+ module.gem = Executable(join_path(self.spec.prefix.bin, 'gem'))
diff --git a/var/spack/repos/builtin/packages/silo/package.py b/var/spack/repos/builtin/packages/silo/package.py
index d1aed78e0e..b7894e4d2b 100644
--- a/var/spack/repos/builtin/packages/silo/package.py
+++ b/var/spack/repos/builtin/packages/silo/package.py
@@ -5,24 +5,35 @@ class Silo(Package):
data to binary, disk files."""
homepage = "http://wci.llnl.gov/simulation/computer-codes/silo"
- url = "https://wci.llnl.gov/content/assets/docs/simulation/computer-codes/silo/silo-4.8/silo-4.8.tar.gz"
+ base_url = "https://wci.llnl.gov/content/assets/docs/simulation/computer-codes/silo"
+ version('4.10.2', '9ceac777a2f2469ac8cef40f4fab49c8')
+ version('4.9', 'a83eda4f06761a86726e918fc55e782a')
version('4.8', 'b1cbc0e7ec435eb656dc4b53a23663c9')
variant('fortran', default=True, description='Enable Fortran support')
+ variant('silex', default=False, description='Builds Silex, a GUI for viewing Silo files')
- depends_on("hdf5")
+ depends_on('hdf5')
+ depends_on('qt', when='+silex')
def install(self, spec, prefix):
config_args = [
'--enable-fortran' if '+fortran' in spec else '--disable-fortran',
+ '--enable-silex' if '+silex' in spec else '--disable-silex',
]
+ if '+silex' in spec:
+ config_args.append('--with-Qt-dir=%s' % spec['qt'].prefix)
+
configure(
- "--prefix=%s" % prefix,
- "--with-hdf5=%s,%s" % (spec['hdf5'].prefix.include, spec['hdf5'].prefix.lib),
- "--with-zlib=%s,%s" % (spec['zlib'].prefix.include, spec['zlib'].prefix.lib),
+ '--prefix=%s' % prefix,
+ '--with-hdf5=%s,%s' % (spec['hdf5'].prefix.include, spec['hdf5'].prefix.lib),
+ '--with-zlib=%s,%s' % (spec['zlib'].prefix.include, spec['zlib'].prefix.lib),
*config_args)
make()
- make("install")
+ make('install')
+
+ def url_for_version(self, version):
+ return '%s/silo-%s/silo-%s.tar.gz' % (Silo.base_url, version, version)
diff --git a/var/spack/repos/builtin/packages/slepc/package.py b/var/spack/repos/builtin/packages/slepc/package.py
new file mode 100644
index 0000000000..8b5f24394f
--- /dev/null
+++ b/var/spack/repos/builtin/packages/slepc/package.py
@@ -0,0 +1,49 @@
+import os
+from spack import *
+
+
+class Slepc(Package):
+ """
+ Scalable Library for Eigenvalue Computations.
+ """
+
+ homepage = "http://www.grycap.upv.es/slepc"
+ url = "http://slepc.upv.es/download/download.php?filename=slepc-3.6.2.tar.gz"
+
+ version('3.6.2', '2ab4311bed26ccf7771818665991b2ea3a9b15f97e29fd13911ab1293e8e65df')
+
+ variant('arpack', default=False, description='Enables Arpack wrappers')
+
+ depends_on('petsc')
+ depends_on('arpack-ng~mpi',when='+arpack^petsc~mpi')
+ depends_on('arpack-ng+mpi',when='+arpack^petsc+mpi')
+
+ def install(self, spec, prefix):
+ # set SLEPC_DIR for installation
+ os.environ['SLEPC_DIR'] = self.stage.source_path
+
+ options = []
+
+ if '+arpack' in spec:
+ options.extend([
+ '--with-arpack-dir=%s' % spec['arpack-ng'].prefix.lib,
+ ])
+ if 'arpack-ng~mpi' in spec:
+ options.extend([
+ '--with-arpack-flags=-larpack'
+ ])
+ else:
+ options.extend([
+ '--with-arpack-flags=-lparpack,-larpack'
+ ])
+
+ configure('--prefix=%s' % prefix, *options)
+
+ make('MAKE_NP=%s' % make_jobs, parallel=False)
+ #FIXME:
+ # make('test')
+ make('install')
+
+ def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
+ # set up SLEPC_DIR for everyone using SLEPc package
+ spack_env.set('SLEPC_DIR', self.prefix)