summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2014-03-16 15:23:44 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2014-03-16 15:23:44 -0700
commit8b1c760ea32f7150f5a5fb34f36c7206983654d3 (patch)
treeba989488753e6a46c8adb8ad890ad7d63ef108e0 /lib
parentb8b334e86c9fb0ab4c7f682bccf82815d114e0a8 (diff)
downloadspack-8b1c760ea32f7150f5a5fb34f36c7206983654d3.tar.gz
spack-8b1c760ea32f7150f5a5fb34f36c7206983654d3.tar.bz2
spack-8b1c760ea32f7150f5a5fb34f36c7206983654d3.tar.xz
spack-8b1c760ea32f7150f5a5fb34f36c7206983654d3.zip
Modify create and edit to work with new package format.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/create.py8
-rw-r--r--lib/spack/spack/cmd/edit.py6
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))