orion / rpms / python3x-pip

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