From 9d67c32a8475ec3522524445aada95cf1b2146dc Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Wed, 1 Nov 2017 18:36:44 +0100 Subject: [PATCH] Parse requirements.txt in setup.py. Fix #273 (#284) --- MANIFEST.in | 2 +- setup.py | 38 +++++++++++++++----------------------- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 9ba34bae..91d0edb2 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ include *.rst recursive-include ihatemoney *.rst *.py *.yaml *.po *.mo *.html *.css *.js *.eot *.svg *.woff *.txt *.png *.ini *.cfg -include LICENSE CONTRIBUTORS CHANGELOG.rst +include LICENSE CONTRIBUTORS CHANGELOG.rst requirements.txt diff --git a/setup.py b/setup.py index e90dea2b..61d94643 100644 --- a/setup.py +++ b/setup.py @@ -2,6 +2,16 @@ import codecs import os from setuptools import setup, find_packages +try: + from pip.req import parse_requirements + from pip.download import PipSession +except ImportError: + print('[libbmc] pip not found.') + raise + +# Get requirements from the requirements.txt file. +pip_requirements = parse_requirements("requirements.txt", session=PipSession()) +install_requires = [str(ir.req) for ir in pip_requirements] here = os.path.abspath(os.path.dirname(__file__)) @@ -16,25 +26,6 @@ def read_file(filename): README = read_file('README.rst') CHANGELOG = read_file('CHANGELOG.rst') -REQUIREMENTS = [ - 'flask>=0.11', - 'flask-wtf>=0.13', - 'flask-sqlalchemy', - 'flask-mail>=0.8', - 'Flask-Migrate>=1.8.0', - 'Flask-script', - 'flask-babel', - 'flask-rest', - 'jinja2>=2.6', - 'raven', - 'blinker', - 'six>=1.10', - 'itsdangerous>=0.24', -] - -DEPENDENCY_LINKS = [ -] - ENTRY_POINTS = { 'paste.app_factory': [ 'main = ihatemoney.run:main', @@ -52,9 +43,11 @@ setup(name='ihatemoney', license='Custom BSD Beerware', classifiers=[ "Programming Language :: Python", - "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", @@ -66,6 +59,5 @@ setup(name='ihatemoney', packages=find_packages(), include_package_data=True, zip_safe=False, - install_requires=REQUIREMENTS, - dependency_links=DEPENDENCY_LINKS, -entry_points=ENTRY_POINTS) + install_requires=install_requires, + entry_points=ENTRY_POINTS)