summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorandymwood <andrew@fluidgravity.co.uk>2022-05-16 22:59:08 +0100
committerGitHub <noreply@github.com>2022-05-16 21:59:08 +0000
commit97ec8f1d192c029a831aef2e1d30cd7a93f2c842 (patch)
treee37413e40e1f07cc2ec08fe340b488f50cce3545 /lib
parent63b6e484fca665a3e70e3b8d0d8586cb282a10bf (diff)
downloadspack-97ec8f1d192c029a831aef2e1d30cd7a93f2c842.tar.gz
spack-97ec8f1d192c029a831aef2e1d30cd7a93f2c842.tar.bz2
spack-97ec8f1d192c029a831aef2e1d30cd7a93f2c842.tar.xz
spack-97ec8f1d192c029a831aef2e1d30cd7a93f2c842.zip
Avoid calling a method on a NoneType object (#30637)
Diffstat (limited to 'lib')
-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 e82cd0b564..b66d5a5699 100644
--- a/lib/spack/spack/cmd/buildcache.py
+++ b/lib/spack/spack/cmd/buildcache.py
@@ -478,11 +478,12 @@ def save_specfile_fn(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.dag_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)