summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/spack2
-rw-r--r--lib/spack/spack/cmd/clean.py11
-rw-r--r--lib/spack/spack/cmd/create.py2
-rw-r--r--lib/spack/spack/cmd/edit.py2
-rw-r--r--lib/spack/spack/cmd/fetch.py5
-rw-r--r--lib/spack/spack/cmd/graph.py2
-rw-r--r--lib/spack/spack/cmd/help.py11
-rw-r--r--lib/spack/spack/cmd/install.py2
-rw-r--r--lib/spack/spack/cmd/list.py2
-rw-r--r--lib/spack/spack/cmd/purge.py4
-rw-r--r--lib/spack/spack/cmd/stage.py2
-rw-r--r--lib/spack/spack/cmd/uninstall.py2
12 files changed, 29 insertions, 18 deletions
diff --git a/bin/spack b/bin/spack
index 3cb3c7f423..53b4cf3dac 100755
--- a/bin/spack
+++ b/bin/spack
@@ -38,4 +38,4 @@ spack.verbose = args.verbose
# Try to load the particular command asked for and run it
command = spack.cmd.get_command(args.command)
-command(args)
+command(parser, args)
diff --git a/lib/spack/spack/cmd/clean.py b/lib/spack/spack/cmd/clean.py
index ac3147fe12..921ac2d4bd 100644
--- a/lib/spack/spack/cmd/clean.py
+++ b/lib/spack/spack/cmd/clean.py
@@ -3,23 +3,16 @@ import spack.tty as tty
import spack.stage as stage
def setup_parser(subparser):
- subparser.add_argument('names', nargs='+', help="name(s) of package(s) to clean")
-
- subparser.add_mutually_exclusive_group()
+ subparser.add_argument('names', nargs='?', help="name(s) of package(s) to clean")
subparser.add_argument('-c', "--clean", action="store_true", dest='clean',
help="run make clean in the stage directory (default)")
subparser.add_argument('-w', "--work", action="store_true", dest='work',
help="delete and re-expand the entire stage directory")
subparser.add_argument('-d', "--dist", action="store_true", dest='dist',
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:
tty.die("spack clean requires at least one package name.")
diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py
index 13fc713acf..0997c4a53f 100644
--- a/lib/spack/spack/cmd/create.py
+++ b/lib/spack/spack/cmd/create.py
@@ -32,7 +32,7 @@ def setup_parser(subparser):
help="Remove existing package file.")
-def create(args):
+def create(parser, args):
url = args.url
# Try to deduce name and version of the new package from the URL
diff --git a/lib/spack/spack/cmd/edit.py b/lib/spack/spack/cmd/edit.py
index 13ebd9b073..aa279ca295 100644
--- a/lib/spack/spack/cmd/edit.py
+++ b/lib/spack/spack/cmd/edit.py
@@ -9,7 +9,7 @@ def setup_parser(subparser):
'name', nargs='?', default=None, help="name of package to edit")
-def edit(args):
+def edit(parser, args):
name = args.name
# By default open the directory where packages live.
diff --git a/lib/spack/spack/cmd/fetch.py b/lib/spack/spack/cmd/fetch.py
index 310ad343cc..c53fce6f6f 100644
--- a/lib/spack/spack/cmd/fetch.py
+++ b/lib/spack/spack/cmd/fetch.py
@@ -2,7 +2,10 @@ import spack.packages as packages
def setup_parser(subparser):
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.do_fetch()
diff --git a/lib/spack/spack/cmd/graph.py b/lib/spack/spack/cmd/graph.py
index 2796d07f35..3c16a825a7 100644
--- a/lib/spack/spack/cmd/graph.py
+++ b/lib/spack/spack/cmd/graph.py
@@ -2,5 +2,5 @@ import spack
import spack.packages as packages
-def graph(args):
+def graph(parser, args):
packages.graph_dependencies()
diff --git a/lib/spack/spack/cmd/help.py b/lib/spack/spack/cmd/help.py
new file mode 100644
index 0000000000..a2b61a2bc9
--- /dev/null
+++ b/lib/spack/spack/cmd/help.py
@@ -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()
diff --git a/lib/spack/spack/cmd/install.py b/lib/spack/spack/cmd/install.py
index 2b1c032fea..14bae90147 100644
--- a/lib/spack/spack/cmd/install.py
+++ b/lib/spack/spack/cmd/install.py
@@ -9,7 +9,7 @@ def setup_parser(subparser):
subparser.add_argument('-d', '--dirty', action='store_true', dest='dirty',
help="Don't clean up partially completed build/installation on error.")
-def install(args):
+def install(parser, args):
spack.ignore_dependencies = args.ignore_dependencies
for name in args.names:
package = packages.get(name)
diff --git a/lib/spack/spack/cmd/list.py b/lib/spack/spack/cmd/list.py
index dcba730c28..2746946ddf 100644
--- a/lib/spack/spack/cmd/list.py
+++ b/lib/spack/spack/cmd/list.py
@@ -8,7 +8,7 @@ def setup_parser(subparser):
help='List installed packages for each platform along with versions.')
-def list(args):
+def list(parser, args):
if args.installed:
pkgs = packages.installed_packages()
for sys_type in pkgs:
diff --git a/lib/spack/spack/cmd/purge.py b/lib/spack/spack/cmd/purge.py
new file mode 100644
index 0000000000..99f1b98c23
--- /dev/null
+++ b/lib/spack/spack/cmd/purge.py
@@ -0,0 +1,4 @@
+import spack.stage as stage
+
+def purge(parser, args):
+ stage.purge()
diff --git a/lib/spack/spack/cmd/stage.py b/lib/spack/spack/cmd/stage.py
index 329ac945c7..0d7ba23d4b 100644
--- a/lib/spack/spack/cmd/stage.py
+++ b/lib/spack/spack/cmd/stage.py
@@ -3,6 +3,6 @@ import spack.packages as packages
def setup_parser(subparser):
subparser.add_argument('name', help="name of package to stage")
-def stage(args):
+def stage(parser, args):
package = packages.get(args.name)
package.do_stage()
diff --git a/lib/spack/spack/cmd/uninstall.py b/lib/spack/spack/cmd/uninstall.py
index 8b69c437b7..96b3c45bc5 100644
--- a/lib/spack/spack/cmd/uninstall.py
+++ b/lib/spack/spack/cmd/uninstall.py
@@ -5,7 +5,7 @@ def setup_parser(subparser):
subparser.add_argument('-f', '--force', action='store_true', dest='force',
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.
pkgs = [packages.get(name) for name in args.names]