orion / rpms / python3x-pip

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