From 78bf12f1cfe0da4a6509309cfb1eadef0f58b006 Mon Sep 17 00:00:00 2001 From: Kyle Harrison Date: Thu, 15 Dec 2022 16:10:46 +0000 Subject: [PATCH] fix to handle optional dev-dependencies (#129) --- deps/pipenv/resolver.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/deps/pipenv/resolver.py b/deps/pipenv/resolver.py index 0b624a4..90314c9 100644 --- a/deps/pipenv/resolver.py +++ b/deps/pipenv/resolver.py @@ -88,12 +88,15 @@ def extract_package_versions(self, repo: str, content: str | None) -> dict: if not content: return self.versions_by_service - data = toml.loads(content) + data: dict = toml.loads(content) + poetry_sections: dict = data.get("tool", {}).get("poetry", {}) - for name, version in data["tool"]["poetry"]["dependencies"].items(): + for name, version in poetry_sections.get("dependencies", {}).items(): + version = version.replace("=", "") self._add_version_by_service(repo=repo, name=name, version=version) - for name, version in data["tool"]["poetry"]["dev-dependencies"].items(): + for name, version in poetry_sections.get("dev-dependencies", {}).items(): + version = version.replace("=", "") self._add_version_by_service(repo=repo, name=name, version=version) return self.versions_by_service