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,6 +103,17 @@ 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)
|
||||||
|
|
||||||
|
env = ev.active_environment()
|
||||||
|
if env:
|
||||||
|
matches = env.all_matching_specs(spec)
|
||||||
|
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:
|
if not spec.versions.concrete_range_as_version:
|
||||||
tty.die(
|
tty.die(
|
||||||
"spack dev-build spec must have a single, concrete version. "
|
"spack dev-build spec must have a single, concrete version. "
|
||||||
|
Loading…
Reference in New Issue
Block a user