Skip to content

Commit

Permalink
Use pip-api instead of pip's internal APIs (#59)
Browse files Browse the repository at this point in the history
* Don't use pip's vendored packaging

* Use pip_api instead of pip's internal APIs

* Add a python_requires
  • Loading branch information
di authored and Peter Bengtsson committed Mar 21, 2018
1 parent 77e2d93 commit 1f794c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
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

0 comments on commit 1f794c7

Please # to comment.