Skip to content

Commit

Permalink
avoid unwanted work during install (#8986)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby committed Feb 18, 2024
1 parent e015ee5 commit 0eedea4
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/poetry/installation/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,17 +855,18 @@ def _save_url_reference(self, operation: Operation) -> None:
package = operation.package

if not package.source_url or package.source_type == "legacy":
# Since we are installing from our own distribution cache
# pip will write a `direct_url.json` file pointing to the cache
# distribution.
# That's not what we want, so we remove the direct_url.json file,
# if it exists.
for (
direct_url_json
) in self._env.site_packages.find_distribution_direct_url_json_files(
distribution_name=package.name, writable_only=True
):
direct_url_json.unlink(missing_ok=True)
if not self._use_modern_installation:
# Since we are installing from our own distribution cache pip will write
# a `direct_url.json` file pointing to the cache distribution.
#
# That's not what we want, so we remove the direct_url.json file, if it
# exists.
for (
direct_url_json
) in self._env.site_packages.find_distribution_direct_url_json_files(
distribution_name=package.name, writable_only=True
):
direct_url_json.unlink(missing_ok=True)
return

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

0 comments on commit 0eedea4

Please sign in to comment.