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
|
from contextlib import closing
|
||||||
|
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
|
from llnl.util.filesystem import mkdirp
|
||||||
|
|
||||||
import spack
|
import spack
|
||||||
import spack.cmd
|
import spack.cmd
|
||||||
|
import spack.cmd.checksum
|
||||||
import spack.package
|
import spack.package
|
||||||
import spack.url
|
import spack.url
|
||||||
|
import spack.packages as packages
|
||||||
import spack.util.crypto as crypto
|
import spack.util.crypto as crypto
|
||||||
import spack.cmd.checksum
|
|
||||||
|
|
||||||
from spack.util.executable import which
|
from spack.util.executable import which
|
||||||
from spack.stage import Stage
|
from spack.stage import Stage
|
||||||
@ -143,8 +145,10 @@ def create(parser, args):
|
|||||||
pkg_path = spack.db.filename_for_package_name(name)
|
pkg_path = spack.db.filename_for_package_name(name)
|
||||||
if os.path.exists(pkg_path) and not args.force:
|
if os.path.exists(pkg_path) and not args.force:
|
||||||
tty.die("%s already exists." % pkg_path)
|
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)))
|
versions = list(reversed(spack.package.find_versions_of_archive(url)))
|
||||||
|
|
||||||
archives_to_fetch = 1
|
archives_to_fetch = 1
|
||||||
|
@ -27,8 +27,10 @@
|
|||||||
from contextlib import closing
|
from contextlib import closing
|
||||||
|
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
|
from llnl.util.filesystem import mkdirp
|
||||||
|
|
||||||
import spack
|
import spack
|
||||||
|
import spack.packages as packages
|
||||||
|
|
||||||
description = "Open package files in $EDITOR"
|
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 "
|
tty.die("No package '%s'. Use spack create, or supply -f/--force "
|
||||||
"to edit a new file." % name)
|
"to edit a new file." % name)
|
||||||
else:
|
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:
|
with closing(open(path, "w")) as pkg_file:
|
||||||
pkg_file.write(
|
pkg_file.write(
|
||||||
package_template.substitute(name=name, class_name=class_name))
|
package_template.substitute(name=name, class_name=class_name))
|
||||||
|
Loading…
Reference in New Issue
Block a user