Merge branch 'develop' into correct-cc

This commit is contained in:
Erik Schnetter
2015-12-21 13:18:35 -05:00
69 changed files with 1853 additions and 148 deletions

14
lib/spack/env/cc vendored
View File

@@ -86,22 +86,22 @@ done
#
command=$(basename "$0")
case "$command" in
cc|gcc|c89|c99|clang|xlc)
cc|c89|c99|gcc|clang|icc|pgcc|xlc)
command="$SPACK_CC"
language="C"
;;
c++|CC|g++|clang++|xlC)
c++|CC|g++|clang++|icpc|pgCC|xlc++)
command="$SPACK_CXX"
language="C++"
;;
f77|xlf)
command="$SPACK_F77"
language="Fortran 77"
;;
fc|f90|f95|xlf90)
f90|fc|f95|gfortran|ifort|pgf90|xlf90)
command="$SPACK_FC"
language="Fortran 90"
;;
f77|gfortran|ifort|pgf77|xlf)
command="$SPACK_F77"
language="Fortran 77"
;;
cpp)
mode=cpp
;;

1
lib/spack/env/clang/clang vendored Symbolic link
View File

@@ -0,0 +1 @@
../cc

1
lib/spack/env/clang/clang++ vendored Symbolic link
View File

@@ -0,0 +1 @@
../cc

1
lib/spack/env/gcc/g++ vendored Symbolic link
View File

@@ -0,0 +1 @@
../cc

1
lib/spack/env/gcc/gcc vendored Symbolic link
View File

@@ -0,0 +1 @@
../cc

1
lib/spack/env/gcc/gfortran vendored Symbolic link
View File

@@ -0,0 +1 @@
../cc

1
lib/spack/env/intel/icc vendored Symbolic link
View File

@@ -0,0 +1 @@
../cc

1
lib/spack/env/intel/icpc vendored Symbolic link
View File

@@ -0,0 +1 @@
../cc

1
lib/spack/env/intel/ifort vendored Symbolic link
View File

@@ -0,0 +1 @@
../cc

1
lib/spack/env/pgi/case-insensitive/pgCC vendored Symbolic link
View File

@@ -0,0 +1 @@
../../cc

1
lib/spack/env/pgi/pgcc vendored Symbolic link
View File

@@ -0,0 +1 @@
../cc

1
lib/spack/env/pgi/pgf77 vendored Symbolic link
View File

@@ -0,0 +1 @@
../cc

1
lib/spack/env/pgi/pgf90 vendored Symbolic link
View File

@@ -0,0 +1 @@
../cc

1
lib/spack/env/xl/xlc vendored Symbolic link
View File

@@ -0,0 +1 @@
../cc

1
lib/spack/env/xl/xlc++ vendored Symbolic link
View File

@@ -0,0 +1 @@
../cc

1
lib/spack/env/xl/xlf vendored Symbolic link
View File

@@ -0,0 +1 @@
../cc

1
lib/spack/env/xl/xlf90 vendored Symbolic link
View File

@@ -0,0 +1 @@
../cc

View File

