diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 16051524509..e29e3b2f85b 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -4333,7 +4333,7 @@ def write_attribute(spec, attribute, color): if callable(current): raise SpecFormatStringError("Attempted to format callable object") - if not current: + if current is None: # We're not printing anything return diff --git a/lib/spack/spack/test/spec_semantics.py b/lib/spack/spack/test/spec_semantics.py index bd752612223..1a6a08b41ed 100644 --- a/lib/spack/spack/test/spec_semantics.py +++ b/lib/spack/spack/test/spec_semantics.py @@ -660,6 +660,7 @@ def test_spec_formatting(self, default_mock_concretization): ("{architecture.os}", "", "os", lambda spec: spec.architecture), ("{architecture.target}", "", "target", lambda spec: spec.architecture), ("{prefix}", "", "prefix", lambda spec: spec), + ("{external}", "", "external", lambda spec: spec), # test we print "False" ] hash_segments = [