orion / rpms / python3x-pip

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