From 940de2c188d3306f50a638deabcbc8c6bbb9b015 Mon Sep 17 00:00:00 2001 From: SSable Date: Tue, 17 Apr 2018 16:11:44 +0200 Subject: [PATCH] Fix setup to work with pip 10 pip.req has been moved to pip._internal.req in pip 10 and it is not recommended to use it. --- setup.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index ea853f3..ee7a2bc 100755 --- a/setup.py +++ b/setup.py @@ -1,12 +1,15 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from pip.req import parse_requirements try: from setuptools import setup except ImportError: from distutils.core import setup +def parse_requirements(filename): + """ load requirements from a pip requirements file """ + lineiter = (line.strip() for line in open(filename)) + return [line for line in lineiter if line and not line.startswith("#")] with open('README.rst') as readme_file: readme = readme_file.read() @@ -14,8 +17,8 @@ with open('HISTORY.rst') as history_file: history = history_file.read() -requirements = [str(i.req) for i in parse_requirements('requirements.txt', session=False)] -test_requirements = [str(i.req) for i in parse_requirements('requirements_dev.txt', session=False)] +requirements = parse_requirements('requirements.txt') +test_requirements = parse_requirements('requirements_dev.txt') setup( name='swagger_stub',