Add -d option to diy to specify source path move -j to common args (#5963)
This commit is contained in:
parent
d3c1463b0a
commit
1b38631781
3 changed files with 20 additions and 4 deletions
|
@ -142,6 +142,10 @@ def __call__(self, parser, namespace, values, option_string=None):
|
||||||
'-L', '--very-long', action='store_true',
|
'-L', '--very-long', action='store_true',
|
||||||
help='show full dependency hashes as well as versions')
|
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(
|
_arguments['tags'] = Args(
|
||||||
'-t', '--tags', action='append',
|
'-t', '--tags', action='append',
|
||||||
help='filter a package query by tags')
|
help='filter a package query by tags')
|
||||||
|
|
|
@ -39,6 +39,10 @@
|
||||||
|
|
||||||
|
|
||||||
def setup_parser(subparser):
|
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(
|
subparser.add_argument(
|
||||||
'-i', '--ignore-dependencies', action='store_true', dest='ignore_deps',
|
'-i', '--ignore-dependencies', action='store_true', dest='ignore_deps',
|
||||||
help="don't try to install dependencies of requested packages")
|
help="don't try to install dependencies of requested packages")
|
||||||
|
@ -63,6 +67,10 @@ def diy(self, args):
|
||||||
if not args.spec:
|
if not args.spec:
|
||||||
tty.die("spack diy requires a package spec argument.")
|
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)
|
specs = spack.cmd.parse_specs(args.spec)
|
||||||
if len(specs) > 1:
|
if len(specs) > 1:
|
||||||
tty.die("spack diy only takes one spec.")
|
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.")
|
tty.msg("Uninstall or try adding a version suffix for this DIY build.")
|
||||||
sys.exit(1)
|
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.
|
# 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.
|
# TODO: make this an argument, not a global.
|
||||||
spack.do_checksum = False
|
spack.do_checksum = False
|
||||||
|
|
||||||
package.do_install(
|
package.do_install(
|
||||||
|
make_jobs=args.jobs,
|
||||||
keep_prefix=args.keep_prefix,
|
keep_prefix=args.keep_prefix,
|
||||||
install_deps=not args.ignore_deps,
|
install_deps=not args.ignore_deps,
|
||||||
verbose=not args.quiet,
|
verbose=not args.quiet,
|
||||||
|
|
|
@ -54,9 +54,7 @@ def setup_parser(subparser):
|
||||||
alternatively one can decide to install only the package or only
|
alternatively one can decide to install only the package or only
|
||||||
the dependencies"""
|
the dependencies"""
|
||||||
)
|
)
|
||||||
subparser.add_argument(
|
arguments.add_common_arguments(subparser, ['jobs'])
|
||||||
'-j', '--jobs', action='store', type=int,
|
|
||||||
help="explicitly set number of make jobs (default: #cpus)")
|
|
||||||
subparser.add_argument(
|
subparser.add_argument(
|
||||||
'--overwrite', action='store_true',
|
'--overwrite', action='store_true',
|
||||||
help="reinstall an existing spec, even if it has dependents")
|
help="reinstall an existing spec, even if it has dependents")
|
||||||
|
|
Loading…
Reference in a new issue