uninstall : renamed --recursive to --dependents

This commit is contained in:
alalazo 2016-04-04 10:28:47 +02:00
parent 4f6320a7eb
commit 401dcb3635
2 changed files with 6 additions and 6 deletions

View file

@ -62,7 +62,7 @@ def setup_parser(subparser):
"supplied spec. i.e., if you say uninstall libelf, ALL versions of " + "supplied spec. i.e., if you say uninstall libelf, ALL versions of " +
"libelf are uninstalled. This is both useful and dangerous, like rm -r.") "libelf are uninstalled. This is both useful and dangerous, like rm -r.")
subparser.add_argument( subparser.add_argument(
'-r', '--recursive', action='store_true', dest='recursive', '-d', '--dependents', action='store_true', dest='dependents',
help='Also uninstall any packages that depend on the ones given via command line.' help='Also uninstall any packages that depend on the ones given via command line.'
) )
subparser.add_argument( subparser.add_argument(
@ -168,7 +168,7 @@ def uninstall(parser, args):
# Process dependent_list and update uninstall_list # Process dependent_list and update uninstall_list
has_error = False has_error = False
if dependent_list and not args.recursive and not args.force: if dependent_list and not args.dependents and not args.force:
for spec, lst in dependent_list.items(): for spec, lst in dependent_list.items():
tty.error("Will not uninstall %s" % spec.format("$_$@$%@$#", color=True)) tty.error("Will not uninstall %s" % spec.format("$_$@$%@$#", color=True))
print('') print('')
@ -176,7 +176,7 @@ def uninstall(parser, args):
display_specs(lst, long=True) display_specs(lst, long=True)
print('') print('')
has_error = True has_error = True
elif args.recursive: elif args.dependents:
for key, lst in dependent_list.items(): for key, lst in dependent_list.items():
uninstall_list.extend(lst) uninstall_list.extend(lst)
uninstall_list = list(set(uninstall_list)) uninstall_list = list(set(uninstall_list))

View file

@ -4,11 +4,11 @@
class MockArgs(object): class MockArgs(object):
def __init__(self, packages, all=False, force=False, recursive=False): def __init__(self, packages, all=False, force=False, dependents=False):
self.packages = packages self.packages = packages
self.all = all self.all = all
self.force = force self.force = force
self.recursive = recursive self.dependents = dependents
self.yes_to_all = True self.yes_to_all = True
@ -22,7 +22,7 @@ def test_uninstall(self):
args = MockArgs(['libelf']) args = MockArgs(['libelf'])
self.assertRaises(SystemExit, uninstall, parser, args) self.assertRaises(SystemExit, uninstall, parser, args)
# Recursive uninstall # Recursive uninstall
args = MockArgs(['callpath'], all=True, recursive=True) args = MockArgs(['callpath'], all=True, dependents=True)
uninstall(parser, args) uninstall(parser, args)
all_specs = spack.install_layout.all_specs() all_specs = spack.install_layout.all_specs()