Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Support the other style of lockfile
Browse files Browse the repository at this point in the history
  • Loading branch information
reivilibre committed Dec 28, 2022
1 parent 4644a90 commit 3b2d6e2
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions scripts-dev/check_locked_deps_have_sdists.py
Expand Up @@ -24,9 +24,16 @@ def main() -> None:
with open(lockfile_path, "rb") as lockfile:
lockfile_content = tomli.load(lockfile)

packages_to_assets: Dict[str, List[Dict[str, str]]] = lockfile_content["metadata"][
"files"
]
packages_to_assets: Dict[str, List[Dict[str, str]]]
# There seem to be two different formats for storing the list of files per package.
if lockfile_content.get("metadata", {}).get("files") is not None:
# either [metadata.files]
packages_to_assets = lockfile_content["metadata"]["files"]
else:
# or a `files` inline table in each [[package]]
packages_to_assets = {
package["name"]: package["files"] for package in lockfile_content["package"]
}

success = True

Expand All @@ -46,6 +53,11 @@ def main() -> None:
)
sys.exit(1)

print(
f"Poetry lockfile OK. {len(packages_to_assets)} locked packages checked.",
file=sys.stderr,
)


if __name__ == "__main__":
main()

0 comments on commit 3b2d6e2

Please sign in to comment.