Modify create and edit to work with new package format.
This commit is contained in:
parent
b8b334e86c
commit
8b1c760ea3
@ -29,13 +29,15 @@
|
||||
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
|
||||
|
@ -27,8 +27,10 @@
|
||||
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))
|
||||
|
Loading…
Reference in New Issue
Block a user