Simplify setup.py

This commit is contained in:
Andrew Rabert 2018-11-26 19:26:34 -05:00
parent a981861bf1
commit c6cfc2bc82

View file

@ -1,32 +1,25 @@
#!/usr/bin/env python #!/usr/bin/env python
# #
import os.path import pathlib
import setuptools import setuptools
from sprockets import http from sprockets import http
def read_requirements(filename): def read_requirements(name):
requirements = [] requirements = []
try: for line in pathlib.Path('requires', name).read_text().split('\n'):
with open(os.path.join('requires', filename)) as req_file: if '#' in line:
for line in req_file: line = line[:line.index('#')]
if '#' in line: line = line.strip()
line = line[:line.index('#')] if line.startswith('-'):
line = line.strip() pass
if line.startswith('-'): requirements.append(line)
pass
requirements.append(line)
except IOError:
pass
return requirements return requirements
requirements = read_requirements('installation.txt')
tests_require = read_requirements('testing.txt')
setuptools.setup( setuptools.setup(
name='sprockets.http', name='sprockets.http',
version=http.__version__, version=http.__version__,
@ -34,7 +27,7 @@ setuptools.setup(
author='AWeber Communications', author='AWeber Communications',
author_email='api@aweber.com', author_email='api@aweber.com',
url='https://github.com/sprockets/sprockets.http', url='https://github.com/sprockets/sprockets.http',
install_requires=requirements, install_requires=read_requirements('installation.txt'),
license='BSD', license='BSD',
namespace_packages=['sprockets'], namespace_packages=['sprockets'],
packages=setuptools.find_packages(), packages=setuptools.find_packages(),
@ -57,7 +50,7 @@ setuptools.setup(
'Topic :: Software Development :: Libraries', 'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules'], 'Topic :: Software Development :: Libraries :: Python Modules'],
test_suite='nose.collector', test_suite='nose.collector',
tests_require=tests_require, tests_require=read_requirements('testing.txt'),
python_requires='>=3.5', python_requires='>=3.5',
zip_safe=True, zip_safe=True,
) )