From a1e0007f89992a027df4c70ab0ebb0f958f8f94f Mon Sep 17 00:00:00 2001 From: Ricardo Busquet Date: Sun, 3 May 2020 22:13:02 -0400 Subject: [PATCH] Remove dependency on internal pip APIs (#112) * Remove dependency on internal pip APIs Fixes #111 * method to parse requirements @particledecay suggestion * try updating pip * pin configparser version --- requirements/dev.txt | 1 + setup.py | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/requirements/dev.txt b/requirements/dev.txt index 76b6144..11fc7c3 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -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' diff --git a/setup.py b/setup.py index e0ee02a..cc2461a 100644 --- a/setup.py +++ b/setup.py @@ -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: @@ -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', @@ -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'), )