Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
22 changes: 21 additions & 1 deletion metadata_please/source_checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,27 @@ def from_poetry_checkout(path: Path) -> bytes:
optional = False

if not version:
# e.g. git, path or url dependencies, skip for now
# e.g. git, path or url dependencies
if "git" in v:
git_link = f"git+{v['git']}"

# from both poetry and pypa docs, seems like only one of the following should be specified
revision = v.get("rev") or v.get("tag") or v.get("branch")
if revision:
git_link += f"@{revision}"

if "subdirectory" in v:
git_link += f"#subdirectory={v['subdirectory']}"

buf.append(f"Requires-Dist: {k} @ {git_link}\n")

# Still not sure about the PEP-508 form that these are supposed to take
# elif "path" in v:
# buf.append(f"Requires-Dist: {v['path']}\n")
#
# elif "url" in v:
# buf.append(f"Requires-Dist: {v['url']}\n")
#
continue

# https://python-poetry.org/docs/dependency-specification/#version-constraints
Expand Down
5 changes: 4 additions & 1 deletion metadata_please/tests/source_checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ def test_poetry_full(self) -> None:
c3 = "~1"
d = {version="2", python="<3.11"}
e = {version="2", markers="sys_platform == 'darwin'"}
skipped = {git = "..."}
skipped = {git = "...", tag = "12345"}
my-url-package = { url = "https://example.com/my-package-0.1.0.tar.gz" }
my-path-package = { path = "../my-package/dist/my-other-package-0.1.0.tar.gz" }
complex = {extras=["bar", "baz"], version="2"}
opt = { version = "^2.9", optional = true}
unused-extra = { version = "2", optional = true }
Expand All @@ -133,6 +135,7 @@ def test_poetry_full(self) -> None:
"c3>=1,<2",
"d==2 ; python_version < '3.11'",
"e==2 ; sys_platform == 'darwin'",
"skipped @ git+...@12345",
"complex[bar,baz]==2",
'opt>=2.9,<3.0 ; extra == "foo"',
],
Expand Down
Loading