Skip to content
New issue

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

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

Already on GitHub? # to your account

Use pip-api instead of pip's internal APIs #59

Merged
merged 3 commits into from
Mar 21, 2018
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
8 changes: 4 additions & 4 deletions hashin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import json
from itertools import chain

import pip
from pip._vendor.packaging.version import parse
import pip_api
from packaging.version import parse

if sys.version_info >= (3,):
from urllib.request import urlopen
Expand Down Expand Up @@ -72,7 +72,7 @@
)


major_pip_version = int(pip.__version__.split('.')[0])
major_pip_version = int(pip_api.version().split('.')[0])
if major_pip_version < 8:
raise ImportError(
'hashin only works with pip 8.x or greater'
Expand Down Expand Up @@ -363,7 +363,7 @@ def get_releases_hashes(releases, algorithm, verbose=False):
elif verbose:
_verbose(' Re-using', filename)

found['hash'] = pip.commands.hash._hash_of_file(filename, algorithm)
found['hash'] = pip_api.hash(filename, algorithm)
if verbose:
_verbose(' Hash', found['hash'])
yield {
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
},
url='https://github.com/peterbe/hashin',
include_package_data=True,
python_requires='>=2.7,!=3.0,!=3.1,!=3.2,!=3.3',
install_requires=['packaging', 'pip-api'],
tests_require=['pytest', 'mock'],
setup_requires=['pytest-runner'],
classifiers=[
Expand Down