Merge pull request #16 from enpaul/enp/fix

Fix support for extras installation
This commit is contained in:
Ethan Paul 2020-10-24 11:55:35 -04:00 committed by GitHub
commit ed039de674
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "tox-poetry-installer" name = "tox-poetry-installer"
version = "0.3.0" version = "0.3.1"
license = "MIT" license = "MIT"
authors = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"] authors = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
description = "Tox plugin to install Tox environment dependencies using the Poetry backend and lockfile" description = "Tox plugin to install Tox environment dependencies using the Poetry backend and lockfile"

View File

@ -45,7 +45,7 @@ from tox.venv import VirtualEnv as ToxVirtualEnv
__title__ = "tox-poetry-installer" __title__ = "tox-poetry-installer"
__summary__ = "Tox plugin to install Tox environment dependencies using the Poetry backend and lockfile" __summary__ = "Tox plugin to install Tox environment dependencies using the Poetry backend and lockfile"
__version__ = "0.3.0" __version__ = "0.3.1"
__url__ = "https://github.com/enpaul/tox-poetry-installer/" __url__ = "https://github.com/enpaul/tox-poetry-installer/"
__license__ = "MIT" __license__ = "MIT"
__authors__ = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"] __authors__ = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
@ -233,7 +233,7 @@ def _install_env_dependencies(
raise err raise err
reporter.verbosity1( reporter.verbosity1(
f"{_REPORTER_PREFIX} identified {len(dependencies)} total dependencies from {len(venv.envconfig.deps)} env dependencies" f"{_REPORTER_PREFIX} identified {len(dependencies)} total dependencies from {len(env_deps.locked_deps)} locked env dependencies"
) )
reporter.verbosity1( reporter.verbosity1(
@ -262,13 +262,16 @@ def _install_project_dependencies(
f"{_REPORTER_PREFIX} performing installation of project dependencies" f"{_REPORTER_PREFIX} performing installation of project dependencies"
) )
base_dependencies = [ base_dependencies: List[PoetryPackage] = [
packages[item.name] for item in poetry.package.requires if not item.is_optional packages[item.name]
for item in poetry.package.requires
if not item.is_optional()
] ]
extra_dependencies: List[PoetryPackage] = []
for extra in venv.envconfig.extras: for extra in venv.envconfig.extras:
try: try:
extra_dependencies = [ extra_dependencies += [
packages[item.name] for item in poetry.package.extras[extra] packages[item.name] for item in poetry.package.extras[extra]
] ]
except KeyError: except KeyError: