1
0
mirror of https://github.com/fedora-python/tox-current-env.git synced 2025-11-24 11:18:59 +01:00

Make --print-deps-only and --print-deps-to-file mutually exclusive

This commit is contained in:
Miro Hrončok
2019-08-12 16:17:41 +02:00
parent 7b6ccc79cb
commit 0863536aff
2 changed files with 18 additions and 1 deletions

View File

@@ -18,7 +18,7 @@ def tox_addoption(parser):
action="store_true",
dest="print_deps_only",
default=False,
help="Don't run tests, only print the dependencies",
help="Don't run tests, only print the dependencies to stdout",
)
parser.add_argument(
"--print-deps-to-file",
@@ -33,6 +33,10 @@ def tox_addoption(parser):
@tox.hookimpl
def tox_configure(config):
"""Stores options in the config. Makes all commands external and skips sdist"""
if config.option.print_deps_only and config.option.print_deps_path:
raise tox.exception.ConfigError(
"--print-deps-only cannot be used together with --print-deps-to-file"
)
if config.option.print_deps_path is not None:
config.option.print_deps_only = True
with open(config.option.print_deps_path, "w", encoding="utf-8") as f: