mirror of
https://github.com/fedora-python/tox-current-env.git
synced 2025-01-26 22:56:15 +01:00
Some more default options
This commit is contained in:
parent
799e5ddda2
commit
c5281c6243
@ -55,34 +55,45 @@ def tox_add_option(parser):
|
|||||||
|
|
||||||
@impl
|
@impl
|
||||||
def tox_add_core_config(core_conf, config):
|
def tox_add_core_config(core_conf, config):
|
||||||
if config.options.current_env:
|
opt = config.options
|
||||||
config.options.default_runner = "current-env"
|
|
||||||
|
if opt.current_env or opt.print_deps_to or opt.print_extras_to:
|
||||||
|
# We do not want to install the main package.
|
||||||
|
# no_package is the same as skipsdist.
|
||||||
|
loader = MemoryLoader(no_package=True)
|
||||||
|
core_conf.loaders.insert(0, loader)
|
||||||
|
|
||||||
|
if opt.current_env:
|
||||||
|
opt.default_runner = "current-env"
|
||||||
return
|
return
|
||||||
|
|
||||||
if getattr(config.options.print_deps_to, "name", object()) == getattr(
|
if getattr(opt.print_deps_to, "name", object()) == getattr(
|
||||||
config.options.print_extras_to, "name", object()
|
opt.print_extras_to, "name", object()
|
||||||
):
|
):
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"The paths given to --print-deps-to and --print-extras-to cannot be identical."
|
"The paths given to --print-deps-to and --print-extras-to cannot be identical."
|
||||||
)
|
)
|
||||||
|
|
||||||
if config.options.print_deps_to or config.options.print_extras_to:
|
if opt.print_deps_to or opt.print_extras_to:
|
||||||
config.options.default_runner = "print-env"
|
opt.default_runner = "print-env"
|
||||||
return
|
return
|
||||||
|
|
||||||
# No options used - switch back to the standard runner
|
# No options used - switch back to the standard runner
|
||||||
# Workaround for: https://github.com/tox-dev/tox/issues/2264
|
# Workaround for: https://github.com/tox-dev/tox/issues/2264
|
||||||
config.options.default_runner = "virtualenv"
|
opt.default_runner = "virtualenv"
|
||||||
|
|
||||||
|
|
||||||
@impl
|
@impl
|
||||||
def tox_add_env_config(env_conf, config):
|
def tox_add_env_config(env_conf, config):
|
||||||
# This allows all external commands.
|
# This allows all external commands.
|
||||||
# All of them are extenal for us.
|
# All of them are extenal for us.
|
||||||
allow_external_cmds = MemoryLoader(allowlist_externals=["*"])
|
# passenv is here because `TOX_TESTENV_PASSENV`
|
||||||
config.core.loaders.insert(0, allow_external_cmds)
|
# no longer works in tox 4.
|
||||||
|
if config.options.current_env:
|
||||||
|
allow_external_cmds = MemoryLoader(allowlist_externals=["*"], passenv=["*"])
|
||||||
|
env_conf.loaders.insert(0, allow_external_cmds)
|
||||||
# For print-deps-to and print-extras-to, use empty
|
# For print-deps-to and print-extras-to, use empty
|
||||||
# list of commands.
|
# list of commands so the tox does nothing.
|
||||||
if config.options.print_deps_to or config.options.print_extras_to:
|
if config.options.print_deps_to or config.options.print_extras_to:
|
||||||
empty_commands = MemoryLoader(commands=[])
|
empty_commands = MemoryLoader(commands=[])
|
||||||
env_conf.loaders.insert(0, empty_commands)
|
env_conf.loaders.insert(0, empty_commands)
|
||||||
|
Loading…
Reference in New Issue
Block a user