orion / rpms / python3x-pip

Forked from rpms/python3x-pip 2 years ago
Clone
000643
--- /usr/bin/pip3	2018-03-29 15:22:13.000000000 +0200
000643
+++ pip3	2018-05-04 11:49:08.098821010 +0200
000643
@@ -4,7 +4,16 @@
bcedfd
 import re
bcedfd
 import sys
000643
 
000643
-from pip._internal import main
bcedfd
+try:
000643
+    from pip._internal import main
bcedfd
+except ImportError:
000643
+    # user has most probably downgraded pip in their home
000643
+    # so let them run it anyway until ~/.local/bin makes it in front of the PATH
000643
+    from pip import main
000643
+else:
000643
+    # user might also upgraded pip...
000643
+    if hasattr(main, 'main'):
000643
+        main = main.main
000643
 
bcedfd
 if __name__ == '__main__':
000643
     sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])