incorrect exit status when package cannot be uninstalled
- Pip version: 9.0.1 / 9.0.1-744-gcb696fce
- Python version: 3.6.4
- Operating system: Arch Linux
Description:
Add a package' source directory to PYTHONPATH, and try to uninstall it with pip, e.g.:
> git clone -q --depth 1 https://github.com/python-xlib/python-xlib.git
> (cd python-xlib && python setup.py -q egg_info)
> PYTHONPATH=python-xlib pip uninstall python-xlib; echo $?
Can't uninstall 'python-xlib'. No files were found to uninstall.
0
Duplicate issue: https://github.com/pypa/pip/issues/4737
#4737 is specifically about pip install with no arguments, although it expanded into discussion of the general case of what the exit code should be in various cases.
I'm not sure there's anything actionable from general discussions of principles. We'd be happy to consider PRs offering specific fixes - or indeed specific bug reports for individual cases such as this one.
In this case, the description is about uninstall whereas the title is about install. @benoit-pierre can I assume it's the title that's wrong? I'm happy for this to remain open as a separate issue (and indeed to look at a PR fixing it if anyone wants to provide one ;-))
Yes, uninstall!
This issue is a good starting point for anyone who wants to help out with pip's development -- it's simple and the process of fixing this should be a good introduction to pip's development workflow. See the discussion above to understand what the desired fix is.
If there is not a corresponding pull request for this issue, it is up for grabs. For directions for getting set up, see our Getting Started Guide. If you are working on this issue and have questions, feel free to ask them here.
If you've already contributed to pip, work on another issue without this label instead.
@pradyunsg, I'ld love to contribute for this fix.
Is this issue still relevant, I want to contribute @pradyunsg. If not, no worries. Cheers!!
Update: I've restarted working on this. #11520
It's still open, so I'll start working on it.
PR is created, but needs a review. @BenzhaminKim
PR is created, but needs a review. @BenzhaminKim
CI test from your PR hasn't been passed yet. You need to fix it.
https://github.com/pypa/pip/pull/10176#pullrequestreview-713376922 @uranusjr Are you sure you want to return fail exit code when it fails to uninstall with only existing packages?
> git clone -q --depth 1 https://github.com/python-xlib/python-xlib.git
> (cd python-xlib && python setup.py -q egg_info)
> PYTHONPATH=python-xlib pip uninstall python-xlib; echo $?
Can't uninstall 'python-xlib'. No files were found to uninstall.
0
It gives No files were found logs. Then it seems correct exit code if you want to return success exit code when trying to uninstall not existing packages.
Has this issue been fixed? I'd like to work on this