summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandymwood <andrew@fluidgravity.co.uk>2022-05-16 22:59:08 +0100
committerMassimiliano Culpo <massimiliano.culpo@gmail.com>2022-07-14 16:47:26 +0200
commitfa0ac5f24b93f7302e44d264cc541d98eeca3592 (patch)
treeb5b74e820ceec3f5f9baf27a1a8330170d74a90b
parent5cea962e8e39c776faf5475d54b658edcbf471d1 (diff)
downloadspack-fa0ac5f24b93f7302e44d264cc541d98eeca3592.tar.gz
spack-fa0ac5f24b93f7302e44d264cc541d98eeca3592.tar.bz2
spack-fa0ac5f24b93f7302e44d264cc541d98eeca3592.tar.xz
spack-fa0ac5f24b93f7302e44d264cc541d98eeca3592.zip
Avoid calling a method on a NoneType object (#30637)
-rw-r--r--lib/spack/spack/cmd/buildcache.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/spack/spack/cmd/buildcache.py b/lib/spack/spack/cmd/buildcache.py
index 1fda884e9a..08e1af311e 100644
--- a/lib/spack/spack/cmd/buildcache.py
+++ b/lib/spack/spack/cmd/buildcache.py
@@ -754,11 +754,12 @@ def save_specfiles(args):
if args.root_specfile:
with open(args.root_specfile) as fd:
root_spec_as_json = fd.read()
+ spec_format = 'yaml' if args.root_specfile.endswith('yaml') else 'json'
else:
root_spec = Spec(args.root_spec)
root_spec.concretize()
root_spec_as_json = root_spec.to_json(hash=ht.build_hash)
- spec_format = 'yaml' if args.root_specfile.endswith('yaml') else 'json'
+ spec_format = 'json'
save_dependency_specfiles(
root_spec_as_json, args.specfile_dir, args.specs.split(), spec_format)