@@ -30,7 +30,8 @@
StandardModules = {
"__future__": (2, 1),
"abc": (2, 6),
"argparse": (2, 7),
# skip argparse now that it's in lib/spack/external
# "argparse": (2, 7),
"ast": (2, 6),
"atexit": (2, 0),
"bz2": (2, 3),

View File

@@ -88,10 +88,14 @@ def set_compiler_environment_variables(pkg):
compiler = pkg.compiler
# Set compiler variables used by CMake and autotools
os.environ['CC'] = join_path(spack.build_env_path, 'cc')
os.environ['CXX'] = join_path(spack.build_env_path, 'c++')
os.environ['F77'] = join_path(spack.build_env_path, 'f77')
os.environ['FC'] = join_path(spack.build_env_path, 'f90')
assert all(key in pkg.compiler.link_paths
for key in ('cc', 'cxx', 'f77', 'fc'))
link_dir = spack.build_env_path
os.environ['CC'] = join_path(link_dir, pkg.compiler.link_paths['cc'])
os.environ['CXX'] = join_path(link_dir, pkg.compiler.link_paths['cxx'])
os.environ['F77'] = join_path(link_dir, pkg.compiler.link_paths['f77'])
os.environ['FC'] = join_path(link_dir, pkg.compiler.link_paths['fc'])
# Set SPACK compiler variables so that our wrapper knows what to call
if compiler.cc:
@@ -110,11 +114,23 @@ def set_build_environment_variables(pkg):
"""This ensures a clean install environment when we build packages.
"""
# Add spack build environment path with compiler wrappers first in
# the path. We handle case sensitivity conflicts like "CC" and
# "cc" by putting one in the <build_env_path>/case-insensitive
# the path. We add both spack.env_path, which includes default
# wrappers (cc, c++, f77, f90), AND a subdirectory containing
# compiler-specific symlinks. The latter ensures that builds that
# are sensitive to the *name* of the compiler see the right name
# when we're building wtih the wrappers.
#
# Conflicts on case-insensitive systems (like "CC" and "cc") are
# handled by putting one in the <build_env_path>/case-insensitive
# directory. Add that to the path too.
env_paths = [spack.build_env_path,
join_path(spack.build_env_path, 'case-insensitive')]
env_paths = []
def add_env_path(path):
env_paths.append(path)
ci = join_path(path, 'case-insensitive')
if os.path.isdir(ci): env_paths.append(ci)
add_env_path(spack.build_env_path)
add_env_path(join_path(spack.build_env_path, pkg.compiler.name))
path_put_first("PATH", env_paths)
path_set(SPACK_ENV_PATH, env_paths)

View File

@@ -54,7 +54,9 @@ def extensions(parser, args):
if not args.spec:
tty.die("extensions requires a package spec.")
#
# Checks
#
spec = spack.cmd.parse_specs(args.spec)
if len(spec) > 1:
tty.die("Can only list extensions for one package.")
@@ -70,7 +72,9 @@ def extensions(parser, args):
if not args.mode:
args.mode = 'short'
#
# List package names of extensions
#
extensions = spack.db.extensions_for(spec)
if not extensions:
tty.msg("%s has no extensions." % spec.cshort_spec)
@@ -79,7 +83,9 @@ def extensions(parser, args):
tty.msg("%d extensions:" % len(extensions))
colify(ext.name for ext in extensions)
#
# List specs of installed extensions.
#
installed = [s.spec for s in spack.installed_db.installed_extensions_for(spec)]
print
if not installed:
@@ -88,7 +94,9 @@ def extensions(parser, args):
tty.msg("%d installed:" % len(installed))
spack.cmd.find.display_specs(installed, mode=args.mode)
#
# List specs of activated extensions.
#
activated = spack.install_layout.extension_map(spec)
print
if not activated:

View File

@@ -33,10 +33,13 @@ def setup_parser(subparser):
subparser.add_argument(
'-n', '--no-checksum', action='store_true', dest='no_checksum',
help="Do not check packages against checksum")
subparser.add_argument(
'-m', '--missing', action='store_true', help="Also fetch all missing dependencies")
subparser.add_argument(
'-D', '--dependencies', action='store_true', help="Also fetch all dependencies")
subparser.add_argument(
'packages', nargs=argparse.REMAINDER, help="specs of packages to fetch")
def fetch(parser, args):
if not args.packages:
tty.die("fetch requires at least one package argument")
@@ -46,5 +49,13 @@ def fetch(parser, args):
specs = spack.cmd.parse_specs(args.packages, concretize=True)
for spec in specs:
if args.missing or args.dependencies:
to_fetch = set()
for s in spec.traverse():
package = spack.db.get(s)
if args.missing and package.installed:
continue
package.do_fetch()
package = spack.db.get(spec)
package.do_fetch()

View File

@@ -54,6 +54,8 @@ def setup_parser(subparser):
'specs', nargs=argparse.REMAINDER, help="Specs of packages to put in mirror")
create_parser.add_argument(
'-f', '--file', help="File with specs of packages to put in mirror.")
create_parser.add_argument(
'-D', '--dependencies', action='store_true', help="Also fetch all dependencies")
create_parser.add_argument(
'-o', '--one-version-per-spec', action='store_const', const=1, default=0,
help="Only fetch one 'preferred' version per spec, not all known versions.")
@@ -118,7 +120,7 @@ def mirror_create(args):
"""Create a directory to be used as a spack mirror, and fill it with
package archives."""
# try to parse specs from the command line first.
specs = spack.cmd.parse_specs(args.specs)
specs = spack.cmd.parse_specs(args.specs, concretize=True)
# If there is a file, parse each line as a spec and add it to the list.
if args.file:
@@ -131,6 +133,14 @@ def mirror_create(args):
specs = [Spec(n) for n in spack.db.all_package_names()]
specs.sort(key=lambda s: s.format("$_$@").lower())
if args.dependencies:
new_specs = set()
for spec in specs:
spec.concretize()
for s in spec.traverse():
new_specs.add(s)
specs = list(new_specs)
# Default name for directory is spack-mirror-<DATESTAMP>
directory = args.directory
if not directory:

