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

Support pip 19.0 #715

Merged
merged 1 commit into from
Jan 23, 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
10 changes: 10 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ environment:
PIP: 10.0.1
- TOXENV: py27-pip18.0
PIP: 18.0
- TOXENV: py27-pip19.0
PIP: 19.0
- TOXENV: py27-pipmaster
PIP: master
- TOXENV: py27-piplatest
Expand All @@ -25,6 +27,8 @@ environment:
PIP: 10.0.1
- TOXENV: py34-pip18.0
PIP: 18.0
- TOXENV: py34-pip19.0
PIP: 19.0
- TOXENV: py34-pipmaster
PIP: master
- TOXENV: py34-piplatest
Expand All @@ -39,6 +43,8 @@ environment:
PIP: 10.0.1
- TOXENV: py35-pip18.0
PIP: 18.0
- TOXENV: py35-pip19.0
PIP: 19.0
- TOXENV: py35-pipmaster
PIP: master
- TOXENV: py35-piplatest
Expand All @@ -53,6 +59,8 @@ environment:
PIP: 10.0.1
- TOXENV: py36-pip18.0
PIP: 18.0
- TOXENV: py36-pip19.0
PIP: 19.0
- TOXENV: py36-pipmaster
PIP: master
- TOXENV: py36-piplatest
Expand All @@ -67,6 +75,8 @@ environment:
PIP: 10.0.1
- TOXENV: py37-pip18.0
PIP: 18.0
- TOXENV: py37-pip19.0
PIP: 19.0
- TOXENV: py37-pipmaster
PIP: master
- TOXENV: py37-piplatest
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ env:
- PIP=9.0.3
- PIP=10.0.1
- PIP=18.0
- PIP=19.0
- PIP=latest
- PIP=master

Expand Down
1 change: 1 addition & 0 deletions piptools/_compat/pip_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def do_import(module_path, subimport=None, old_path=None):
user_cache_dir = do_import('utils.appdirs', 'user_cache_dir')
FAVORITE_HASH = do_import('utils.hashes', 'FAVORITE_HASH')
is_file_url = do_import('download', 'is_file_url')
path_to_url = do_import('download', 'path_to_url')
url_to_path = do_import('download', 'url_to_path')
PackageFinder = do_import('index', 'PackageFinder')
FormatControl = do_import('index', 'FormatControl')
Expand Down
24 changes: 16 additions & 8 deletions piptools/repositories/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
from contextlib import contextmanager
from shutil import rmtree

import pip
import pkg_resources

from .._compat import (
is_file_url,
url_to_path,
Expand Down Expand Up @@ -54,14 +57,19 @@ def __init__(self, pip_options, session):
if pip_options.no_index:
index_urls = []

self.finder = PackageFinder(
find_links=pip_options.find_links,
index_urls=index_urls,
trusted_hosts=pip_options.trusted_hosts,
allow_all_prereleases=pip_options.pre,
process_dependency_links=pip_options.process_dependency_links,
vphilippon marked this conversation as resolved.
Show resolved Hide resolved
session=self.session,
)
finder_kwargs = {
"find_links": pip_options.find_links,
"index_urls": index_urls,
"trusted_hosts": pip_options.trusted_hosts,
"allow_all_prereleases": pip_options.pre,
"session": self.session,
}

# pip 19.0 has removed process_dependency_links from the PackageFinder constructor
if pkg_resources.parse_version(pip.__version__) < pkg_resources.parse_version('19.0'):
finder_kwargs["process_dependency_links"] = pip_options.process_dependency_links

self.finder = PackageFinder(**finder_kwargs)

# Caches
# stores project_name => InstallationCandidate mappings for all
Expand Down
8 changes: 4 additions & 4 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
from textwrap import dedent
from six.moves.urllib.request import pathname2url
import subprocess
import sys
import mock
Expand All @@ -9,6 +8,7 @@

import pytest

from piptools._compat.pip_compat import path_to_url
from piptools.repositories import PyPIRepository
from piptools.scripts.compile import cli
from piptools.scripts.sync import cli as sync_cli
Expand Down Expand Up @@ -242,7 +242,7 @@ def test_sync_quiet(tmpdir):
def test_editable_package(tmpdir):
""" piptools can compile an editable """
fake_package_dir = os.path.join(os.path.split(__file__)[0], 'test_data', 'small_fake_package')
fake_package_dir = 'file:' + pathname2url(fake_package_dir)
fake_package_dir = path_to_url(fake_package_dir)
runner = CliRunner()
with runner.isolated_filesystem():
with open('requirements.in', 'w') as req_in:
Expand Down Expand Up @@ -278,7 +278,7 @@ def test_locally_available_editable_package_is_not_archived_in_cache_dir(tmpdir)
cache_dir = tmpdir.mkdir('cache_dir')

fake_package_dir = os.path.join(os.path.split(__file__)[0], 'test_data', 'small_fake_package')
fake_package_dir = 'file:' + pathname2url(fake_package_dir)
fake_package_dir = path_to_url(fake_package_dir)

with mock.patch('piptools.repositories.pypi.CACHE_DIR', new=str(cache_dir)):
runner = CliRunner()
Expand Down Expand Up @@ -360,7 +360,7 @@ def test_upgrade_packages_version_option(tmpdir):
def test_generate_hashes_with_editable():
small_fake_package_dir = os.path.join(
os.path.split(__file__)[0], 'test_data', 'small_fake_package')
small_fake_package_url = 'file:' + pathname2url(small_fake_package_dir)
small_fake_package_url = path_to_url(small_fake_package_dir)
runner = CliRunner()
with runner.isolated_filesystem():
with open('requirements.in', 'w') as fp:
Expand Down
3 changes: 3 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ deps =
pip9.0.3: pip==9.0.3
pip10.0.1: pip==10.0.1
pip18.0: pip==18.0
pip19.0: pip==19.0
coverage
mock
pytest
Expand All @@ -25,6 +26,7 @@ setenv =
pip9.0.3: PIP=9.0.3
pip10.0.1: PIP=10.0.1
pip18.0: PIP=18.0
pip19.0: PIP==19.0
install_command= python -m pip install {opts} {packages}
commands =
pip --version
Expand All @@ -48,5 +50,6 @@ PIP =
9.0.3: pip9.0.3
10.0.1: pip10.0.1
18.0: pip18.0
19.0: pip19.0
latest: piplatest
master: pipmaster