Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poetry: support for poetry metadata format 2.0 #353

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions poetry/flatpak-poetry-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ def get_module_sources(parsed_lockfile: dict, include_devel: bool = True) -> lis
or package["category"] == "main"
and not package["optional"]
):
hashes = []
# Check for old metadata format (poetry version < 1.0.0b2)
if "hashes" in parsed_lockfile["metadata"]:
hashes = parsed_lockfile["metadata"]["hashes"][package["name"]]
# Else new metadata format
else:
hashes = []
# metadata format 1.1
elif "files" in parsed_lockfile["metadata"]:
for package_name in parsed_lockfile["metadata"]["files"]:
if package_name == package["name"]:
package_files = parsed_lockfile["metadata"]["files"][
Expand All @@ -86,6 +86,12 @@ def get_module_sources(parsed_lockfile: dict, include_devel: bool = True) -> lis
match = hash_re.search(package_files[num]["hash"])
if match:
hashes.append(match.group(2))
# metadata format 2.0
else:
for file in package["files"]:
match = hash_re.search(file["hash"])
if match:
hashes.append(match.group(2))
url, hash = get_pypi_source(
package["name"], package["version"], hashes
)
Expand Down