View File

@@ -31,6 +31,8 @@
import spack
def setup_parser(subparser):
subparser.add_argument(
'-c', dest='python_command', help='Command to execute.')
subparser.add_argument(
'python_args', nargs=argparse.REMAINDER, help="File to run plus arguments.")
@@ -38,7 +40,8 @@ def setup_parser(subparser):
def python(parser, args):
# Fake a main python shell by setting __name__ to __main__.
console = code.InteractiveConsole({'__name__' : '__main__'})
console = code.InteractiveConsole({'__name__' : '__main__',
'spack' : spack})
if "PYTHONSTARTUP" in os.environ:
startup_file = os.environ["PYTHONSTARTUP"]
@@ -47,7 +50,10 @@ def python(parser, args):
console.runsource(startup.read(), startup_file, 'exec')
python_args = args.python_args
if python_args:
python_command = args.python_command
if python_command:
console.runsource(python_command)
elif python_args:
sys.argv = python_args
with open(python_args[0]) as file:
console.runsource(file.read(), python_args[0], 'exec')

View File

@@ -42,9 +42,9 @@ def setup_parser(subparser):
help="Remove regardless of whether other packages depend on this one.")
subparser.add_argument(
'-a', '--all', action='store_true', dest='all',
help="USE CAREFULLY. Remove ALL installed packages that match each supplied spec. " +
"i.e., if you say uninstall libelf, ALL versions of libelf are uninstalled. " +
"This is both useful and dangerous, like rm -r.")
help="USE CAREFULLY. Remove ALL installed packages that match each " +
"supplied spec. i.e., if you say uninstall libelf, ALL versions of " +
"libelf are uninstalled. This is both useful and dangerous, like rm -r.")
subparser.add_argument(
'packages', nargs=argparse.REMAINDER, help="specs of packages to uninstall")
@@ -81,7 +81,8 @@ def uninstall(parser, args):
pkgs.append(s.package)
except spack.packages.UnknownPackageError, e:
# The package.py file has gone away -- but still want to uninstall.
# The package.py file has gone away -- but still want to
# uninstall.
spack.Package(s).do_uninstall(force=True)
# Sort packages to be uninstalled by the number of installed dependents

View File

@@ -37,6 +37,12 @@ class Clang(Compiler):
# Subclasses use possible names of Fortran 90 compiler
fc_names = []
# Named wrapper links within spack.build_env_path
link_paths = { 'cc' : 'clang/clang',
'cxx' : 'clang/clang++',
# Use default wrappers for fortran, in case provided in compilers.yaml
'f77' : 'f77',
'fc' : 'f90' }
@classmethod
def default_version(self, comp):

View File

@@ -42,6 +42,12 @@ class Gcc(Compiler):
# MacPorts builds gcc versions with prefixes and -mp-X.Y suffixes.
suffixes = [r'-mp-\d\.\d']
# Named wrapper links within spack.build_env_path
link_paths = {'cc' : 'gcc/gcc',
'cxx' : 'gcc/g++',
'f77' : 'gcc/gfortran',
'fc' : 'gcc/gfortran' }
@property
def cxx11_flag(self):
if self.version < ver('4.3'):

