1
0
mirror of https://github.com/fedora-python/tox-current-env.git synced 2024-12-25 01:26:13 +01:00

Compatibility with Tox 4 beta 1

This commit is contained in:
Lumir Balhar 2022-02-07 14:24:47 +01:00 committed by Miro Hrončok
parent dadd0a954b
commit 14fd3c24c2

View File

@ -59,8 +59,8 @@ def tox_add_option(parser):
@impl @impl
def tox_add_core_config(core_conf, config): def tox_add_core_config(core_conf, state):
opt = config.options opt = state.conf.options
if opt.current_env or opt.print_deps_to or opt.print_extras_to: if opt.current_env or opt.print_deps_to or opt.print_extras_to:
# We do not want to install the main package. # We do not want to install the main package.
@ -89,17 +89,18 @@ def tox_add_core_config(core_conf, config):
@impl @impl
def tox_add_env_config(env_conf, config): def tox_add_env_config(env_conf, state):
opt = state.conf.options
# This allows all external commands. # This allows all external commands.
# All of them are extenal for us. # All of them are extenal for us.
# passenv is here because `TOX_TESTENV_PASSENV` # passenv is here because `TOX_TESTENV_PASSENV`
# no longer works in tox 4. # no longer works in tox 4.
if config.options.current_env: if opt.current_env:
allow_external_cmds = MemoryLoader(allowlist_externals=["*"], passenv=["*"]) allow_external_cmds = MemoryLoader(allowlist_externals=["*"], passenv=["*"])
env_conf.loaders.insert(0, allow_external_cmds) 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 so the tox does nothing. # list of commands so the tox does nothing.
if config.options.print_deps_to or config.options.print_extras_to: if opt.print_deps_to or opt.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)