This commit is contained in:
Adam J. Stewart 2016-05-26 16:19:23 -05:00
parent 2220784eda
commit a21e845ce7
4 changed files with 24 additions and 19 deletions

View File

@ -63,7 +63,7 @@
import spack import spack
from spack.environment import EnvironmentModifications, validate from spack.environment import EnvironmentModifications, validate
from spack.util.environment import * from spack.util.environment import *
from spack.util.executable import Executable, which from spack.util.executable import Executable
# #
# This can be set by the user to globally disable parallel builds. # This can be set by the user to globally disable parallel builds.
@ -88,7 +88,6 @@
dso_suffix = 'dylib' if sys.platform == 'darwin' else 'so' dso_suffix = 'dylib' if sys.platform == 'darwin' else 'so'
class MakeExecutable(Executable): class MakeExecutable(Executable):
"""Special callable executable object for make so the user can """Special callable executable object for make so the user can
specify parallel or not on a per-invocation basis. Using specify parallel or not on a per-invocation basis. Using
@ -177,11 +176,13 @@ def set_compiler_environment_variables(pkg, env):
flags = pkg.spec.compiler_flags flags = pkg.spec.compiler_flags
# Set compiler variables used by CMake and autotools # Set compiler variables used by CMake and autotools
assert all(key in compiler.link_paths for key in ('cc', 'cxx', 'f77', 'fc')) assert all(key in compiler.link_paths for key in (
'cc', 'cxx', 'f77', 'fc'))
# Populate an object with the list of environment modifications # Populate an object with the list of environment modifications
# and return it # and return it
# TODO : add additional kwargs for better diagnostics, like requestor, ttyout, ttyerr, etc. # TODO : add additional kwargs for better diagnostics, like requestor,
# ttyout, ttyerr, etc.
link_dir = spack.build_env_path link_dir = spack.build_env_path
env.set('CC', join_path(link_dir, compiler.link_paths['cc'])) env.set('CC', join_path(link_dir, compiler.link_paths['cc']))
env.set('CXX', join_path(link_dir, compiler.link_paths['cxx'])) env.set('CXX', join_path(link_dir, compiler.link_paths['cxx']))
@ -233,7 +234,8 @@ def set_build_environment_variables(pkg, env):
# handled by putting one in the <build_env_path>/case-insensitive # handled by putting one in the <build_env_path>/case-insensitive
# directory. Add that to the path too. # directory. Add that to the path too.
env_paths = [] env_paths = []
for item in [spack.build_env_path, join_path(spack.build_env_path, pkg.compiler.name)]: for item in [spack.build_env_path, join_path(spack.build_env_path,
pkg.compiler.name)]:
env_paths.append(item) env_paths.append(item)
ci = join_path(item, 'case-insensitive') ci = join_path(item, 'case-insensitive')
if os.path.isdir(ci): if os.path.isdir(ci):
@ -246,7 +248,8 @@ def set_build_environment_variables(pkg, env):
# Prefixes of all of the package's dependencies go in SPACK_DEPENDENCIES # Prefixes of all of the package's dependencies go in SPACK_DEPENDENCIES
dep_prefixes = [d.prefix for d in pkg.spec.traverse(root=False)] dep_prefixes = [d.prefix for d in pkg.spec.traverse(root=False)]
env.set_path(SPACK_DEPENDENCIES, dep_prefixes) env.set_path(SPACK_DEPENDENCIES, dep_prefixes)
env.set_path('CMAKE_PREFIX_PATH', dep_prefixes) # Add dependencies to CMAKE_PREFIX_PATH # Add dependencies to CMAKE_PREFIX_PATH
env.set_path('CMAKE_PREFIX_PATH', dep_prefixes)
# Install prefix # Install prefix
env.set(SPACK_PREFIX, pkg.prefix) env.set(SPACK_PREFIX, pkg.prefix)
@ -262,7 +265,8 @@ def set_build_environment_variables(pkg, env):
env.unset('DYLD_LIBRARY_PATH') env.unset('DYLD_LIBRARY_PATH')
# Add bin directories from dependencies to the PATH for the build. # Add bin directories from dependencies to the PATH for the build.
bin_dirs = reversed(filter(os.path.isdir, ['%s/bin' % prefix for prefix in dep_prefixes])) bin_dirs = reversed(filter(os.path.isdir,
['%s/bin' % prefix for prefix in dep_prefixes]))
for item in bin_dirs: for item in bin_dirs:
env.prepend_path('PATH', item) env.prepend_path('PATH', item)
@ -326,7 +330,8 @@ def set_module_variables_for_package(pkg, module):
# Set up CMake rpath # Set up CMake rpath
m.std_cmake_args.append('-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=FALSE') m.std_cmake_args.append('-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=FALSE')
m.std_cmake_args.append('-DCMAKE_INSTALL_RPATH=%s' % ":".join(get_rpaths(pkg))) m.std_cmake_args.append('-DCMAKE_INSTALL_RPATH=%s' % \
":".join(get_rpaths(pkg)))
# Put spack compiler paths in module scope. # Put spack compiler paths in module scope.
link_dir = spack.build_env_path link_dir = spack.build_env_path
@ -373,13 +378,13 @@ def get_rpaths(pkg):
def parent_class_modules(cls): def parent_class_modules(cls):
"""Get list of super class modules that are all descend from spack.Package""" """Get list of super class modules that all descend from spack.Package"""
if not issubclass(cls, spack.Package) or issubclass(spack.Package, cls): if not issubclass(cls, spack.Package) or issubclass(spack.Package, cls):
return [] return []
result = [] result = []
module = sys.modules.get(cls.__module__) module = sys.modules.get(cls.__module__)
if module: if module:
result = [ module ] result = [module]
for c in cls.__bases__: for c in cls.__bases__:
result.extend(parent_class_modules(c)) result.extend(parent_class_modules(c))
return result return result
@ -411,7 +416,8 @@ def setup_package(pkg):
# throwaway environment, but it is kind of dirty. # throwaway environment, but it is kind of dirty.
# #
# TODO: Think about how to avoid this fix and do something cleaner. # TODO: Think about how to avoid this fix and do something cleaner.
for s in pkg.spec.traverse(): s.package.spec = s for s in pkg.spec.traverse():
s.package.spec = s
set_compiler_environment_variables(pkg, spack_env) set_compiler_environment_variables(pkg, spack_env)
set_build_environment_variables(pkg, spack_env) set_build_environment_variables(pkg, spack_env)
@ -499,7 +505,7 @@ def child_fun():
# message. Just make the parent exit with an error code. # message. Just make the parent exit with an error code.
pid, returncode = os.waitpid(pid, 0) pid, returncode = os.waitpid(pid, 0)
if returncode != 0: if returncode != 0:
raise InstallError("Installation process had nonzero exit code.".format(str(returncode))) raise InstallError("Installation process had nonzero exit code.")
class InstallError(spack.error.SpackError): class InstallError(spack.error.SpackError):

