Skip to content

Commit

Permalink
Bugfix: some setuptools dependencies may be missed
Browse files Browse the repository at this point in the history
Some dependencies define in a setuptools' requirements.txt file can be
missed and not mirrored if their are conditional on both an extra and
environment marker specifications.
  • Loading branch information
ido50 committed Sep 22, 2022
1 parent a6b1267 commit 0461d2a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions morgan/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def parse(
if re.fullmatch(r"[^/]+/PKG-INFO", filename):
parse_func = self._parse_metadata_file
main_metadata_file = True
elif re.fullmatch(r"[^/]+\.egg-info/(setup_)?requires.txt", filename):
elif re.fullmatch(r"[^/]+(/[^/]+)?\.egg-info/(setup_)?requires.txt", filename):
parse_func = self._parse_requirestxt
elif re.fullmatch(r"[^/]+/pyproject.toml", filename):
parse_func = self._parse_pyproject
Expand Down Expand Up @@ -175,12 +175,17 @@ def dependencies(
deps |= self.build_dependencies

for extra in self.optional_dependencies:
if extra.startswith(":"):
# this is a marker
marker = Marker(extra[1:])
if ":" in extra:
# this dependency includes a set of environment marker
# specifications
orig = extra
(extra, spec) = extra.split(":")
if extra and extra not in extras:
continue
marker = Marker(spec)
for env in envs:
if marker.evaluate(env):
deps |= self.optional_dependencies[extra]
deps |= self.optional_dependencies[orig]
break
elif extra in extras:
deps |= self.optional_dependencies[extra]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "morgan"
version = "0.11.1"
version = "0.11.2"
description = "PyPI Mirror for Offline Environments"
authors = ["Ido Perlmuter <ido@ido50.net>"]
license = "Apache License 2.0"
Expand Down

0 comments on commit 0461d2a

Please sign in to comment.