Skip to content

Commit

Permalink
fix: missing git+http:// scheme support (#6619)
Browse files Browse the repository at this point in the history
Co-authored-by: Bartek Sokorski <b.sokorski@gmail.com>
  • Loading branch information
moriyoshi and Secrus authored Aug 16, 2023
1 parent c9292de commit 5fe3a91
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
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

0 comments on commit 5fe3a91

Please sign in to comment.