Merge branch 'develop' of https://github.com/LLNL/spack into features/env_objects_flying_around
Conflicts: lib/spack/spack/package.py var/spack/repos/builtin/packages/netlib-scalapack/package.py
This commit is contained in:
commit
fbeffee91e
9 changed files with 71 additions and 14 deletions
|
@ -1844,6 +1844,20 @@ dedicated process.
|
|||
|
||||
.. _prefix-objects:
|
||||
|
||||
|
||||
Failing the build
|
||||
----------------------
|
||||
|
||||
Sometimes you don't want a package to successfully install unless some
|
||||
condition is true. You can explicitly cause the build to fail from
|
||||
``install()`` by raising an ``InstallError``, for example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
if spec.architecture.startswith('darwin'):
|
||||
raise InstallError('This package does not build on Mac OS X!')
|
||||
|
||||
|
||||
Prefix objects
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -188,3 +188,10 @@
|
|||
import spack.util.executable
|
||||
from spack.util.executable import *
|
||||
__all__ += spack.util.executable.__all__
|
||||
|
||||
from spack.package import \
|
||||
install_dependency_symlinks, flatten_dependencies, DependencyConflictError, \
|
||||
InstallError, ExternalPackageError
|
||||
__all__ += [
|
||||
'install_dependency_symlinks', 'flatten_dependencies', 'DependencyConflictError',
|
||||
'InstallError', 'ExternalPackageError']
|
||||
|
|
|
@ -40,7 +40,8 @@ class Gcc(Compiler):
|
|||
fc_names = ['gfortran']
|
||||
|
||||
# MacPorts builds gcc versions with prefixes and -mp-X.Y suffixes.
|
||||
suffixes = [r'-mp-\d\.\d']
|
||||
# Homebrew and Linuxes may build gcc with -X, -X.Y suffixes
|
||||
suffixes = [r'-mp-\d\.\d', r'-\d\.\d', r'-\d']
|
||||
|
||||
# Named wrapper links within spack.build_env_path
|
||||
link_paths = {'cc' : 'gcc/gcc',
|
||||
|
|
|
@ -1261,6 +1261,28 @@ def rpath_args(self):
|
|||
"""Get the rpath args as a string, with -Wl,-rpath, for each element."""
|
||||
return " ".join("-Wl,-rpath,%s" % p for p in self.rpath)
|
||||
|
||||
|
||||
def install_dependency_symlinks(pkg, spec, prefix):
|
||||
"""Execute a dummy install and flatten dependencies"""
|
||||
flatten_dependencies(spec, prefix)
|
||||
|
||||
def flatten_dependencies(spec, flat_dir):
|
||||
"""Make each dependency of spec present in dir via symlink."""
|
||||
for dep in spec.traverse(root=False):
|
||||
name = dep.name
|
||||
|
||||
dep_path = spack.install_layout.path_for_spec(dep)
|
||||
dep_files = LinkTree(dep_path)
|
||||
|
||||
os.mkdir(flat_dir+'/'+name)
|
||||
|
||||
conflict = dep_files.find_conflict(flat_dir+'/'+name)
|
||||
if conflict:
|
||||
raise DependencyConflictError(conflict)
|
||||
|
||||
dep_files.merge(flat_dir+'/'+name)
|
||||
|
||||
|
||||
def validate_package_url(url_string):
|
||||
"""Determine whether spack can handle a particular URL or not."""
|
||||
url = urlparse(url_string)
|
||||
|
@ -1348,6 +1370,10 @@ def __init__(self, message, long_msg=None):
|
|||
super(InstallError, self).__init__(message, long_msg)
|
||||
|
||||
|
||||
class ExternalPackageError(InstallError):
|
||||
"""Raised by install() when a package is only for external use."""
|
||||
|
||||
|
||||
class PackageStillNeededError(InstallError):
|
||||
"""Raised when package is still needed by another on uninstall."""
|
||||
def __init__(self, spec, dependents):
|
||||
|
@ -1398,3 +1424,11 @@ def __init__(self, path):
|
|||
class ActivationError(ExtensionError):
|
||||
def __init__(self, msg, long_msg=None):
|
||||
super(ActivationError, self).__init__(msg, long_msg)
|
||||
|
||||
|
||||
class DependencyConflictError(spack.error.SpackError):
|
||||
"""Raised when the dependencies cannot be flattened as asked for."""
|
||||
def __init__(self, conflict):
|
||||
super(DependencyConflictError, self).__init__(
|
||||
"%s conflicts with another file in the flattened directory." %(
|
||||
conflict))
|
||||
|
|
|
@ -142,7 +142,7 @@ def split_url_extension(path):
|
|||
|
||||
def downloaded_file_extension(path):
|
||||
"""This returns the type of archive a URL refers to. This is
|
||||
sometimes confusing becasue of URLs like:
|
||||
sometimes confusing because of URLs like:
|
||||
|
||||
(1) https://github.com/petdance/ack/tarball/1.93_02
|
||||
|
||||
|
|
|
@ -27,13 +27,12 @@
|
|||
from itertools import product
|
||||
from spack.util.executable import which
|
||||
|
||||
# Supported archvie extensions.
|
||||
# Supported archive extensions.
|
||||
PRE_EXTS = ["tar"]
|
||||
EXTS = ["gz", "bz2", "xz", "Z", "zip", "tgz"]
|
||||
|
||||
# Add EXTS last so that .tar.gz is matched *before* tar.gz
|
||||
ALLOWED_ARCHIVE_TYPES = [".".join(l) for l in product(PRE_EXTS, EXTS)] + EXTS
|
||||
|
||||
# Add PRE_EXTS and EXTS last so that .tar.gz is matched *before* .tar or .gz
|
||||
ALLOWED_ARCHIVE_TYPES = [".".join(l) for l in product(PRE_EXTS, EXTS)] + PRE_EXTS + EXTS
|
||||
|
||||
def allowed_archive(path):
|
||||
return any(path.endswith(t) for t in ALLOWED_ARCHIVE_TYPES)
|
||||
|
|
|
@ -141,7 +141,7 @@ function _spack_pathadd {
|
|||
fi
|
||||
|
||||
# Do the actual prepending here.
|
||||
eval "_pa_oldvalue=\$${_pa_varname}"
|
||||
eval "_pa_oldvalue=\${${_pa_varname}:-}"
|
||||
|
||||
if [ -d "$_pa_new_path" ] && [[ ":$_pa_oldvalue:" != *":$_pa_new_path:"* ]]; then
|
||||
if [ -n "$_pa_oldvalue" ]; then
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class NetlibScalapack(Package):
|
||||
"""ScaLAPACK is a library of high-performance linear algebra routines for parallel distributed memory machines"""
|
||||
|
||||
|
||||
homepage = "http://www.netlib.org/scalapack/"
|
||||
url = "http://www.netlib.org/scalapack/scalapack-2.0.2.tgz"
|
||||
|
||||
|
@ -32,17 +32,17 @@ def install(self, spec, prefix):
|
|||
"-DCMAKE_C_FLAGS=-fPIC",
|
||||
"-DCMAKE_Fortran_FLAGS=-fPIC"
|
||||
])
|
||||
|
||||
|
||||
options.extend(std_cmake_args)
|
||||
|
||||
|
||||
with working_dir('spack-build', create=True):
|
||||
cmake('..', *options)
|
||||
make()
|
||||
make("install")
|
||||
|
||||
def modify_module(self, module, spec, dependent_spec):
|
||||
# TODO treat OS that are not Linux...
|
||||
lib_suffix = '.so' if '+shared' in spec['scalapack'] else '.a'
|
||||
lib_dsuffix = '.dylib' if sys.platform == 'darwin' else '.so'
|
||||
lib_suffix = lib_dsuffix if '+shared' in spec['scalapack'] else '.a'
|
||||
|
||||
spec['scalapack'].fc_link = '-L%s -lscalapack' % spec['scalapack'].prefix.lib
|
||||
spec['scalapack'].cc_link = spec['scalapack'].fc_link
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from spack import *
|
||||
import sys
|
||||
|
||||
class Openblas(Package):
|
||||
"""OpenBLAS: An optimized BLAS library"""
|
||||
|
@ -16,13 +17,14 @@ def install(self, spec, prefix):
|
|||
make('libs', 'netlib', 'shared', 'CC=cc', 'FC=f77')
|
||||
make('install', "PREFIX='%s'" % prefix)
|
||||
|
||||
lib_dsuffix = 'dylib' if sys.platform == 'darwin' else 'so'
|
||||
# Blas virtual package should provide blas.a and libblas.a
|
||||
with working_dir(prefix.lib):
|
||||
symlink('libopenblas.a', 'blas.a')
|
||||
symlink('libopenblas.a', 'libblas.a')
|
||||
symlink('libopenblas.so', 'libblas.so')
|
||||
symlink('libopenblas.%s' % lib_dsuffix, 'libblas.%s' % lib_dsuffix)
|
||||
|
||||
# Lapack virtual package should provide liblapack.a
|
||||
with working_dir(prefix.lib):
|
||||
symlink('libopenblas.a', 'liblapack.a')
|
||||
symlink('libopenblas.so', 'liblapack.so')
|
||||
symlink('libopenblas.%s' % lib_dsuffix, 'liblapack.%s' % lib_dsuffix)
|
||||
|
|
Loading…
Reference in a new issue