Skip to content

Commit

Permalink
Optimized requirements reading process
Browse files Browse the repository at this point in the history
  • Loading branch information
maxisoft committed Aug 30, 2020
1 parent 08d1959 commit 8821512
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Always prefer setuptools over distutils
from pip._internal.req import parse_requirements
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
Expand All @@ -11,13 +12,8 @@
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()

with open('requirements.txt', encoding='utf-8') as f:
install_requires = map(lambda line: line.strip(), f.readlines())
install_requires = filter(lambda line: bool(line), install_requires)

with open('test-requirements.txt', encoding='utf-8') as f:
test_requires = map(lambda line: line.strip(), f.readlines())
test_requires = filter(lambda line: bool(line), install_requires)
install_requires = [req.req for req in parse_requirements('requirements.txt')]
test_requires = [req.req for req in parse_requirements('test-requirements.txt')]

setup(
name='freenom dns updater',
Expand Down Expand Up @@ -80,15 +76,15 @@
# your project is installed. For an analysis of "install_requires" vs pip's
# requirements files see:
# https://packaging.python.org/en/latest/requirements.html
install_requires=list(install_requires),
install_requires=install_requires,

# List additional groups of dependencies here (e.g. development
# dependencies). You can install these using the following syntax,
# for example:
# $ pip install -e .[dev,test]
extras_require={
'dev': ['check-manifest'],
'test': list(test_requires),
'test': test_requires,
},

# If there are data files included in your packages that need to be
Expand Down

0 comments on commit 8821512

Please sign in to comment.