View File

@ -23,7 +23,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
############################################################################## ##############################################################################
from spack import * from spack import *
import spack
import os import os
@ -58,13 +57,13 @@ class Cantera(Package):
depends_on('py-cython', when='+python') depends_on('py-cython', when='+python')
depends_on('py-3to2', when='+python') depends_on('py-3to2', when='+python')
# TODO: these "when" specs don't actually work # TODO: these "when" specs don't actually work
#depends_on('py-unittest2', when='+python^python@2.6') # depends_on('py-unittest2', when='+python^python@2.6')
#depends_on('py-unittest2py3k', when='+python^python@3.1') # depends_on('py-unittest2py3k', when='+python^python@3.1')
# Matlab toolbox dependencies # Matlab toolbox dependencies
# TODO: add Matlab package # TODO: add Matlab package
# TODO: allow packages to extend multiple other packages # TODO: allow packages to extend multiple other packages
#extends('matlab', when='+matlab') # extends('matlab', when='+matlab')
def install(self, spec, prefix): def install(self, spec, prefix):
# Required options # Required options
@ -143,7 +142,7 @@ def install(self, spec, prefix):
if '+python' in spec: if '+python' in spec:
# Tests will always fail if Python dependencies aren't built # Tests will always fail if Python dependencies aren't built
#scons('test') # TODO: 3 expected failures, not sure what's wrong # scons('test') # TODO: 3 expected failures, not sure what's wrong
pass pass
scons('install') scons('install')

View File

@ -28,10 +28,11 @@
class Serf(Package): class Serf(Package):
"""Apache Serf - a high performance C-based HTTP client library """Apache Serf - a high performance C-based HTTP client library
built upon the Apache Portable Runtime (APR) library""" built upon the Apache Portable Runtime (APR) library"""
homepage = 'https://serf.apache.org/' homepage = 'https://serf.apache.org/'
url = 'https://archive.apache.org/dist/serf/serf-1.3.8.tar.bz2' url = 'https://archive.apache.org/dist/serf/serf-1.3.8.tar.bz2'
version('1.3.8', '1d45425ca324336ce2f4ae7d7b4cfbc5567c5446') version('1.3.8', '1d45425ca324336ce2f4ae7d7b4cfbc5567c5446')
depends_on('apr') depends_on('apr')
depends_on('apr-util') depends_on('apr-util')

View File

@ -23,7 +23,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
############################################################################## ##############################################################################
from spack import * from spack import *
import spack
import glob import glob
import os import os