Skip to content

Commit

Permalink
fix(installers): don't warn when overwriting its own symlink on `inst…
Browse files Browse the repository at this point in the history
…all` with cache enabled (fixes pdm-project#2502)
  • Loading branch information
noirbizarre committed Dec 17, 2023
1 parent b6d9d37 commit ce5a534
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/2502.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`pdm install` should not warn when overwriting its own symlink on `install`/`update`.
3 changes: 2 additions & 1 deletion src/pdm/installers/installers.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def _create_links_recursively(
# A package, create link for the parent dir and don't proceed
# for child directories
if os.path.exists(destination_root):
warnings.warn(f"Overwriting existing package: {destination_root}", PDMWarning, stacklevel=2)
if not os.path.islink(destination_root):
warnings.warn(f"Overwriting existing package: {destination_root}", PDMWarning, stacklevel=2)
if os.path.isdir(destination_root) and not os.path.islink(destination_root):
shutil.rmtree(destination_root)
else:
Expand Down

0 comments on commit ce5a534

Please sign in to comment.