View File

@@ -37,6 +37,12 @@ class Intel(Compiler):
# Subclasses use possible names of Fortran 90 compiler
fc_names = ['ifort']
# Named wrapper links within spack.build_env_path
link_paths = { 'cc' : 'intel/icc',
'cxx' : 'intel/icpc',
'f77' : 'intel/ifort',
'fc' : 'intel/ifort' }
@property
def cxx11_flag(self):
if self.version < ver('11.1'):

View File

@@ -37,6 +37,12 @@ class Pgi(Compiler):
# Subclasses use possible names of Fortran 90 compiler
fc_names = ['pgf95', 'pgf90']
# Named wrapper links within spack.build_env_path
link_paths = { 'cc' : 'pgi/pgcc',
'cxx' : 'pgi/case-insensitive/pgCC',
'f77' : 'pgi/pgf77',
'fc' : 'pgi/pgf90' }
@classmethod
def default_version(cls, comp):
"""The '-V' option works for all the PGI compilers.

View File

@@ -38,6 +38,12 @@ class Xl(Compiler):
# Subclasses use possible names of Fortran 90 compiler
fc_names = ['xlf90','xlf90_r','xlf95','xlf95_r','xlf2003','xlf2003_r','xlf2008','xlf2008_r']
# Named wrapper links within spack.build_env_path
link_paths = { 'cc' : 'xl/xlc',
'cxx' : 'xl/xlc++',
'f77' : 'xl/xlf',
'fc' : 'xl/xlf90' }
@property
def cxx11_flag(self):
if self.version < ver('13.1'):

View File

@@ -54,6 +54,7 @@
from spack.version import Version
from spack.spec import Spec
from spack.error import SpackError
from spack.packages import UnknownPackageError
# DB goes in this directory underneath the root
_db_dirname = '.spack-db'

View File

@@ -27,9 +27,7 @@
def pre_uninstall(pkg):
# Need to do this b/c uninstall does not automatically do it.
# TODO: store full graph info in stored .spec file.
pkg.spec.normalize()
assert(pkg.spec.concrete)
if pkg.is_extension:
if pkg.activated:

View File

@@ -146,7 +146,7 @@ def create(path, specs, **kwargs):
stage = None
try:
# create a subdirectory for the current package@version
archive_path = os.path.abspath(join_path(path, mirror_archive_path(spec)))
archive_path = os.path.abspath(join_path(mirror_root, mirror_archive_path(spec)))
subdir = os.path.dirname(archive_path)
mkdirp(subdir)

View File

@@ -487,9 +487,15 @@ def extendee_spec(self):
if name == dep.name:
return dep
# Otherwise return the spec from the extends() directive
spec, kwargs = self.extendees[name]
return spec
# if the spec is concrete already, then it extends something
# that is an *optional* dependency, and the dep isn't there.
if self.spec._concrete:
return None
else:
# If it's not concrete, then return the spec from the
# extends() directive since that is all we know so far.
spec, kwargs = self.extendees[name]
return spec
@property
@@ -497,18 +503,28 @@ def extendee_args(self):
"""Spec of the extendee of this package, or None if it is not an extension."""
if not self.extendees:
return None
# TODO: allow multiple extendees.
name = next(iter(self.extendees))
return self.extendees[name][1]
@property
def is_extension(self):
return len(self.extendees) > 0
# if it is concrete, it's only an extension if it actually
# dependes on the extendee.
if self.spec._concrete:
return self.extendee_spec is not None
else:
# If not, then it's an extension if it *could* be an extension
return bool(self.extendees)
def extends(self, spec):
return (spec.name in self.extendees and
spec.satisfies(self.extendees[spec.name][0]))
if not spec.name in self.extendees:
return False
s = self.extendee_spec
return s and s.satisfies(spec)
@property

View File

@@ -63,10 +63,6 @@ def check_python_versions(self, *files):
all_issues = {}
for fn in files:
if fn != '/Users/gamblin2/src/spack/var/spack/packages/vim/package.py':
continue
print fn
with open(fn) as pyfile:
versions = pyqver2.get_versions(pyfile.read())
for ver, reasons in versions.items():