Skip to content

Commit

Permalink
Remove dependency on internal pip APIs (#112)
Browse files Browse the repository at this point in the history
* Remove dependency on internal pip APIs

Fixes #111

* method to parse requirements

@particledecay suggestion

* try updating pip

* pin configparser version
  • Loading branch information
Ricardo Busquet authored May 4, 2020
1 parent a60d12c commit a1e0007
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ setuptools==39.2.0
twine==1.11.0
zipp==0.4
more-itertools<6.0.0; python_version < '3'
configparser<5.0.0; python_version < '3'
19 changes: 10 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
from setuptools import setup

try:
from pip._internal.req import parse_requirements
except ImportError:
from pip.req import parse_requirements

install_req = parse_requirements('requirements/core.txt', session='skip')
req = [str(ir.req) for ir in install_req]


def read_md(filename):
try:
Expand All @@ -17,6 +9,15 @@ def read_md(filename):
return open(filename).read()


def parse_requirements(filename):
reqs = []
with open(filename, 'r') as f:
reqs = f.read().splitlines()
if not reqs:
raise RuntimeError("Unable to read requirements from '%s'" % filename)
return reqs


setup(
name='django_mock_queries',
version='2.1.4',
Expand Down Expand Up @@ -44,5 +45,5 @@ def read_md(filename):
],
keywords='django orm mocking unit-testing tdd',
packages=['django_mock_queries'],
install_requires=req,
install_requires=parse_requirements('requirements/core.txt'),
)

0 comments on commit a1e0007

Please sign in to comment.