summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Scott Krafczyk <krafczyk.matthew@gmail.com>2018-04-18 17:26:14 -0500
committerAdam J. Stewart <ajstewart426@gmail.com>2018-04-18 17:26:14 -0500
commit1b38631781dd196e6d6b6e2487b6be5c07987c58 (patch)
tree250bcfcaff52e147973ec9d1b6b7144b7d638782
parentd3c1463b0aa044f6ce5313de352a314c3609a897 (diff)
downloadspack-1b38631781dd196e6d6b6e2487b6be5c07987c58.tar.gz
spack-1b38631781dd196e6d6b6e2487b6be5c07987c58.tar.bz2
spack-1b38631781dd196e6d6b6e2487b6be5c07987c58.tar.xz
spack-1b38631781dd196e6d6b6e2487b6be5c07987c58.zip
Add -d option to diy to specify source path move -j to common args (#5963)
-rw-r--r--lib/spack/spack/cmd/common/arguments.py4
-rw-r--r--lib/spack/spack/cmd/diy.py16
-rw-r--r--lib/spack/spack/cmd/install.py4
3 files changed, 20 insertions, 4 deletions
diff --git a/lib/spack/spack/cmd/common/arguments.py b/lib/spack/spack/cmd/common/arguments.py
index 59b2f4e14e..9f22d706ab 100644
--- a/lib/spack/spack/cmd/common/arguments.py
+++ b/lib/spack/spack/cmd/common/arguments.py
@@ -142,6 +142,10 @@ _arguments['very_long'] = Args(
'-L', '--very-long', action='store_true',
help='show full dependency hashes as well as versions')
+_arguments['jobs'] = Args(
+ '-j', '--jobs', action='store', type=int, dest='jobs',
+ help="explicitely set number of make jobs. default is #cpus")
+
_arguments['tags'] = Args(
'-t', '--tags', action='append',
help='filter a package query by tags')
diff --git a/lib/spack/spack/cmd/diy.py b/lib/spack/spack/cmd/diy.py
index 8da2568def..ad9ca31071 100644
--- a/lib/spack/spack/cmd/diy.py
+++ b/lib/spack/spack/cmd/diy.py
@@ -39,6 +39,10 @@ level = "long"
def setup_parser(subparser):
+ arguments.add_common_arguments(subparser, ['jobs'])
+ subparser.add_argument(
+ '-d', '--source-path', dest='source_path', default=None,
+ help="path to source directory. defaults to the current directory")
subparser.add_argument(
'-i', '--ignore-dependencies', action='store_true', dest='ignore_deps',
help="don't try to install dependencies of requested packages")
@@ -63,6 +67,10 @@ def diy(self, args):
if not args.spec:
tty.die("spack diy requires a package spec argument.")
+ if args.jobs is not None:
+ if args.jobs <= 0:
+ tty.die("the -j option must be a positive integer")
+
specs = spack.cmd.parse_specs(args.spec)
if len(specs) > 1:
tty.die("spack diy only takes one spec.")
@@ -85,13 +93,19 @@ def diy(self, args):
tty.msg("Uninstall or try adding a version suffix for this DIY build.")
sys.exit(1)
+ source_path = args.source_path
+ if source_path is None:
+ source_path = os.getcwd()
+ source_path = os.path.abspath(source_path)
+
# Forces the build to run out of the current directory.
- package.stage = DIYStage(os.getcwd())
+ package.stage = DIYStage(source_path)
# TODO: make this an argument, not a global.
spack.do_checksum = False
package.do_install(
+ make_jobs=args.jobs,
keep_prefix=args.keep_prefix,
install_deps=not args.ignore_deps,
verbose=not args.quiet,
diff --git a/lib/spack/spack/cmd/install.py b/lib/spack/spack/cmd/install.py
index bf5aa14376..a4c6e5932e 100644
--- a/lib/spack/spack/cmd/install.py
+++ b/lib/spack/spack/cmd/install.py
@@ -54,9 +54,7 @@ the default is to install the package along with all its dependencies.
alternatively one can decide to install only the package or only
the dependencies"""
)
- subparser.add_argument(
- '-j', '--jobs', action='store', type=int,
- help="explicitly set number of make jobs (default: #cpus)")
+ arguments.add_common_arguments(subparser, ['jobs'])
subparser.add_argument(
'--overwrite', action='store_true',
help="reinstall an existing spec, even if it has dependents")