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

Fix compatibility with pip master (pip>=20.0) #953

Merged
merged 2 commits into from
Oct 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions piptools/_compat/pip_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def do_import(module_path, subimport=None, old_path=None):
FAVORITE_HASH = do_import("utils.hashes", "FAVORITE_HASH")
path_to_url = do_import("utils.urls", "path_to_url", old_path="download")
url_to_path = do_import("utils.urls", "url_to_path", old_path="download")
PackageFinder = do_import("index", "PackageFinder")
FormatControl = do_import("index", "FormatControl")
PackageFinder = do_import("index.package_finder", "PackageFinder", old_path="index")
FormatControl = do_import("models.format_control", "FormatControl", old_path="index")
InstallCommand = do_import("commands.install", "InstallCommand")
Wheel = do_import("wheel", "Wheel")
cmdoptions = do_import("cli.cmdoptions", old_path="cmdoptions")
Expand Down
11 changes: 9 additions & 2 deletions piptools/repositories/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,16 @@ def resolve_reqs(self, download_dir, ireq, wheel_cache):
reqset = RequirementSet()
ireq.is_direct = True
reqset.add_requirement(ireq)

resolver = PipResolver(**resolver_kwargs)
resolver.require_hashes = False
results = resolver._resolve_one(reqset, ireq)
require_hashes = False
if PIP_VERSION < (19, 4):
resolver.require_hashes = require_hashes
results = resolver._resolve_one(reqset, ireq)
else: # pragma: no cover
# TODO remove pragma after pip==19.4 being released
results = resolver._resolve_one(reqset, ireq, require_hashes)
atugushev marked this conversation as resolved.
Show resolved Hide resolved

reqset.cleanup_files()

return set(results)
Expand Down