added default compilers into spec and fixed constrain/concretize bug
This commit is contained in:
		@@ -104,18 +104,11 @@ def set_compiler_environment_variables(pkg):
 | 
			
		||||
    if compiler.fc:
 | 
			
		||||
        os.environ['SPACK_FC']  = compiler.fc
 | 
			
		||||
 | 
			
		||||
    # Incorporate the compiler default flags into the set of flags
 | 
			
		||||
    for flag in flags:#This is all valid flags as well because it's concrete
 | 
			
		||||
        if flag in compiler.flags and compiler.flags[flag] != "":
 | 
			
		||||
            compiler.flags[flag] += ' '+flags[flag]
 | 
			
		||||
        else:
 | 
			
		||||
            compiler.flags[flag] = flags[flag]
 | 
			
		||||
 | 
			
		||||
    # Add every valid compiler flag to the environment, prefaced by "SPACK_"
 | 
			
		||||
    for flag in Compiler.valid_compiler_flags():
 | 
			
		||||
        #The previous block and concreteness guarantee key safety here
 | 
			
		||||
        if compiler.flags[flag] != "":
 | 
			
		||||
            os.environ['SPACK_'+flag.upper()] = compiler.flags[flag]
 | 
			
		||||
        # Concreteness guarantees key safety here
 | 
			
		||||
        if flags[flag] != '':
 | 
			
		||||
            os.environ['SPACK_'+flag.upper()] = flags[flag]
 | 
			
		||||
 | 
			
		||||
    os.environ['SPACK_COMPILER_SPEC']  = str(pkg.spec.compiler)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -394,11 +394,14 @@ def constrain(self, other):
 | 
			
		||||
        Return whether the spec changed.
 | 
			
		||||
        """
 | 
			
		||||
        changed = False
 | 
			
		||||
        for k in other:
 | 
			
		||||
            if k in self:
 | 
			
		||||
 | 
			
		||||
        # Others_set removes flags set to '' from the comparison
 | 
			
		||||
        others_set = (k for k in other if other[k] != '')
 | 
			
		||||
        for k in others_set:
 | 
			
		||||
            if k in self and self[k] != '':
 | 
			
		||||
                if self[k] != other[k]:
 | 
			
		||||
                    #This will not properly recognize incompatible flags
 | 
			
		||||
                    self[k] += other[k]
 | 
			
		||||
                    # This will not recognize incompatible flags, merely concatenates
 | 
			
		||||
                    self[k] += ' ' + other[k]
 | 
			
		||||
                    changed = True
 | 
			
		||||
            else:
 | 
			
		||||
                self[k] = other[k]
 | 
			
		||||
@@ -912,7 +915,6 @@ def concretize(self):
 | 
			
		||||
 | 
			
		||||
        while changed:
 | 
			
		||||
#debugging code
 | 
			
		||||
#            print self, "raw"
 | 
			
		||||
            a = self.normalize(force=force)
 | 
			
		||||
#            print self, "normal"
 | 
			
		||||
            b = self._expand_virtual_packages()
 | 
			
		||||
@@ -927,6 +929,16 @@ def concretize(self):
 | 
			
		||||
            changed = any(changes)
 | 
			
		||||
            force=True
 | 
			
		||||
 | 
			
		||||
        # Include the compiler flag defaults from the config files
 | 
			
		||||
        # This ensures that spack will detect conflicts that stemp from a change
 | 
			
		||||
        # in default compiler flags.
 | 
			
		||||
        pkg = spack.db.get(self)
 | 
			
		||||
        for flag in pkg.compiler.flags:
 | 
			
		||||
            if self.compiler_flags[flag] == '':
 | 
			
		||||
                self.compiler_flags[flag] += pkg.compiler.flags[flag]
 | 
			
		||||
            else:
 | 
			
		||||
                self.compiler_flags[flag] += ' ' + pkg.compiler.flags[flag]
 | 
			
		||||
 | 
			
		||||
        self._concrete = True
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -1116,12 +1128,6 @@ def _merge_dependency(self, dep, visited, spec_deps, provider_index):
 | 
			
		||||
 | 
			
		||||
    def _normalize_helper(self, visited, spec_deps, provider_index):
 | 
			
		||||
        """Recursive helper function for _normalize."""
 | 
			
		||||
        print self,"self help"
 | 
			
		||||
#        print
 | 
			
		||||
#        from spack.graph import graph_ascii
 | 
			
		||||
#        graph_ascii(self)
 | 
			
		||||
#        print
 | 
			
		||||
        print spec_deps
 | 
			
		||||
        if self.name in visited:
 | 
			
		||||
            return False
 | 
			
		||||
        visited.add(self.name)
 | 
			
		||||
@@ -1186,10 +1192,6 @@ def normalize(self, force=False):
 | 
			
		||||
        visited = set()
 | 
			
		||||
        any_change = self._normalize_helper(visited, spec_deps, index)
 | 
			
		||||
 | 
			
		||||
        print self, "self norm"
 | 
			
		||||
        print spec_deps
 | 
			
		||||
        print visited
 | 
			
		||||
 | 
			
		||||
        # If there are deps specified but not visited, they're not
 | 
			
		||||
        # actually deps of this package.  Raise an error.
 | 
			
		||||
        extra = set(spec_deps.keys()).difference(visited)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user