| 1 | import codecs |
| 2 | import re |
| 3 | from pathlib import Path |
| 4 | |
| 5 | from setuptools import setup |
| 6 | |
| 7 | |
| 8 | def _get_version(): |
| 9 | PATH_TO_INIT_PY = Path(__file__).parent / "aiohttp_jinja2" / "__init__.py" |
| 10 | with codecs.open(PATH_TO_INIT_PY, "r", "latin1") as fp: |
| 11 | try: |
| 12 | for line in fp.readlines(): |
| 13 | if line: |
| 14 | line = line.strip() |
| 15 | version = re.findall(r'^__version__ = "([^"]+)"$', line, re.M) |
| 16 | if version: |
| 17 | return version[0] |
| 18 | except IndexError: |
| 19 | raise RuntimeError("Unable to determine version.") |
| 20 | raise RuntimeError("Unable to find version.") |
| 21 | |
| 22 | |
| 23 | version = _get_version() |
| 24 | |
| 25 | |
| 26 | def read(f): |
| 27 | return Path(__file__).with_name(f).read_text() |
| 28 | |
| 29 | |
| 30 | setup( |
| 31 | name="aiohttp-jinja2", |
| 32 | version=version, |
| 33 | description="jinja2 template renderer for aiohttp.web (http server for asyncio)", |
| 34 | long_description="\n\n".join((read("README.rst"), read("CHANGES.rst"))), |
| 35 | classifiers=[ |
| 36 | "License :: OSI Approved :: Apache Software License", |
| 37 | "Intended Audience :: Developers", |
| 38 | "Programming Language :: Python", |
| 39 | "Programming Language :: Python :: 3", |
| 40 | "Programming Language :: Python :: 3.8", |
| 41 | "Programming Language :: Python :: 3.9", |
| 42 | "Programming Language :: Python :: 3.10", |
| 43 | "Programming Language :: Python :: 3.11", |
| 44 | "Programming Language :: Python :: 3.12", |
| 45 | "Development Status :: 5 - Production/Stable", |
| 46 | "Topic :: Internet :: WWW/HTTP", |
| 47 | "Framework :: AsyncIO", |
| 48 | "Framework :: aiohttp", |
| 49 | ], |
| 50 | author="Andrew Svetlov", |
| 51 | author_email="[email protected]", |
| 52 | url="https://github.com/aio-libs/aiohttp_jinja2/", |
| 53 | license="Apache 2", |
| 54 | packages=["aiohttp_jinja2"], |
| 55 | python_requires=">=3.8", |
| 56 | install_requires=("aiohttp>=3.9.0", "jinja2>=3.0.0"), |
| 57 | include_package_data=True, |
| 58 | ) |