cleanup
This commit is contained in:
		@@ -32,11 +32,11 @@
 | 
				
			|||||||
import shutil
 | 
					import shutil
 | 
				
			||||||
import multiprocessing
 | 
					import multiprocessing
 | 
				
			||||||
import platform
 | 
					import platform
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import llnl.util.tty as tty
 | 
				
			||||||
from llnl.util.filesystem import *
 | 
					from llnl.util.filesystem import *
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import spack
 | 
					import spack
 | 
				
			||||||
import llnl.util.tty as tty
 | 
					 | 
				
			||||||
from llnl.util.filesystem import *
 | 
					 | 
				
			||||||
from spack.environment import EnvironmentModifications, validate
 | 
					from spack.environment import EnvironmentModifications, validate
 | 
				
			||||||
import spack.compilers as compilers
 | 
					import spack.compilers as compilers
 | 
				
			||||||
import spack.compiler as Compiler
 | 
					import spack.compiler as Compiler
 | 
				
			||||||
@@ -99,16 +99,16 @@ 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 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
 | 
					    # 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, pkg.compiler.link_paths['cc']))
 | 
					    env.set('CC',  join_path(link_dir, compiler.link_paths['cc']))
 | 
				
			||||||
    env.set('CXX', join_path(link_dir, pkg.compiler.link_paths['cxx']))
 | 
					    env.set('CXX', join_path(link_dir, compiler.link_paths['cxx']))
 | 
				
			||||||
    env.set('F77', join_path(link_dir, pkg.compiler.link_paths['f77']))
 | 
					    env.set('F77', join_path(link_dir, compiler.link_paths['f77']))
 | 
				
			||||||
    env.set('FC', join_path(link_dir, pkg.compiler.link_paths['fc']))
 | 
					    env.set('FC',  join_path(link_dir, compiler.link_paths['fc']))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Set SPACK compiler variables so that our wrapper knows what to call
 | 
					    # Set SPACK compiler variables so that our wrapper knows what to call
 | 
				
			||||||
    if compiler.cc:
 | 
					    if compiler.cc:
 | 
				
			||||||
@@ -119,7 +119,7 @@ def set_compiler_environment_variables(pkg, env):
 | 
				
			|||||||
        env.set('SPACK_F77', compiler.f77)
 | 
					        env.set('SPACK_F77', compiler.f77)
 | 
				
			||||||
    if compiler.fc:
 | 
					    if compiler.fc:
 | 
				
			||||||
        env.set('SPACK_FC', 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():
 | 
					    for flag in spack.spec.FlagMap.valid_compiler_flags():
 | 
				
			||||||
        # Concreteness guarantees key safety here
 | 
					        # Concreteness guarantees key safety here
 | 
				
			||||||
        if flags[flag] != []:
 | 
					        if flags[flag] != []:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -96,7 +96,7 @@ def display_specs(specs, **kwargs):
 | 
				
			|||||||
    format_string = '$%s$@$+' % nfmt
 | 
					    format_string = '$%s$@$+' % nfmt
 | 
				
			||||||
    flags = kwargs.get('show_flags', False)
 | 
					    flags = kwargs.get('show_flags', False)
 | 
				
			||||||
    if flags:
 | 
					    if flags:
 | 
				
			||||||
        format_string = '$.$@$%+$+' if nfmt == '.' else '$_$@$%+$+'
 | 
					        format_string = '$%s$@$%%+$+' % nfmt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Make a dict with specs keyed by architecture and compiler.
 | 
					    # Make a dict with specs keyed by architecture and compiler.
 | 
				
			||||||
    index = index_by(specs, ('architecture', 'compiler'))
 | 
					    index = index_by(specs, ('architecture', 'compiler'))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,7 +39,6 @@
 | 
				
			|||||||
import spack.architecture
 | 
					import spack.architecture
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from spack.util.multiproc import parmap
 | 
					from spack.util.multiproc import parmap
 | 
				
			||||||
import spack.compiler as Comp
 | 
					 | 
				
			||||||
from spack.compiler import Compiler
 | 
					from spack.compiler import Compiler
 | 
				
			||||||
from spack.util.executable import which
 | 
					from spack.util.executable import which
 | 
				
			||||||
from spack.util.naming import mod_to_class
 | 
					from spack.util.naming import mod_to_class
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -43,7 +43,6 @@
 | 
				
			|||||||
from spec import DependencyMap
 | 
					from spec import DependencyMap
 | 
				
			||||||
from itertools import chain
 | 
					from itertools import chain
 | 
				
			||||||
from spack.config import *
 | 
					from spack.config import *
 | 
				
			||||||
import spack.compiler as Compiler
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class DefaultConcretizer(object):
 | 
					class DefaultConcretizer(object):
 | 
				
			||||||
@@ -279,8 +278,6 @@ def concretize_compiler_flags(self, spec):
 | 
				
			|||||||
        """
 | 
					        """
 | 
				
			||||||
        ret = False
 | 
					        ret = False
 | 
				
			||||||
        for flag in spack.spec.FlagMap.valid_compiler_flags():
 | 
					        for flag in spack.spec.FlagMap.valid_compiler_flags():
 | 
				
			||||||
#            if flag in spec.compiler_flags:
 | 
					 | 
				
			||||||
#                continue
 | 
					 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
                nearest = next(p for p in spec.traverse(direction='parents')
 | 
					                nearest = next(p for p in spec.traverse(direction='parents')
 | 
				
			||||||
                               if ((p.compiler == spec.compiler and p is not spec)
 | 
					                               if ((p.compiler == spec.compiler and p is not spec)
 | 
				
			||||||
@@ -317,7 +314,8 @@ def concretize_compiler_flags(self, spec):
 | 
				
			|||||||
                if compiler.flags[flag] != []:
 | 
					                if compiler.flags[flag] != []:
 | 
				
			||||||
                    ret = True
 | 
					                    ret = True
 | 
				
			||||||
            else:
 | 
					            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
 | 
					                    ret = True
 | 
				
			||||||
                    spec.compiler_flags[flag] = list(set(spec.compiler_flags[flag]) |
 | 
					                    spec.compiler_flags[flag] = list(set(spec.compiler_flags[flag]) |
 | 
				
			||||||
                                                     set(compiler.flags[flag]))
 | 
					                                                     set(compiler.flags[flag]))
 | 
				
			||||||
@@ -325,19 +323,6 @@ def concretize_compiler_flags(self, spec):
 | 
				
			|||||||
        return ret
 | 
					        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):
 | 
					def find_spec(spec, condition):
 | 
				
			||||||
    """Searches the dag from spec in an intelligent order and looks
 | 
					    """Searches the dag from spec in an intelligent order and looks
 | 
				
			||||||
       for a spec that matches a condition"""
 | 
					       for a spec that matches a condition"""
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -353,7 +353,6 @@ def _write(self):
 | 
				
			|||||||
        temp_file = self._index_path + (
 | 
					        temp_file = self._index_path + (
 | 
				
			||||||
            '.%s.%s.temp' % (socket.getfqdn(), os.getpid()))
 | 
					            '.%s.%s.temp' % (socket.getfqdn(), os.getpid()))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
        # Write a temporary database file them move it into place
 | 
					        # Write a temporary database file them move it into place
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            with open(temp_file, 'w') as f:
 | 
					            with open(temp_file, 'w') as f:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user