-
Notifications
You must be signed in to change notification settings - Fork 28
Pip 6.0+ compatibility fixes #66
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,10 @@ def activate(specifier): | |
except ImportError: | ||
from pip.util import url_to_filename as url_to_path # 0.6.2 | ||
from pip.index import PackageFinder, Link | ||
from pip.log import logger | ||
try: | ||
from pip.log import logger | ||
except ImportError: | ||
from pip import logger # 6.0 | ||
from pip.req import parse_requirements | ||
|
||
|
||
|
@@ -231,6 +234,7 @@ class EmptyOptions(object): | |
""" | ||
default_vcs = None | ||
skip_requirements_regex = None | ||
isolated_mode = False | ||
|
||
|
||
def memoize(func): | ||
|
@@ -727,8 +731,18 @@ def downloaded_reqs_from_path(path, argv): | |
:arg argv: The commandline args, starting after the subcommand | ||
|
||
""" | ||
return [DownloadedReq(req, argv) for req in | ||
parse_requirements(path, options=EmptyOptions())] | ||
try: | ||
return [DownloadedReq(req, argv) for req in | ||
parse_requirements(path, options=EmptyOptions())] | ||
except TypeError: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be safer to try the import and catch the ImportError rather than catching TypeError for such a broad piece of code. We could even build a kwargs dict then, avoiding the repeated list comp. Thank you for the fix! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (I'm assuming the import succeeds if and only if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I believe you could import PipSession from pip.download before |
||
# session is a required kwarg as of pip 6.0 and will raise | ||
# a TypeError if missing. It needs to be a PipSession instance, | ||
# but in older versions we can't import it from pip.download | ||
# (nor do we need it at all) so we only import it in this except block | ||
from pip.download import PipSession | ||
return [DownloadedReq(req, argv) for req in | ||
parse_requirements(path, options=EmptyOptions(), | ||
session=PipSession())] | ||
|
||
|
||
def peep_install(argv): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought this was a typo, but then discovered they jumped from 1.5.6 to 6.0. Yay versioning!