concretizer: pull _develop_specs_from_env out of main setup loop

This commit is contained in:
Todd Gamblin 2020-12-13 17:20:47 -08:00 committed by Tamara Dahlgren
parent d0dfd3cb82
commit ea617f807f

View File

@ -1413,6 +1413,13 @@ def setup(self, driver, specs, tests=False):
self.preferred_targets(pkg) self.preferred_targets(pkg)
self.preferred_versions(pkg) self.preferred_versions(pkg)
# Inject dev_path from environment
env = spack.environment.get_env(None, None)
if env:
for spec in sorted(specs):
for dep in spec.traverse():
_develop_specs_from_env(dep, env)
self.gen.h1('Spec Constraints') self.gen.h1('Spec Constraints')
for spec in sorted(specs): for spec in sorted(specs):
if not spec.virtual: if not spec.virtual:
@ -1422,10 +1429,6 @@ def setup(self, driver, specs, tests=False):
for dep in spec.traverse(): for dep in spec.traverse():
self.gen.h2('Spec: %s' % str(dep)) self.gen.h2('Spec: %s' % str(dep))
# Inject dev_path from environment
_develop_specs_from_env(dep)
if dep.virtual: if dep.virtual:
for clause in self.virtual_spec_clauses(dep): for clause in self.virtual_spec_clauses(dep):
self.gen.fact(clause) self.gen.fact(clause)
@ -1637,8 +1640,9 @@ def build_specs(self, function_tuples):
for s in self._specs.values(): for s in self._specs.values():
spack.spec.Spec.ensure_external_path_if_external(s) spack.spec.Spec.ensure_external_path_if_external(s)
env = spack.environment.get_env(None, None)
for s in self._specs.values(): for s in self._specs.values():
_develop_specs_from_env(s) _develop_specs_from_env(s, env)
for s in self._specs.values(): for s in self._specs.values():
s._mark_concrete() s._mark_concrete()
@ -1649,8 +1653,7 @@ def build_specs(self, function_tuples):
return self._specs return self._specs
def _develop_specs_from_env(spec): def _develop_specs_from_env(spec, env):
env = spack.environment.get_env(None, None)
dev_info = env.dev_specs.get(spec.name, {}) if env else {} dev_info = env.dev_specs.get(spec.name, {}) if env else {}
if not dev_info: if not dev_info:
return return