python-pip/pip-allow-different-versions.patch
Miro Hrončok f994ff1cc7 Update to 20.0.2
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1793456

The main() wrapper moved the import path again, this time with compatibility shim:

 - we still need pip-allow-different-versions.patch to support older pips installed by users
 - we dropped callable-main.patch - the shim is provided by pip for all previous paths
 - no need to patch older pips to support user installed pip 20+
 - no need to patch Pythons (or virtualenv) to support pip 20+ wheel in ensurepip
2020-03-04 12:47:38 +01:00

28 lines
809 B
Diff

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