Added help command and purge command.

This commit is contained in:
Todd Gamblin 2013-02-21 19:05:56 -08:00
parent 705447bdc2
commit 2a908d6a0e
12 changed files with 29 additions and 18 deletions

View file

@ -38,4 +38,4 @@ spack.verbose = args.verbose
# Try to load the particular command asked for and run it # Try to load the particular command asked for and run it
command = spack.cmd.get_command(args.command) command = spack.cmd.get_command(args.command)
command(args) command(parser, args)

View file

@ -3,23 +3,16 @@
import spack.stage as stage import spack.stage as stage
def setup_parser(subparser): def setup_parser(subparser):
subparser.add_argument('names', nargs='+', help="name(s) of package(s) to clean") subparser.add_argument('names', nargs='?', help="name(s) of package(s) to clean")
subparser.add_mutually_exclusive_group()
subparser.add_argument('-c', "--clean", action="store_true", dest='clean', subparser.add_argument('-c', "--clean", action="store_true", dest='clean',
help="run make clean in the stage directory (default)") help="run make clean in the stage directory (default)")
subparser.add_argument('-w', "--work", action="store_true", dest='work', subparser.add_argument('-w', "--work", action="store_true", dest='work',
help="delete and re-expand the entire stage directory") help="delete and re-expand the entire stage directory")
subparser.add_argument('-d', "--dist", action="store_true", dest='dist', subparser.add_argument('-d', "--dist", action="store_true", dest='dist',
help="delete the downloaded archive.") help="delete the downloaded archive.")
subparser.add_argument('-a', "--all", action="store_true", dest='purge',
help="delete the entire build staging area")
def clean(args):
if args.purge:
stage.purge()
return
def clean(parser, args):
if not args.names: if not args.names:
tty.die("spack clean requires at least one package name.") tty.die("spack clean requires at least one package name.")

View file

@ -32,7 +32,7 @@ def setup_parser(subparser):
help="Remove existing package file.") help="Remove existing package file.")
def create(args): def create(parser, args):
url = args.url url = args.url
# Try to deduce name and version of the new package from the URL # Try to deduce name and version of the new package from the URL

View file

@ -9,7 +9,7 @@ def setup_parser(subparser):
'name', nargs='?', default=None, help="name of package to edit") 'name', nargs='?', default=None, help="name of package to edit")
def edit(args): def edit(parser, args):
name = args.name name = args.name
# By default open the directory where packages live. # By default open the directory where packages live.

View file

@ -2,7 +2,10 @@
def setup_parser(subparser): def setup_parser(subparser):
subparser.add_argument('name', help="name of package to fetch") subparser.add_argument('name', help="name of package to fetch")
subparser.add_argument('-f', '--file', dest='file', default=None,
help="supply an archive file instead of fetching from the package's URL.")
def fetch(args):
def fetch(parser, args):
package = packages.get(args.name) package = packages.get(args.name)
package.do_fetch() package.do_fetch()

View file

@ -2,5 +2,5 @@
import spack.packages as packages import spack.packages as packages
def graph(args): def graph(parser, args):
packages.graph_dependencies() packages.graph_dependencies()

View file

@ -0,0 +1,11 @@
import sys
def setup_parser(subparser):
subparser.add_argument('help_command', nargs='?', default=None,
help='command to get help on')
def help(parser, args):
if args.help_command:
parser.parse_args([args.help_command, '-h'])
else:
parser.print_help()

View file

@ -9,7 +9,7 @@ def setup_parser(subparser):
subparser.add_argument('-d', '--dirty', action='store_true', dest='dirty', subparser.add_argument('-d', '--dirty', action='store_true', dest='dirty',
help="Don't clean up partially completed build/installation on error.") help="Don't clean up partially completed build/installation on error.")
def install(args): def install(parser, args):
spack.ignore_dependencies = args.ignore_dependencies spack.ignore_dependencies = args.ignore_dependencies
for name in args.names: for name in args.names:
package = packages.get(name) package = packages.get(name)

View file

@ -8,7 +8,7 @@ def setup_parser(subparser):
help='List installed packages for each platform along with versions.') help='List installed packages for each platform along with versions.')
def list(args): def list(parser, args):
if args.installed: if args.installed:
pkgs = packages.installed_packages() pkgs = packages.installed_packages()
for sys_type in pkgs: for sys_type in pkgs:

View file

@ -0,0 +1,4 @@
import spack.stage as stage
def purge(parser, args):
stage.purge()

View file

@ -3,6 +3,6 @@
def setup_parser(subparser): def setup_parser(subparser):
subparser.add_argument('name', help="name of package to stage") subparser.add_argument('name', help="name of package to stage")
def stage(args): def stage(parser, args):
package = packages.get(args.name) package = packages.get(args.name)
package.do_stage() package.do_stage()

View file

@ -5,7 +5,7 @@ def setup_parser(subparser):
subparser.add_argument('-f', '--force', action='store_true', dest='force', subparser.add_argument('-f', '--force', action='store_true', dest='force',
help="Ignore installed packages that depend on this one and remove it anyway.") help="Ignore installed packages that depend on this one and remove it anyway.")
def uninstall(args): def uninstall(parser, args):
# get packages to uninstall as a list. # get packages to uninstall as a list.
pkgs = [packages.get(name) for name in args.names] pkgs = [packages.get(name) for name in args.names]