Make dev-build compatible with spack develop
This commit is contained in:
parent
43a9c6cb66
commit
259a1d9268
@ -12,6 +12,7 @@
|
|||||||
import spack.cmd
|
import spack.cmd
|
||||||
import spack.cmd.common.arguments
|
import spack.cmd.common.arguments
|
||||||
import spack.config
|
import spack.config
|
||||||
|
import spack.environment as ev
|
||||||
import spack.repo
|
import spack.repo
|
||||||
from spack.cmd.common import arguments
|
from spack.cmd.common import arguments
|
||||||
from spack.installer import PackageInstaller
|
from spack.installer import PackageInstaller
|
||||||
@ -102,29 +103,40 @@ def dev_build(self, args):
|
|||||||
if not spack.repo.PATH.exists(spec.name):
|
if not spack.repo.PATH.exists(spec.name):
|
||||||
raise spack.repo.UnknownPackageError(spec.name)
|
raise spack.repo.UnknownPackageError(spec.name)
|
||||||
|
|
||||||
if not spec.versions.concrete_range_as_version:
|
env = ev.active_environment()
|
||||||
tty.die(
|
if env:
|
||||||
"spack dev-build spec must have a single, concrete version. "
|
matches = env.all_matching_specs(spec)
|
||||||
"Did you forget a package version number?"
|
dev_matches = [m for m in matches if m.is_develop]
|
||||||
)
|
if len(dev_matches) > 1:
|
||||||
|
tty.die("Too many matching develop specs in the active environment")
|
||||||
|
elif len(dev_matches) < 1:
|
||||||
|
tty.die("No matching develop specs found in the active environment")
|
||||||
|
else:
|
||||||
|
spec = dev_matches[0]
|
||||||
|
else:
|
||||||
|
if not spec.versions.concrete_range_as_version:
|
||||||
|
tty.die(
|
||||||
|
"spack dev-build spec must have a single, concrete version. "
|
||||||
|
"Did you forget a package version number?"
|
||||||
|
)
|
||||||
|
|
||||||
source_path = args.source_path
|
source_path = args.source_path
|
||||||
if source_path is None:
|
if source_path is None:
|
||||||
source_path = os.getcwd()
|
source_path = os.getcwd()
|
||||||
source_path = os.path.abspath(source_path)
|
source_path = os.path.abspath(source_path)
|
||||||
|
|
||||||
# Forces the build to run out of the source directory.
|
# Forces the build to run out of the source directory.
|
||||||
spec.constrain("dev_path=%s" % source_path)
|
spec.constrain("dev_path=%s" % source_path)
|
||||||
spec.concretize()
|
spec.concretize()
|
||||||
|
|
||||||
if spec.installed:
|
if spec.installed:
|
||||||
tty.error("Already installed in %s" % spec.prefix)
|
tty.error("Already installed in %s" % spec.prefix)
|
||||||
tty.msg("Uninstall or try adding a version suffix for this dev build.")
|
tty.msg("Uninstall or try adding a version suffix for this dev build.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# disable checksumming if requested
|
# disable checksumming if requested
|
||||||
if args.no_checksum:
|
if args.no_checksum:
|
||||||
spack.config.set("config:checksum", False, scope="command_line")
|
spack.config.set("config:checksum", False, scope="command_line")
|
||||||
|
|
||||||
tests = False
|
tests = False
|
||||||
if args.test == "all":
|
if args.test == "all":
|
||||||
|
Loading…
Reference in New Issue
Block a user