def requirements(f): try: return [str(i.req) for i in parse(f, session=False)] except: return [str(i.requirement) for i in parse(f, session=False)]
#!/usr/bin/env python import setuptools try: # for pip >= 10 from pip._internal.req import parse_requirements as parse except ImportError: # for pip <= 9.0.3 from pip.req import parse_requirements as parse requirements = lambda f: [str(i.req) for i in parse(f, session=False)] setuptools.setup( name='PyNFe', version='0.4', author='TadaSoftware', author_email='*****@*****.**', url='https://github.com/TadaSoftware', packages=setuptools.find_packages(), package_data={ 'pynfe': ['data/**/*.txt'], }, install_requires=requirements('requirements.txt'), zip_safe=False, python_requires='>=3.6', )
def parse_requirements(fname): """Turn requirements.txt into a list""" reqs = parse(fname, session="test") return [_format_requirement(ir) for ir in reqs]