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

pipx upgrade on Windows prints warnings about overwriting apps #683

Closed
itsayellow opened this issue May 7, 2021 · 2 comments · Fixed by #1528
Closed

pipx upgrade on Windows prints warnings about overwriting apps #683

itsayellow opened this issue May 7, 2021 · 2 comments · Fixed by #1528
Labels
enhancement New feature or request help wanted Extra attention is needed windows

Comments

@itsayellow
Copy link
Contributor

Describe the bug

On Windows 10, when upgrading one or all packages, pipx prints warnings that it is overwriting the apps associated with the package being upgraded. As this is expected, it shouldn't warn about this.

It does this even when the package is already at the latest version.

At the very least we can notice that nothing has been upgraded and not overwrite the apps to cause the warning. At the most we could not warn about overwriting the same apps.

How to reproduce

> pipx upgrade --verbose black
pipx >(setup:717): pipx version is 0.16.2.1.1.dev0
pipx >(setup:718): Default python interpreter is 'c:\\users\\mclapp\\git\\pipx\\venv39\\scripts\\python.exe'
pipx >(run_pipx_command:168): Virtual Environment location is C:\Users\mclapp\.local\pipx\venvs\black
pipx >(needs_upgrade:69): Time since last upgrade of shared libs, in seconds: 180. Upgrade will be run by pipx if greater than 2592000.
pipx >(upgrade:91): Upgrading shared libraries in C:\Users\mclapp\.local\pipx\shared
upgrading shared libraries...
pipx >(run_subprocess:135): running C:\Users\mclapp\.local\pipx\shared\Scripts\python.exe -m pip --disable-pip-version-check install --upgrade pip setuptools wheel
pipx >(_parsed_package_to_package_or_url:128): cleaned package spec: black
upgrading black...
pipx >(run_subprocess:135): running C:\Users\mclapp\.local\pipx\venvs\black\Scripts\python.exe -m pip install --upgrade black
pipx >(run_subprocess:135): running <fetch_info_in_venv commands>
pipx >(get_venv_metadata_for_package:303): get_venv_metadata_for_package: 125ms
pipx >(_parsed_package_to_package_or_url:128): cleaned package spec: black
pipx >(_copy_package_apps:95): ⚠️  Overwriting file C:\Users\mclapp\.local\bin\black-primer.exe with C:\Users\mclapp\.local\pipx\venvs\black\Scripts\black-primer.exe
pipx >(_copy_package_apps:95): ⚠️  Overwriting file C:\Users\mclapp\.local\bin\black.exe with C:\Users\mclapp\.local\pipx\venvs\black\Scripts\black.exe
pipx >(_copy_package_apps:95): ⚠️  Overwriting file C:\Users\mclapp\.local\bin\blackd.exe with C:\Users\mclapp\.local\pipx\venvs\black\Scripts\blackd.exe
black is already at latest version 21.5b0 (location: C:\Users\mclapp\.local\pipx\venvs\black)

Expected behavior

It should match other platforms, where we simply explain that a package is upgraded or not:
macOS:

> pipx upgrade --verbose flake8
pipx >(setup:717): pipx version is 0.16.2.1
pipx >(setup:718): Default python interpreter is '/usr/local/opt/[email protected]/bin/python3.9'
pipx >(run_pipx_command:168): Virtual Environment location is /Users/mclapp/.local/pipx/venvs/flake8
pipx >(needs_upgrade:69): Time since last upgrade of shared libs, in seconds: 66. Upgrade will be run by pipx if greater than 2592000.
pipx >(upgrade:91): Upgrading shared libraries in /Users/mclapp/.local/pipx/shared
upgrading shared libraries...
pipx >(run_subprocess:135): running /Users/mclapp/.local/pipx/shared/bin/python -m pip --disable-pip-version-check install --upgrade pip setuptools wheel
pipx >(_parsed_package_to_package_or_url:128): cleaned package spec: flake8
upgrading flake8...
pipx >(run_subprocess:135): running /Users/mclapp/.local/pipx/venvs/flake8/bin/python -m pip install --upgrade flake8
pipx >(run_subprocess:135): running <fetch_info_in_venv commands>
pipx >(get_venv_metadata_for_package:303): get_venv_metadata_for_package: 62ms
pipx >(_parsed_package_to_package_or_url:128): cleaned package spec: flake8
pipx >(_symlink_package_apps:124): Same path /Users/mclapp/.local/bin/flake8 and /Users/mclapp/.local/pipx/venvs/flake8/bin/flake8
flake8 is already at latest version 3.9.1 (location:
/Users/mclapp/.local/pipx/venvs/flake8)
> pipx upgrade --verbose tox   
pipx >(setup:717): pipx version is 0.16.2.1
pipx >(setup:718): Default python interpreter is '/usr/local/opt/[email protected]/bin/python3.9'
pipx >(run_pipx_command:168): Virtual Environment location is /Users/mclapp/.local/pipx/venvs/tox
pipx >(needs_upgrade:69): Time since last upgrade of shared libs, in seconds: 4. Upgrade will be run by pipx if greater than 2592000.
pipx >(upgrade:91): Upgrading shared libraries in /Users/mclapp/.local/pipx/shared
upgrading shared libraries...
pipx >(run_subprocess:135): running /Users/mclapp/.local/pipx/shared/bin/python -m pip --disable-pip-version-check install --upgrade pip setuptools wheel
pipx >(_parsed_package_to_package_or_url:128): cleaned package spec: tox
upgrading tox...
pipx >(run_subprocess:135): running /Users/mclapp/.local/pipx/venvs/tox/bin/python -m pip install --upgrade tox
pipx >(run_subprocess:135): running <fetch_info_in_venv commands>
pipx >(get_venv_metadata_for_package:303): get_venv_metadata_for_package: 112ms
pipx >(_parsed_package_to_package_or_url:128): cleaned package spec: tox
pipx >(_symlink_package_apps:124): Same path /Users/mclapp/.local/bin/tox and /Users/mclapp/.local/pipx/venvs/tox/bin/tox
pipx >(_symlink_package_apps:124): Same path /Users/mclapp/.local/bin/tox-quickstart and /Users/mclapp/.local/pipx/venvs/tox/bin/tox-quickstart
upgraded package tox from 3.23.0 to 3.23.1 (location:
/Users/mclapp/.local/pipx/venvs/tox)
@itsayellow
Copy link
Contributor Author

One advance that would help some cases of this: emulate the Same path check that _symlink_package_apps carries out, instead on Windows checking for identical files in venv and local_bin_dir using something like filecmp.cmp()

@gaborbernat
Copy link
Contributor

PR welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed windows
Projects
None yet
3 participants