Make /usr/bin/pip(3) work with user-installed pip 19.3+
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1767212 == Before: $ rpm -q python3-pip python3-pip-19.2.3-1.fc32.noarch $ /usr/bin/pip --version pip 19.2.3 from /usr/lib/python3.8/site-packages/pip (python 3.8) $ pip install --user --upgrade pip ... Successfully installed pip-19.3.1 $ /usr/bin/pip --version Traceback (most recent call last): File "/usr/bin/pip", line 15, in <module> sys.exit(main()) TypeError: 'module' object is not callable $ rm .local/ -rf $ pip install --user --upgrade 'pip<10' ... Successfully installed pip-9.0.3 $ /usr/bin/pip --version pip 9.0.3 from /home/pythonista/.local/lib/python3.8/site-packages (python 3.8) $ pip install --user --upgrade 'pip<9' ... Successfully installed pip-8.1.2 $ /usr/bin/pip --version pip 8.1.2 from /home/pythonista/.local/lib/python3.8/site-packages (python 3.8) == After $ rpm -q python3-pip python3-pip-19.2.3-2.fc32.noarch $ /usr/bin/pip --version pip 19.2.3 from /usr/lib/python3.8/site-packages/pip (python 3.8) $ pip install --user --upgrade pip ... Successfully installed pip-19.3.1 $ /usr/bin/pip --version pip 19.3.1 from /home/pythonista/.local/lib/python3.8/site-packages/pip (python 3.8) $ pip install --user --upgrade 'pip<10' ... Successfully installed pip-9.0.3 $ /usr/bin/pip --version pip 9.0.3 from /home/pythonista/.local/lib/python3.8/site-packages (python 3.8) $ pip install --user --upgrade 'pip<9' ... Successfully installed pip-8.1.2 $ /usr/bin/pip --version pip 8.1.2 from /home/pythonista/.local/lib/python3.8/site-packages (python 3.8)
This commit is contained in:
parent
add791f1d5
commit
3bced42530
2 changed files with 16 additions and 8 deletions
20
pip-allow-different-versions.patch
Normal file
20
pip-allow-different-versions.patch
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
--- /usr/bin/pip3 2018-03-29 15:22:13.000000000 +0200
|
||||
+++ pip3 2018-05-04 11:49:08.098821010 +0200
|
||||
@@ -4,7 +4,16 @@
|
||||
import re
|
||||
import sys
|
||||
|
||||
-from pip._internal import main
|
||||
+try:
|
||||
+ from pip._internal import main
|
||||
+except ImportError:
|
||||
+ # user has most probably downgraded pip in their home
|
||||
+ # so let them run it anyway until ~/.local/bin makes it in front of the PATH
|
||||
+ from pip import main
|
||||
+else:
|
||||
+ # user might also upgraded pip...
|
||||
+ if hasattr(main, 'main'):
|
||||
+ main = main.main
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
||||
Loading…
Add table
Add a link
Reference in a new issue