|
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
-
- import pip
-
- try: # for pip >= 10
- from pip._internal.req import parse_requirements
- except ImportError: # for pip <= 9.0.3
- from pip.req import parse_requirements
-
- try:
- from setuptools import setup
- except ImportError:
- from distutils.core import setup
-
- with open("README.md") as readme_file:
- readme = readme_file.read()
-
- with open("HISTORY.md") as history_file:
- history = history_file.read()
-
- github_url = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}"
-
- ## workaround derived from: https://github.com/pypa/pip/issues/7645#issuecomment-578210649
- parsed_requirements = parse_requirements("requirements/prod.txt", session="workaround")
- parsed_dev_requirements = parse_requirements(
- "requirements/dev.txt", session="workaround"
- )
- parsed_test_requirements = parse_requirements(
- "requirements/test.txt", session="workaround"
- )
-
- requirements = [str(ir.req) for ir in parsed_requirements]
- dev_requirements = [str(ir.req) for ir in parsed_dev_requirements]
- test_requirements = [str(tr.req) for tr in parsed_test_requirements]
-
- setup(
- name="{{ cookiecutter.project_slug }}",
- version="{{ cookiecutter.version }}",
- description="{{ cookiecutter.project_short_description }}",
- long_description=readme + "\n\n" + history,
- long_description_content_type="text/markdown",
- author="{{ cookiecutter.full_name }}",
- author_email="{{ cookiecutter.email }}",
- url=github_url,
- license="LGPL-3",
- keywords="{{ cookiecutter.project_slug }}",
- project_urls={"Source": github_url},
- packages=[
- "{{ cookiecutter.project_slug }}",
- ],
- package_dir={"{{ cookiecutter.project_slug }}": "{{ cookiecutter.project_slug }}"},
- include_package_data=True,
- install_requires=requirements,
- extras_require={"dev": dev_requirements},
- tests_require=test_requirements,
- test_suite="tests",
- zip_safe=False,
- classifiers=[
- "Programming Language :: Python :: 3",
- "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
- "Operating System :: POSIX :: Linux",
- "Natural Language :: English",
- ],
- )
|