Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fwd/bwd compatibility around pip 19.3 #594

Open
wants to merge 1 commit into
base: master
from

Conversation

@mcarilli
Copy link
Contributor

@mcarilli mcarilli commented Nov 7, 2019

Fixes #548 (comment).

@mkolod @adityaiitb as original authors of Pyprof, what do you guys think?

@mcarilli mcarilli mentioned this pull request Nov 7, 2019
@adityaiitb
Copy link
Contributor

@adityaiitb adityaiitb commented Nov 7, 2019

LGTM.

@@ -32,6 +31,10 @@
ext_modules = []

if "--pyprof" in sys.argv:
try:
from pip._internal import main as pipmain

This comment has been minimized.

@ptrblck

ptrblck Dec 13, 2019
Collaborator

19.3.1 will be able to import it without an ImportError, so we need to call pipmain and catch the TypeError instead.

This comment has been minimized.

@ptrblck

ptrblck Dec 13, 2019
Collaborator

This should work:

if "--pyprof" in sys.argv:
    try:
        from pip._internal import main as pipmain
        pipmain() # dummy call to raise the TypeError for pip >= 19.
    except TypeError:
        from pip._internal.main import main as pipmain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants
You can’t perform that action at this time.