Skip to content

Commit

Permalink
dont fail on wheels without Requires-Dist lines
Browse files Browse the repository at this point in the history
  • Loading branch information
DBS-ST-VIT authored and Karl Friede committed May 28, 2024
1 parent a525c9f commit c1e6477
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/poetry_plugin_freeze/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,15 @@ def get_frozen_deps(self, dep_packages, exclude_packages=None):

def replace_deps(self, dist_meta, dep_lines):
start_pos = 0
for m in dist_meta.get_all("Requires-Dist"):
if not start_pos:
start_pos = dist_meta._headers.index(("Requires-Dist", m))
dist_meta._headers.remove(("Requires-Dist", m))

for idx, h in enumerate(dep_lines):
dist_meta._headers.insert(start_pos + idx, ("Requires-Dist", h))
requires_dist = dist_meta.get_all("Requires-Dist")
if requires_dist:
for m in requires_dist:
if not start_pos:
start_pos = dist_meta._headers.index(("Requires-Dist", m))
dist_meta._headers.remove(("Requires-Dist", m))

for idx, h in enumerate(dep_lines):
dist_meta._headers.insert(start_pos + idx, ("Requires-Dist", h))

return dist_meta

Expand Down

0 comments on commit c1e6477

Please sign in to comment.