Skip to content

Commit

Permalink
installer: fix content of direct_url.json for editable installs fro…
Browse files Browse the repository at this point in the history
…m git (#7473)
  • Loading branch information
radoering committed Apr 9, 2023
1 parent fd706c8 commit d5f83ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
9 changes: 5 additions & 4 deletions src/poetry/installation/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,8 @@ def _prepare_git_archive(self, operation: Install | Update) -> Path:
)

archive = self._prepare_archive(operation, output_dir=output_dir)
package._source_url = original_url
if not package.develop:
package._source_url = original_url

if output_dir is not None and output_dir.is_dir():
# Mark directories with cached git packages, to distinguish from
Expand Down Expand Up @@ -893,12 +894,12 @@ def _save_url_reference(self, operation: Operation) -> None:

url_reference: dict[str, Any] | None = None

if package.source_type == "git":
if package.source_type == "git" and not package.develop:
url_reference = self._create_git_url_reference(package)
elif package.source_type in ("directory", "git"):
url_reference = self._create_directory_url_reference(package)
elif package.source_type == "url":
url_reference = self._create_url_url_reference(package)
elif package.source_type == "directory":
url_reference = self._create_directory_url_reference(package)
elif package.source_type == "file":
url_reference = self._create_file_url_reference(package)

Expand Down
8 changes: 2 additions & 6 deletions tests/installation/test_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1058,12 +1058,8 @@ def test_executor_should_write_pep610_url_references_for_editable_git(
tmp_venv,
package,
{
"vcs_info": {
"vcs": "git",
"requested_revision": "master",
"commit_id": "123456",
},
"url": package.source_url,
"dir_info": {"editable": True},
"url": Path(package.source_url).as_uri(),
},
)

Expand Down

0 comments on commit d5f83ff

Please sign in to comment.