diff options
-rw-r--r-- | lib/spack/spack/cmd/create.py | 8 | ||||
-rw-r--r-- | lib/spack/spack/cmd/edit.py | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py index e8fbb46d7a..bc47b77258 100644 --- a/lib/spack/spack/cmd/create.py +++ b/lib/spack/spack/cmd/create.py @@ -29,13 +29,15 @@ import re from contextlib import closing import llnl.util.tty as tty +from llnl.util.filesystem import mkdirp import spack import spack.cmd +import spack.cmd.checksum import spack.package import spack.url +import spack.packages as packages import spack.util.crypto as crypto -import spack.cmd.checksum from spack.util.executable import which from spack.stage import Stage @@ -143,8 +145,10 @@ def create(parser, args): pkg_path = spack.db.filename_for_package_name(name) if os.path.exists(pkg_path) and not args.force: tty.die("%s already exists." % pkg_path) + else: + mkdirp(os.path.dirname(pkg_path)) - class_name = spack.db.class_name_for_package_name(name) + class_name = packages.class_name_for_package_name(name) versions = list(reversed(spack.package.find_versions_of_archive(url))) archives_to_fetch = 1 diff --git a/lib/spack/spack/cmd/edit.py b/lib/spack/spack/cmd/edit.py index 8a22567099..fd77e390ee 100644 --- a/lib/spack/spack/cmd/edit.py +++ b/lib/spack/spack/cmd/edit.py @@ -27,8 +27,10 @@ import string from contextlib import closing import llnl.util.tty as tty +from llnl.util.filesystem import mkdirp import spack +import spack.packages as packages description = "Open package files in $EDITOR" @@ -77,8 +79,8 @@ def edit(parser, args): tty.die("No package '%s'. Use spack create, or supply -f/--force " "to edit a new file." % name) else: - class_name = spack.db.class_name_for_package_name(name) - + mkdirp(os.path.dirname(path)) + class_name = packages.class_name_for_package_name(name) with closing(open(path, "w")) as pkg_file: pkg_file.write( package_template.substitute(name=name, class_name=class_name)) |