concretize: fix UnboundLocalError due to import within a function (#16809)
This commit is contained in:
parent
dc59fc7ab8
commit
e2f5f668a9
@ -2134,6 +2134,8 @@ def concretize(self, tests=False):
|
||||
consistent with requirements of its packages. See flatten() and
|
||||
normalize() for more details on this.
|
||||
"""
|
||||
import spack.concretize
|
||||
|
||||
if not self.name:
|
||||
raise spack.error.SpecError(
|
||||
"Attempting to concretize anonymous spec")
|
||||
@ -2145,7 +2147,6 @@ def concretize(self, tests=False):
|
||||
force = False
|
||||
|
||||
user_spec_deps = self.flat_dependencies(copy=False)
|
||||
import spack.concretize
|
||||
concretizer = spack.concretize.Concretizer(self.copy())
|
||||
while changed:
|
||||
changes = (self.normalize(force, tests=tests,
|
||||
|
@ -633,3 +633,8 @@ def test_compiler_version_matches_any_entry_in_compilers_yaml(self):
|
||||
s = Spec('mpileaks %gcc@4.5:')
|
||||
s.concretize()
|
||||
assert str(s.compiler.version) == '4.5.0'
|
||||
|
||||
def test_concretize_anonymous(self):
|
||||
with pytest.raises(spack.error.SpecError):
|
||||
s = Spec('+variant')
|
||||
s.concretize()
|
||||
|
Loading…
Reference in New Issue
Block a user