This commit is contained in:
Todd Gamblin 2016-05-09 03:40:34 -07:00
parent 0c853ac3ea
commit 73107d6b0f
5 changed files with 13 additions and 30 deletions

View file

@ -32,11 +32,11 @@
import shutil
import multiprocessing
import platform
import llnl.util.tty as tty
from llnl.util.filesystem import *
import spack
import llnl.util.tty as tty
from llnl.util.filesystem import *
from spack.environment import EnvironmentModifications, validate
import spack.compilers as compilers
import spack.compiler as Compiler
@ -99,16 +99,16 @@ def set_compiler_environment_variables(pkg, env):
flags = pkg.spec.compiler_flags
# Set compiler variables used by CMake and autotools
assert all(key in pkg.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
# 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('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('CC', join_path(link_dir, compiler.link_paths['cc']))
env.set('CXX', join_path(link_dir, compiler.link_paths['cxx']))
env.set('F77', join_path(link_dir, compiler.link_paths['f77']))
env.set('FC', join_path(link_dir, compiler.link_paths['fc']))
# Set SPACK compiler variables so that our wrapper knows what to call
if compiler.cc:
@ -119,11 +119,11 @@ def set_compiler_environment_variables(pkg, env):
env.set('SPACK_F77', compiler.f77)
if compiler.fc:
env.set('SPACK_FC', compiler.fc)
# Add every valid compiler flag to the environment, prefaced by "SPACK_"
# Add every valid compiler flag to the environment, prefixed with "SPACK_"
for flag in spack.spec.FlagMap.valid_compiler_flags():
# Concreteness guarantees key safety here
if flags[flag] != []:
env.set('SPACK_'+flag.upper(), ' '.join(f for f in flags[flag]))
env.set('SPACK_' + flag.upper(), ' '.join(f for f in flags[flag]))
env.set('SPACK_COMPILER_SPEC', str(pkg.spec.compiler))
return env

View file

@ -93,10 +93,10 @@ def display_specs(specs, **kwargs):
hlen = None
nfmt = '.' if namespace else '_'
format_string = '$%s$@$+' %nfmt
format_string = '$%s$@$+' % nfmt
flags = kwargs.get('show_flags', False)
if flags:
format_string = '$.$@$%+$+' if nfmt == '.' else '$_$@$%+$+'
format_string = '$%s$@$%%+$+' % nfmt
# Make a dict with specs keyed by architecture and compiler.
index = index_by(specs, ('architecture', 'compiler'))

View file

@ -39,7 +39,6 @@
import spack.architecture
from spack.util.multiproc import parmap
import spack.compiler as Comp
from spack.compiler import Compiler
from spack.util.executable import which
from spack.util.naming import mod_to_class

View file

@ -43,7 +43,6 @@
from spec import DependencyMap
from itertools import chain
from spack.config import *
import spack.compiler as Compiler
class DefaultConcretizer(object):
@ -279,8 +278,6 @@ def concretize_compiler_flags(self, spec):
"""
ret = False
for flag in spack.spec.FlagMap.valid_compiler_flags():
# if flag in spec.compiler_flags:
# continue
try:
nearest = next(p for p in spec.traverse(direction='parents')
if ((p.compiler == spec.compiler and p is not spec)
@ -317,7 +314,8 @@ def concretize_compiler_flags(self, spec):
if compiler.flags[flag] != []:
ret = True
else:
if (sorted(spec.compiler_flags[flag]) != sorted(compiler.flags[flag])) and (not set(spec.compiler_flags[flag]) >= set(compiler.flags[flag])):
if ((sorted(spec.compiler_flags[flag]) != sorted(compiler.flags[flag])) and
(not set(spec.compiler_flags[flag]) >= set(compiler.flags[flag]))):
ret = True
spec.compiler_flags[flag] = list(set(spec.compiler_flags[flag]) |
set(compiler.flags[flag]))
@ -325,19 +323,6 @@ def concretize_compiler_flags(self, spec):
return ret
# def choose_provider(self, spec, providers):
# """This is invoked for virtual specs. Given a spec with a virtual name,
# say "mpi", and a list of specs of possible providers of that spec,
# select a provider and return it.
# """
# assert(spec.virtual)
# assert(providers)
# index = spack.spec.index_specs(providers)
# first_key = sorted(index.keys())[0]
# latest_version = sorted(index[first_key])[-1]
# return latest_version
def find_spec(spec, condition):
"""Searches the dag from spec in an intelligent order and looks
for a spec that matches a condition"""

View file

@ -353,7 +353,6 @@ def _write(self):
temp_file = self._index_path + (
'.%s.%s.temp' % (socket.getfqdn(), os.getpid()))
# Write a temporary database file them move it into place
try:
with open(temp_file, 'w') as f: