Uninstall from SPACK_PATH when shared mode is active

This commit is contained in:
Carson Woods
2019-06-27 13:05:03 -06:00
parent 0d36e94407
commit db36e66592

View File

@@ -6,6 +6,7 @@
from __future__ import print_function from __future__ import print_function
import argparse import argparse
import copy
import spack.cmd import spack.cmd
import spack.environment as ev import spack.environment as ev
@@ -14,6 +15,7 @@
import spack.cmd.common.arguments as arguments import spack.cmd.common.arguments as arguments
import spack.repo import spack.repo
import spack.store import spack.store
import spack.spec
from llnl.util import tty from llnl.util import tty
from llnl.util.tty.colify import colify from llnl.util.tty.colify import colify
@@ -74,6 +76,16 @@ def find_matching_specs(env, specs, allow_multiple_matches=False, force=False):
Return: Return:
list of specs list of specs
""" """
for spec in specs:
if isinstance(spec, spack.spec.Spec):
spec_name = str(spec)
spec_copy = (copy.deepcopy(spec))
spec_copy.concretize()
if spec_copy.package.installed_upstream:
tty.die("""{0} found upstream. Cannot be uninstalled
from this instance of spack.""".format(spec_name))
# constrain uninstall resolution to current environment if one is active # constrain uninstall resolution to current environment if one is active
hashes = env.all_hashes() if env else None hashes = env.all_hashes() if env else None
@@ -317,7 +329,7 @@ def uninstall_specs(args, specs):
anything_to_do = set(uninstall_list).union(set(remove_list)) anything_to_do = set(uninstall_list).union(set(remove_list))
if not anything_to_do: if not anything_to_do:
tty.warn('There are no package to uninstall.') tty.warn('There are no packages to uninstall.')
return return
if not args.yes_to_all: if not args.yes_to_all: