From 97ec8f1d192c029a831aef2e1d30cd7a93f2c842 Mon Sep 17 00:00:00 2001 From: andymwood Date: Mon, 16 May 2022 22:59:08 +0100 Subject: [PATCH] Avoid calling a method on a NoneType object (#30637) --- lib/spack/spack/cmd/buildcache.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)