orion / rpms / python3x-pip

Forked from rpms/python3x-pip 2 years ago
Clone
1ee682
--- /usr/bin/pip3	2019-11-12 17:37:34.793131862 +0100
1ee682
+++ pip3	2019-11-12 17:40:42.014107134 +0100
1ee682
@@ -2,7 +2,19 @@
1ee682
 # -*- coding: utf-8 -*-
875274
 import re
875274
 import sys
1ee682
-from pip._internal.main import main
875274
+try:
1ee682
+    from pip._internal.main import main
875274
+except ImportError:
1ee682
+    try:
1ee682
+        # If the user has downgraded pip, the above import will fail.
1ee682
+        # Let's try older methods of invoking it:
1ee682
+
1ee682
+        # pip 19 uses this
1ee682
+        from pip._internal import main
1ee682
+    except ImportError:
1ee682
+        # older pip versions use this
1ee682
+        from pip import main
1ee682
+
875274
 if __name__ == '__main__':
1ee682
     sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
1ee682
     sys.exit(main())