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

fix: missing git+http:// scheme support #6619

Merged
merged 3 commits into from
Aug 16, 2023
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
4 changes: 3 additions & 1 deletion src/poetry/utils/dependency_specification.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
DependencySpec = Dict[str, Union[str, bool, Dict[str, Union[str, bool]], List[str]]]
BaseSpec = TypeVar("BaseSpec", DependencySpec, InlineTable)

GIT_URL_SCHEMES = {"git+http", "git+https", "git+ssh"}


def dependency_to_specification(
dependency: Dependency, specification: BaseSpec
Expand Down Expand Up @@ -143,7 +145,7 @@ def _parse_url(self, requirement: str) -> DependencySpec | None:
if not (url_parsed.scheme and url_parsed.netloc):
return None

if url_parsed.scheme in ["git+https", "git+ssh"]:
if url_parsed.scheme in GIT_URL_SCHEMES:
return self._parse_git_url(requirement)

if url_parsed.scheme in ["http", "https"]:
Expand Down
4 changes: 4 additions & 0 deletions tests/utils/test_dependency_specification.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
@pytest.mark.parametrize(
("requirement", "expected_variants"),
[
(
"git+http://github.com/demo/demo.git",
({"git": "http://github.com/demo/demo.git", "name": "demo"},),
),
(
"git+https://github.com/demo/demo.git",
({"git": "https://github.com/demo/demo.git", "name": "demo"},),
Expand Down