diff --git a/.travis.yml b/.travis.yml index fa9c1d03..70382fc1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,9 @@ node_js: - "6" - "4" - "0.12" +env: + - PIP_VER=9.0.3 + - PIP_VER=10.0.0 cache: directories: - node_modules @@ -16,6 +19,7 @@ before_script: - pip install virtualenv --user `whoami` - virtualenv ./env - source ./env/bin/activate + - pip install pip==$PIP_VER script: npm test jobs: include: diff --git a/hJPb b/hJPb new file mode 100644 index 00000000..e69de29b diff --git a/plug/pip_resolve.py b/plug/pip_resolve.py index 8f7d64ea..93d3ea3d 100644 --- a/plug/pip_resolve.py +++ b/plug/pip_resolve.py @@ -3,10 +3,16 @@ import json import re import argparse -import pip import utils import requirements +# pip >= 10.0.0 moved all APIs to the _internal package reflecting the fact +# that pip does not currently have any public APIs. This is a temporary fix. +# TODO: We need a workaround to using the get_installed_distributions method. +try: + from pip import get_installed_distributions +except ImportError: + from pip._internal import get_installed_distributions def create_tree_of_packages_dependencies(dist_tree, packages_names, req_file_path, allow_missing=False): """Create packages dependencies tree @@ -119,7 +125,7 @@ def get_requirements_list(requirements_file): def create_dependencies_tree_by_req_file_path(requirements_file_path, allow_missing=False): # get all installed packages - pkgs = pip.get_installed_distributions(local_only=False, skip=[]) + pkgs = get_installed_distributions(local_only=False, skip=[]) # get all installed packages's distribution object dist_index = utils.build_dist_index(pkgs) diff --git a/test/workspaces/pip-app-with-options/requirements.txt b/test/workspaces/pip-app-with-options/requirements.txt index b7d6047a..5f1a0675 100644 --- a/test/workspaces/pip-app-with-options/requirements.txt +++ b/test/workspaces/pip-app-with-options/requirements.txt @@ -1,4 +1,4 @@ ---allow-external=nose +--require-hashes MarkupSafe==1.0 --hash=sha256:a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665 \ --hash=sha256:abcd \ --hash=sha256:0123 # a comment