add --run-tests argument for install()

This commit is contained in:
Denis Davydov 2016-07-06 22:45:30 +02:00
parent 9fb8030370
commit 081918d71a
2 changed files with 18 additions and 5 deletions

View File

@ -55,6 +55,10 @@ def setup_parser(subparser):
help="Fake install. Just remove the prefix and touch a fake file in it.")
subparser.add_argument(
'packages', nargs=argparse.REMAINDER, help="specs of packages to install")
subparser.add_argument(
'--run-tests', action='store_true', dest='run_tests',
help="Run tests during installation of a package.")
def install(parser, args):
@ -77,6 +81,7 @@ def install(parser, args):
keep_stage=args.keep_stage,
ignore_deps=args.ignore_deps,
make_jobs=args.jobs,
run_tests=args.run_tests,
verbose=args.verbose,
fake=args.fake,
explicit=True)

View File

@ -311,6 +311,8 @@ class SomePackage(Package):
parallel = True
"""# jobs to use for parallel make. If set, overrides default of ncpus."""
make_jobs = None
"""By default do not run tests within package's install()"""
run_tests = False
"""Most packages are NOT extendable. Set to True if you want extensions."""
extendable = False
"""List of prefix-relative file paths (or a single path). If these do
@ -755,7 +757,7 @@ def do_fetch(self, mirror_only=False):
self.stage.check()
self.stage.cache_local()
def do_stage(self, mirror_only=False):
"""Unpacks the fetched tarball, then changes into the expanded tarball
@ -881,6 +883,7 @@ def do_install(self,
skip_patch=False,
verbose=False,
make_jobs=None,
run_tests=False,
fake=False,
explicit=False,
install_phases = install_phases):
@ -900,6 +903,7 @@ def do_install(self,
skip_patch -- Skip patch stage of build if True.
verbose -- Display verbose build output (by default, suppresses it)
make_jobs -- Number of make jobs to use for install. Default is ncpus
run_tests -- Runn tests within the package's install()
"""
if not self.spec.concrete:
raise ValueError("Can only install concrete packages.")
@ -930,7 +934,11 @@ def do_install(self,
fake=fake,
skip_patch=skip_patch,
verbose=verbose,
make_jobs=make_jobs)
make_jobs=make_jobs,
run_tests=run_tests)
# Set run_tests flag before starting build.
self.run_tests = run_tests
# Set parallelism before starting build.
self.make_jobs = make_jobs
@ -1527,15 +1535,15 @@ def install_setup(self):
raise InstallError("Package %s provides no install_setup() method!" % self.name)
def install_configure(self):
"""Runs the configure process."""
"""Runs the configure process."""
raise InstallError("Package %s provides no install_configure() method!" % self.name)
def install_build(self):
"""Runs the build process."""
"""Runs the build process."""
raise InstallError("Package %s provides no install_build() method!" % self.name)
def install_install(self):
"""Runs the install process."""
"""Runs the install process."""
raise InstallError("Package %s provides no install_install() method!" % self.name)
def install(self, spec, prefix):