mirror of
https://github.com/enpaul/tox-poetry-installer.git
synced 2024-12-05 01:40:44 +00:00
Add blocking functionality when using require_locked_deps
When require_locked_deps is true further processing will be blocked because a non-null value is returned by this function
This commit is contained in:
parent
a7cde7a9ab
commit
1f102b16cb
@ -5,6 +5,7 @@ specifically related to implementing the hooks (to keep the size/readability of
|
||||
themselves manageable).
|
||||
"""
|
||||
from typing import List
|
||||
from typing import Optional
|
||||
|
||||
from poetry.core.packages import Package as PoetryPackage
|
||||
from poetry.factory import Factory as PoetryFactory
|
||||
@ -51,7 +52,7 @@ def tox_addoption(parser: ToxParser):
|
||||
|
||||
|
||||
@hookimpl
|
||||
def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction):
|
||||
def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional[bool]:
|
||||
"""Install the dependencies for the current environment
|
||||
|
||||
Loads the local Poetry environment and the corresponding lockfile then pulls the dependencies
|
||||
@ -69,7 +70,7 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction):
|
||||
reporter.verbosity1(
|
||||
f"{constants.REPORTER_PREFIX} skipping isolated build env '{action.name}'"
|
||||
)
|
||||
return
|
||||
return None
|
||||
|
||||
try:
|
||||
poetry = PoetryFactory().create_poetry(venv.envconfig.config.toxinidir)
|
||||
@ -82,7 +83,7 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction):
|
||||
reporter.verbosity1(
|
||||
f"{constants.REPORTER_PREFIX} project does not use Poetry for env management, skipping installation of locked dependencies"
|
||||
)
|
||||
return
|
||||
return None
|
||||
|
||||
reporter.verbosity1(
|
||||
f"{constants.REPORTER_PREFIX} loaded project pyproject.toml from {poetry.file}"
|
||||
@ -107,16 +108,18 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction):
|
||||
reporter.verbosity1(
|
||||
f"{constants.REPORTER_PREFIX} env specifies 'skip_install = true', skipping installation of project package"
|
||||
)
|
||||
return
|
||||
return venv.envconfig.require_locked_deps or None
|
||||
|
||||
if venv.envconfig.config.skipsdist:
|
||||
reporter.verbosity1(
|
||||
f"{constants.REPORTER_PREFIX} config specifies 'skipsdist = true', skipping installation of project package"
|
||||
)
|
||||
return
|
||||
return venv.envconfig.require_locked_deps or None
|
||||
|
||||
_install_project_dependencies(venv, poetry, package_map)
|
||||
|
||||
return venv.envconfig.require_locked_deps or None
|
||||
|
||||
|
||||
def _install_env_dependencies(
|
||||
venv: ToxVirtualEnv, poetry: Poetry, packages: PackageMap
|
||||
|
Loading…
Reference in New Issue
Block a user