summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/docs/packaging_guide.rst31
-rwxr-xr-xlib/spack/env/cc39
-rw-r--r--lib/spack/spack/build_environment.py18
-rw-r--r--lib/spack/spack/cmd/compiler.py13
-rw-r--r--lib/spack/spack/cmd/create.py8
-rw-r--r--lib/spack/spack/compiler.py55
-rw-r--r--lib/spack/spack/compilers/clang.py25
-rw-r--r--lib/spack/spack/compilers/gcc.py4
-rw-r--r--lib/spack/spack/compilers/intel.py11
-rw-r--r--lib/spack/spack/compilers/nag.py22
-rw-r--r--lib/spack/spack/compilers/pgi.py11
-rw-r--r--lib/spack/spack/compilers/xl.py6
-rw-r--r--lib/spack/spack/config.py10
-rw-r--r--lib/spack/spack/test/cc.py5
-rw-r--r--lib/spack/spack/test/config.py33
-rw-r--r--lib/spack/spack/url.py3
-rw-r--r--lib/spack/spack/util/executable.py2
17 files changed, 241 insertions, 55 deletions
diff --git a/lib/spack/docs/packaging_guide.rst b/lib/spack/docs/packaging_guide.rst
index 34d11308f5..1b7941ab24 100644
--- a/lib/spack/docs/packaging_guide.rst
+++ b/lib/spack/docs/packaging_guide.rst
@@ -1803,15 +1803,15 @@ Compile-time library search paths
* ``-L$dep_prefix/lib``
* ``-L$dep_prefix/lib64``
Runtime library search paths (RPATHs)
- * ``-Wl,-rpath,$dep_prefix/lib``
- * ``-Wl,-rpath,$dep_prefix/lib64``
+ * ``$rpath_flag$dep_prefix/lib``
+ * ``$rpath_flag$dep_prefix/lib64``
Include search paths
* ``-I$dep_prefix/include``
An example of this would be the ``libdwarf`` build, which has one
dependency: ``libelf``. Every call to ``cc`` in the ``libdwarf``
build will have ``-I$LIBELF_PREFIX/include``,
-``-L$LIBELF_PREFIX/lib``, and ``-Wl,-rpath,$LIBELF_PREFIX/lib``
+``-L$LIBELF_PREFIX/lib``, and ``$rpath_flag$LIBELF_PREFIX/lib``
inserted on the command line. This is done transparently to the
project's build system, which will just think it's using a system
where ``libelf`` is readily available. Because of this, you **do
@@ -1831,6 +1831,31 @@ successfully find ``libdwarf.h`` and ``libdwarf.so``, without the
packager having to provide ``--with-libdwarf=/path/to/libdwarf`` on
the command line.
+.. note::
+
+ For most compilers, ``$rpath_flag`` is ``-Wl,-rpath,``. However, NAG
+ passes its flags to GCC instead of passing them directly to the linker.
+ Therefore, its ``$rpath_flag`` is doubly wrapped: ``-Wl,-Wl,,-rpath,``.
+ ``$rpath_flag`` can be overriden on a compiler specific basis in
+ ``lib/spack/spack/compilers/$compiler.py``.
+
+Compiler flags
+~~~~~~~~~~~~~~
+In rare circumstances such as compiling and running small unit tests, a package
+developer may need to know what are the appropriate compiler flags to enable
+features like ``OpenMP``, ``c++11``, ``c++14`` and alike. To that end the
+compiler classes in ``spack`` implement the following _properties_ :
+``openmp_flag``, ``cxx11_flag``, ``cxx14_flag``, which can be accessed in a
+package by ``self.compiler.cxx11_flag`` and alike. Note that the implementation
+is such that if a given compiler version does not support this feature, an
+error will be produced. Therefore package developers can also use these properties
+to assert that a compiler supports the requested feature. This is handy when a
+package supports additional variants like
+
+.. code-block:: python
+
+ variant('openmp', default=True, description="Enable OpenMP support.")
+
Message Parsing Interface (MPI)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is common for high performance computing software/packages to use ``MPI``.
diff --git a/lib/spack/env/cc b/lib/spack/env/cc
index cb07a2ffea..4564e84bd2 100755
--- a/lib/spack/env/cc
+++ b/lib/spack/env/cc
@@ -38,15 +38,20 @@
# -Wl,-rpath arguments for dependency /lib directories.
#
-# This is the list of environment variables that need to be set before
+# This is an array of environment variables that need to be set before
# the script runs. They are set by routines in spack.build_environment
# as part of spack.package.Package.do_install().
-parameters="
-SPACK_PREFIX
-SPACK_ENV_PATH
-SPACK_DEBUG_LOG_DIR
-SPACK_COMPILER_SPEC
-SPACK_SHORT_SPEC"
+parameters=(
+ SPACK_PREFIX
+ SPACK_ENV_PATH
+ SPACK_DEBUG_LOG_DIR
+ SPACK_COMPILER_SPEC
+ SPACK_CC_RPATH_ARG
+ SPACK_CXX_RPATH_ARG
+ SPACK_F77_RPATH_ARG
+ SPACK_FC_RPATH_ARG
+ SPACK_SHORT_SPEC
+)
# The compiler input variables are checked for sanity later:
# SPACK_CC, SPACK_CXX, SPACK_F77, SPACK_FC
@@ -64,7 +69,7 @@ function die {
exit 1
}
-for param in $parameters; do
+for param in ${parameters[@]}; do
if [[ -z ${!param} ]]; then
die "Spack compiler must be run from Spack! Input '$param' is missing."
fi
@@ -85,6 +90,7 @@ done
# ccld compile & link
command=$(basename "$0")
+comp="CC"
case "$command" in
cpp)
mode=cpp
@@ -92,18 +98,22 @@ case "$command" in
cc|c89|c99|gcc|clang|icc|pgcc|xlc)
command="$SPACK_CC"
language="C"
+ comp="CC"
;;
c++|CC|g++|clang++|icpc|pgc++|xlc++)
command="$SPACK_CXX"
language="C++"
+ comp="CXX"
;;
f90|fc|f95|gfortran|ifort|pgfortran|xlf90|nagfor)
command="$SPACK_FC"
language="Fortran 90"
+ comp="FC"
;;
f77|gfortran|ifort|pgfortran|xlf|nagfor)
command="$SPACK_F77"
language="Fortran 77"
+ comp="F77"
;;
ld)
mode=ld
@@ -142,6 +152,9 @@ if [[ -z $mode ]]; then
done
fi
+# Set up rpath variable according to language.
+eval rpath=\$SPACK_${comp}_RPATH_ARG
+
# Dump the version and exit if we're in testing mode.
if [[ $SPACK_TEST_COMMAND == dump-mode ]]; then
echo "$mode"
@@ -188,7 +201,7 @@ for dep in "${deps[@]}"; do
# Prepend lib and RPATH directories
if [[ -d $dep/lib ]]; then
if [[ $mode == ccld ]]; then
- $add_rpaths && args=("-Wl,-rpath,$dep/lib" "${args[@]}")
+ $add_rpaths && args=("$rpath$dep/lib" "${args[@]}")
args=("-L$dep/lib" "${args[@]}")
elif [[ $mode == ld ]]; then
$add_rpaths && args=("-rpath" "$dep/lib" "${args[@]}")
@@ -199,7 +212,7 @@ for dep in "${deps[@]}"; do
# Prepend lib64 and RPATH directories
if [[ -d $dep/lib64 ]]; then
if [[ $mode == ccld ]]; then
- $add_rpaths && args=("-Wl,-rpath,$dep/lib64" "${args[@]}")
+ $add_rpaths && args=("$rpath$dep/lib64" "${args[@]}")
args=("-L$dep/lib64" "${args[@]}")
elif [[ $mode == ld ]]; then
$add_rpaths && args=("-rpath" "$dep/lib64" "${args[@]}")
@@ -210,9 +223,11 @@ done
# Include all -L's and prefix/whatever dirs in rpath
if [[ $mode == ccld ]]; then
- $add_rpaths && args=("-Wl,-rpath,$SPACK_PREFIX/lib" "-Wl,-rpath,$SPACK_PREFIX/lib64" "${args[@]}")
+ $add_rpaths && args=("$rpath$SPACK_PREFIX/lib64" "${args[@]}")
+ $add_rpaths && args=("$rpath$SPACK_PREFIX/lib" "${args[@]}")
elif [[ $mode == ld ]]; then
- $add_rpaths && args=("-rpath" "$SPACK_PREFIX/lib" "-rpath" "$SPACK_PREFIX/lib64" "${args[@]}")
+ $add_rpaths && args=("-rpath" "$SPACK_PREFIX/lib64" "${args[@]}")
+ $add_rpaths && args=("-rpath" "$SPACK_PREFIX/lib" "${args[@]}")
fi
#
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index eb72f2a6b4..8961886049 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -98,21 +98,27 @@ def set_compiler_environment_variables(pkg, env):
# and return it
# TODO : add additional kwargs for better diagnostics, like requestor, ttyout, ttyerr, etc.
link_dir = spack.build_env_path
- env.set('CC', join_path(link_dir, pkg.compiler.link_paths['cc']))
+ env.set('CC', join_path(link_dir, pkg.compiler.link_paths['cc']))
env.set('CXX', join_path(link_dir, pkg.compiler.link_paths['cxx']))
env.set('F77', join_path(link_dir, pkg.compiler.link_paths['f77']))
- env.set('FC', join_path(link_dir, pkg.compiler.link_paths['fc']))
+ env.set('FC', join_path(link_dir, pkg.compiler.link_paths['fc']))
# Set SPACK compiler variables so that our wrapper knows what to call
compiler = pkg.compiler
if compiler.cc:
- env.set('SPACK_CC', compiler.cc)
+ env.set('SPACK_CC', compiler.cc)
if compiler.cxx:
env.set('SPACK_CXX', compiler.cxx)
if compiler.f77:
env.set('SPACK_F77', compiler.f77)
if compiler.fc:
- env.set('SPACK_FC', compiler.fc)
+ env.set('SPACK_FC', compiler.fc)
+
+ # Set SPACK compiler rpath flags so that our wrapper knows what to use
+ env.set('SPACK_CC_RPATH_ARG', compiler.cc_rpath_arg)
+ env.set('SPACK_CXX_RPATH_ARG', compiler.cxx_rpath_arg)
+ env.set('SPACK_F77_RPATH_ARG', compiler.f77_rpath_arg)
+ env.set('SPACK_FC_RPATH_ARG', compiler.fc_rpath_arg)
env.set('SPACK_COMPILER_SPEC', str(pkg.spec.compiler))
return env
@@ -175,8 +181,8 @@ def set_build_environment_variables(pkg, env):
# Add any pkgconfig directories to PKG_CONFIG_PATH
pkg_config_dirs = []
for p in dep_prefixes:
- for libdir in ('lib', 'lib64'):
- pcdir = join_path(p, libdir, 'pkgconfig')
+ for maybe in ('lib', 'lib64', 'share'):
+ pcdir = join_path(p, maybe, 'pkgconfig')
if os.path.isdir(pcdir):
pkg_config_dirs.append(pcdir)
env.set_path('PKG_CONFIG_PATH', pkg_config_dirs)
diff --git a/lib/spack/spack/cmd/compiler.py b/lib/spack/spack/cmd/compiler.py
index a8e9e2a7a5..d3f8779d32 100644
--- a/lib/spack/spack/cmd/compiler.py
+++ b/lib/spack/spack/cmd/compiler.py
@@ -22,19 +22,18 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
-import sys
import argparse
+import sys
import llnl.util.tty as tty
-from llnl.util.tty.color import colorize
-from llnl.util.tty.colify import colify
-from llnl.util.lang import index_by
-
import spack.compilers
-import spack.spec
import spack.config
-from spack.util.environment import get_path
+import spack.spec
+from llnl.util.lang import index_by
+from llnl.util.tty.colify import colify
+from llnl.util.tty.color import colorize
from spack.spec import CompilerSpec
+from spack.util.environment import get_path
description = "Manage compilers"
diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py
index f0cd50b8df..e3a31806ab 100644
--- a/lib/spack/spack/cmd/create.py
+++ b/lib/spack/spack/cmd/create.py
@@ -124,10 +124,12 @@ class ConfigureGuesser(object):
autotools = "configure('--prefix=%s' % prefix)"
cmake = "cmake('.', *std_cmake_args)"
python = "python('setup.py', 'install', '--prefix=%s' % prefix)"
+ r = "R('CMD', 'INSTALL', '--library=%s' % self.module.r_lib_dir, '%s' % self.stage.archive_file)"
config_lines = ((r'/configure$', 'autotools', autotools),
(r'/CMakeLists.txt$', 'cmake', cmake),
- (r'/setup.py$', 'python', python))
+ (r'/setup.py$', 'python', python),
+ (r'/NAMESPACE$', 'r', r))
# Peek inside the tarball.
tar = which('tar')
@@ -272,6 +274,10 @@ def create(parser, args):
if guesser.build_system == 'python':
name = 'py-%s' % name
+ # Prepend 'r-' to R package names, by convention.
+ if guesser.build_system == 'r':
+ name = 'r-%s' % name
+
# Create a directory for the new package.
pkg_path = repo.filename_for_package_name(name)
if os.path.exists(pkg_path) and not args.force:
diff --git a/lib/spack/spack/compiler.py b/lib/spack/spack/compiler.py
index 20896f9eec..0f208caaf3 100644
--- a/lib/spack/spack/compiler.py
+++ b/lib/spack/spack/compiler.py
@@ -91,14 +91,22 @@ class Compiler(object):
# version suffix for gcc.
suffixes = [r'-.*']
- # Names of generic arguments used by this compiler
- arg_rpath = '-Wl,-rpath,%s'
+ # Default flags used by a compiler to set an rpath
+ @property
+ def cc_rpath_arg(self):
+ return '-Wl,-rpath,'
+
+ @property
+ def cxx_rpath_arg(self):
+ return '-Wl,-rpath,'
- # argument used to get C++11 options
- cxx11_flag = "-std=c++11"
+ @property
+ def f77_rpath_arg(self):
+ return '-Wl,-rpath,'
- # argument used to get C++14 options
- cxx14_flag = "-std=c++1y"
+ @property
+ def fc_rpath_arg(self):
+ return '-Wl,-rpath,'
def __init__(self, cspec, cc, cxx, f77, fc):
@@ -120,6 +128,37 @@ class Compiler(object):
def version(self):
return self.spec.version
+ # This property should be overridden in the compiler subclass if
+ # OpenMP is supported by that compiler
+ @property
+ def openmp_flag(self):
+ # If it is not overridden, assume it is not supported and warn the user
+ tty.die("The compiler you have chosen does not currently support OpenMP.",
+ "If you think it should, please edit the compiler subclass and",
+ "submit a pull request or issue.")
+
+
+ # This property should be overridden in the compiler subclass if
+ # C++11 is supported by that compiler
+ @property
+ def cxx11_flag(self):
+ # If it is not overridden, assume it is not supported and warn the user
+ tty.die("The compiler you have chosen does not currently support C++11.",
+ "If you think it should, please edit the compiler subclass and",
+ "submit a pull request or issue.")
+
+
+ # This property should be overridden in the compiler subclass if
+ # C++14 is supported by that compiler
+ @property
+ def cxx14_flag(self):
+ # If it is not overridden, assume it is not supported and warn the user
+ tty.die("The compiler you have chosen does not currently support C++14.",
+ "If you think it should, please edit the compiler subclass and",
+ "submit a pull request or issue.")
+
+
+
#
# Compiler classes have methods for querying the version of
# specific compiler executables. This is used when discovering compilers.
@@ -205,6 +244,10 @@ class Compiler(object):
return None
successful = [key for key in parmap(check, checks) if key is not None]
+ # The 'successful' list is ordered like the input paths.
+ # Reverse it here so that the dict creation (last insert wins)
+ # does not spoil the intented precedence.
+ successful.reverse()
return dict(((v, p, s), path) for v, p, s, path in successful)
@classmethod
diff --git a/lib/spack/spack/compilers/clang.py b/lib/spack/spack/compilers/clang.py
index e406d86a24..8c646905c7 100644
--- a/lib/spack/spack/compilers/clang.py
+++ b/lib/spack/spack/compilers/clang.py
@@ -26,6 +26,8 @@ import re
import spack.compiler as cpr
from spack.compiler import *
from spack.util.executable import *
+import llnl.util.tty as tty
+from spack.version import ver
class Clang(Compiler):
# Subclasses use possible names of C compiler
@@ -47,6 +49,29 @@ class Clang(Compiler):
'f77' : 'f77',
'fc' : 'f90' }
+ @property
+ def is_apple(self):
+ ver_string = str(self.version)
+ return ver_string.endswith('-apple')
+
+ @property
+ def openmp_flag(self):
+ if self.is_apple:
+ tty.die("Clang from Apple does not support Openmp yet.")
+ else:
+ return "-fopenmp"
+
+ @property
+ def cxx11_flag(self):
+ if self.is_apple:
+ # FIXME: figure out from which version Apple's clang supports c++11
+ return "-std=c++11"
+ else:
+ if self.version < ver('3.3'):
+ tty.die("Only Clang 3.3 and above support c++11.")
+ else:
+ return "-std=c++11"
+
@classmethod
def default_version(self, comp):
"""The '--version' option works for clang compilers.
diff --git a/lib/spack/spack/compilers/gcc.py b/lib/spack/spack/compilers/gcc.py
index 2e57e44856..91c498ac82 100644
--- a/lib/spack/spack/compilers/gcc.py
+++ b/lib/spack/spack/compilers/gcc.py
@@ -50,6 +50,10 @@ class Gcc(Compiler):
'fc' : 'gcc/gfortran' }
@property
+ def openmp_flag(self):
+ return "-fopenmp"
+
+ @property
def cxx11_flag(self):
if self.version < ver('4.3'):
tty.die("Only gcc 4.3 and above support c++11.")
diff --git a/lib/spack/spack/compilers/intel.py b/lib/spack/spack/compilers/intel.py
index 69e9764790..9b1cf07c36 100644
--- a/lib/spack/spack/compilers/intel.py
+++ b/lib/spack/spack/compilers/intel.py
@@ -23,6 +23,8 @@
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack.compiler import *
+import llnl.util.tty as tty
+from spack.version import ver
class Intel(Compiler):
# Subclasses use possible names of C compiler
@@ -44,6 +46,13 @@ class Intel(Compiler):
'fc' : 'intel/ifort' }
@property
+ def openmp_flag(self):
+ if self.version < ver('16.0'):
+ return "-openmp"
+ else:
+ return "-qopenmp"
+
+ @property
def cxx11_flag(self):
if self.version < ver('11.1'):
tty.die("Only intel 11.1 and above support c++11.")
@@ -68,5 +77,3 @@ class Intel(Compiler):
"""
return get_compiler_version(
comp, '--version', r'\((?:IFORT|ICC)\) ([^ ]+)')
-
-
diff --git a/lib/spack/spack/compilers/nag.py b/lib/spack/spack/compilers/nag.py
index 527a05a090..49b77eae6b 100644
--- a/lib/spack/spack/compilers/nag.py
+++ b/lib/spack/spack/compilers/nag.py
@@ -1,4 +1,5 @@
from spack.compiler import *
+import llnl.util.tty as tty
class Nag(Compiler):
# Subclasses use possible names of C compiler
@@ -20,6 +21,27 @@ class Nag(Compiler):
'f77' : 'nag/nagfor',
'fc' : 'nag/nagfor' }
+ @property
+ def openmp_flag(self):
+ return "-openmp"
+
+ @property
+ def cxx11_flag(self):
+ # NAG does not have a C++ compiler
+ # However, it can be mixed with a compiler that does support it
+ return "-std=c++11"
+
+ # Unlike other compilers, the NAG compiler passes options to GCC, which
+ # then passes them to the linker. Therefore, we need to doubly wrap the
+ # options with '-Wl,-Wl,,'
+ @property
+ def f77_rpath_arg(self):
+ return '-Wl,-Wl,,-rpath,'
+
+ @property
+ def fc_rpath_arg(self):
+ return '-Wl,-Wl,,-rpath,'
+
@classmethod
def default_version(self, comp):
"""The '-V' option works for nag compilers.
diff --git a/lib/spack/spack/compilers/pgi.py b/lib/spack/spack/compilers/pgi.py
index c6a1078bd9..94c6b8365c 100644
--- a/lib/spack/spack/compilers/pgi.py
+++ b/lib/spack/spack/compilers/pgi.py
@@ -23,6 +23,7 @@
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack.compiler import *
+import llnl.util.tty as tty
class Pgi(Compiler):
# Subclasses use possible names of C compiler
@@ -43,6 +44,15 @@ class Pgi(Compiler):
'f77' : 'pgi/pgfortran',
'fc' : 'pgi/pgfortran' }
+ @property
+ def openmp_flag(self):
+ return "-mp"
+
+ @property
+ def cxx11_flag(self):
+ return "-std=c++11"
+
+
@classmethod
def default_version(cls, comp):
"""The '-V' option works for all the PGI compilers.
@@ -54,4 +64,3 @@ class Pgi(Compiler):
"""
return get_compiler_version(
comp, '-V', r'pg[^ ]* ([^ ]+) \d\d\d?-bit target')
-
diff --git a/lib/spack/spack/compilers/xl.py b/lib/spack/spack/compilers/xl.py
index c1d55109a3..61a2e730dc 100644
--- a/lib/spack/spack/compilers/xl.py
+++ b/lib/spack/spack/compilers/xl.py
@@ -24,6 +24,8 @@
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack.compiler import *
+import llnl.util.tty as tty
+from spack.version import ver
class Xl(Compiler):
# Subclasses use possible names of C compiler
@@ -45,6 +47,10 @@ class Xl(Compiler):
'fc' : 'xl/xlf90' }
@property
+ def openmp_flag(self):
+ return "-qsmp=omp"
+
+ @property
def cxx11_flag(self):
if self.version < ver('13.1'):
tty.die("Only xlC 13.1 and above have some c++11 support.")
diff --git a/lib/spack/spack/config.py b/lib/spack/spack/config.py
index 14e5aaf4fb..336d47cbb7 100644
--- a/lib/spack/spack/config.py
+++ b/lib/spack/spack/config.py
@@ -539,14 +539,16 @@ def update_config(section, update_data, scope=None):
other yaml-ish structure.
"""
+ validate_section_name(section) # validate section name
+ scope = validate_scope(scope) # get ConfigScope object from string.
+
# read in the config to ensure we've got current data
- get_config(section)
+ configuration = get_config(section)
- validate_section_name(section) # validate section name
- scope = validate_scope(scope) # get ConfigScope object from string.
+ configuration.update(update_data)
# read only the requested section's data.
- scope.sections[section] = { section : update_data }
+ scope.sections[section] = {section: configuration}
scope.write_section(section)
diff --git a/lib/spack/spack/test/cc.py b/lib/spack/spack/test/cc.py
index 594cd6efe9..35392d9d6d 100644
--- a/lib/spack/spack/test/cc.py
+++ b/lib/spack/spack/test/cc.py
@@ -67,6 +67,11 @@ class CompilerTest(unittest.TestCase):
os.environ['SPACK_COMPILER_SPEC'] = "gcc@4.4.7"
os.environ['SPACK_SHORT_SPEC'] = "foo@1.2"
+ os.environ['SPACK_CC_RPATH_ARG'] = "-Wl,-rpath,"
+ os.environ['SPACK_CXX_RPATH_ARG'] = "-Wl,-rpath,"
+ os.environ['SPACK_F77_RPATH_ARG'] = "-Wl,-rpath,"
+ os.environ['SPACK_FC_RPATH_ARG'] = "-Wl,-rpath,"
+
# Make some fake dependencies
self.tmp_deps = tempfile.mkdtemp()
self.dep1 = join_path(self.tmp_deps, 'dep1')
diff --git a/lib/spack/spack/test/config.py b/lib/spack/spack/test/config.py
index 0562d2d620..3977f0e7d4 100644
--- a/lib/spack/spack/test/config.py
+++ b/lib/spack/spack/test/config.py
@@ -33,7 +33,7 @@ from spack.test.mock_packages_test import *
# Some sample compiler config data
a_comps = {
- "all": {
+ "x86_64_E5v2_IntelIB": {
"gcc@4.7.3" : {
"cc" : "/gcc473",
"cxx": "/g++473",
@@ -53,7 +53,7 @@ a_comps = {
}
b_comps = {
- "all": {
+ "x86_64_E5v3": {
"icc@10.0" : {
"cc" : "/icc100",
"cxx": "/icc100",
@@ -85,27 +85,24 @@ class ConfigTest(MockPackagesTest):
super(ConfigTest, self).tearDown()
shutil.rmtree(self.tmp_dir, True)
-
- def check_config(self, comps, *compiler_names):
+ def check_config(self, comps, arch, *compiler_names):
"""Check that named compilers in comps match Spack's config."""
config = spack.config.get_config('compilers')
compiler_list = ['cc', 'cxx', 'f77', 'fc']
for key in compiler_names:
for c in compiler_list:
- expected = comps['all'][key][c]
- actual = config['all'][key][c]
+ expected = comps[arch][key][c]
+ actual = config[arch][key][c]
self.assertEqual(expected, actual)
-
def test_write_key_in_memory(self):
# Write b_comps "on top of" a_comps.
spack.config.update_config('compilers', a_comps, 'test_low_priority')
spack.config.update_config('compilers', b_comps, 'test_high_priority')
# Make sure the config looks how we expect.
- self.check_config(a_comps, 'gcc@4.7.3', 'gcc@4.5.0')
- self.check_config(b_comps, 'icc@10.0', 'icc@11.1', 'clang@3.3')
-
+ self.check_config(a_comps, 'x86_64_E5v2_IntelIB', 'gcc@4.7.3', 'gcc@4.5.0')
+ self.check_config(b_comps, 'x86_64_E5v3', 'icc@10.0', 'icc@11.1', 'clang@3.3')
def test_write_key_to_disk(self):
# Write b_comps "on top of" a_comps.
@@ -116,5 +113,17 @@ class ConfigTest(MockPackagesTest):
spack.config.clear_config_caches()
# Same check again, to ensure consistency.
- self.check_config(a_comps, 'gcc@4.7.3', 'gcc@4.5.0')
- self.check_config(b_comps, 'icc@10.0', 'icc@11.1', 'clang@3.3')
+ self.check_config(a_comps, 'x86_64_E5v2_IntelIB', 'gcc@4.7.3', 'gcc@4.5.0')
+ self.check_config(b_comps, 'x86_64_E5v3', 'icc@10.0', 'icc@11.1', 'clang@3.3')
+
+ def test_write_to_same_priority_file(self):
+ # Write b_comps in the same file as a_comps.
+ spack.config.update_config('compilers', a_comps, 'test_low_priority')
+ spack.config.update_config('compilers', b_comps, 'test_low_priority')
+
+ # Clear caches so we're forced to read from disk.
+ spack.config.clear_config_caches()
+
+ # Same check again, to ensure consistency.
+ self.check_config(a_comps, 'x86_64_E5v2_IntelIB', 'gcc@4.7.3', 'gcc@4.5.0')
+ self.check_config(b_comps, 'x86_64_E5v3', 'icc@10.0', 'icc@11.1', 'clang@3.3')
diff --git a/lib/spack/spack/url.py b/lib/spack/spack/url.py
index f51f05cad7..ad51da9d47 100644
--- a/lib/spack/spack/url.py
+++ b/lib/spack/spack/url.py
@@ -206,6 +206,9 @@ def parse_version_offset(path):
# e.g. lame-398-1
(r'-((\d)+-\d)', stem),
+ # e.g. foobar_1.2-3
+ (r'_((\d+\.)+\d+(-\d+)?[a-z]?)', stem),
+
# e.g. foobar-4.5.1
(r'-((\d+\.)*\d+)$', stem),
diff --git a/lib/spack/spack/util/executable.py b/lib/spack/spack/util/executable.py
index fc27b789d0..25819b6fc7 100644
--- a/lib/spack/spack/util/executable.py
+++ b/lib/spack/spack/util/executable.py
@@ -144,7 +144,7 @@ class Executable(object):
cmd = self.exe + list(args)
- cmd_line = ' '.join(cmd)
+ cmd_line = "'%s'" % "' '".join(map(lambda arg: arg.replace("'", "'\"'\"'"), cmd))
tty.debug(cmd_line)
try: