python-pip/pip-allow-different-versions.patch

21 lines
607 B
Diff
Raw Normal View History

--- /usr/bin/pip3 2018-03-29 15:22:13.000000000 +0200
+++ pip3 2018-05-04 11:49:08.098821010 +0200
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)
2019-10-30 23:50:36 +00:00
@@ -4,7 +4,16 @@
import re
import sys
2018-07-23 15:22:50 +00:00
-from pip._internal import main
+try:
2018-07-23 15:22:50 +00:00
+ from pip._internal import main
+except ImportError:
2018-07-23 15:22:50 +00:00
+ # 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
2018-07-23 15:22:50 +00:00
+ from pip import main
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)
2019-10-30 23:50:36 +00:00
+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])