|
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | 14 |
|
15 | | -import ast |
16 | | -import re |
| 15 | +import os |
17 | 16 | import textwrap |
| 17 | +from codecs import open |
| 18 | +from typing import Any |
18 | 19 |
|
19 | 20 | from setuptools import find_packages, setup |
20 | 21 |
|
21 | | -_version_re = re.compile(r"__version__\s+=\s+(.*)") |
22 | | - |
23 | | -with open("trino/__init__.py", "rb") as f: |
24 | | - trino_version = _version_re.search(f.read().decode("utf-8")) |
25 | | - assert trino_version is not None |
26 | | - version = str(ast.literal_eval(trino_version.group(1))) |
| 22 | +about = {} # type: dict[str, Any] |
| 23 | +here = os.path.abspath(os.path.dirname(__file__)) |
| 24 | +with open(os.path.join(here, "trino", "_version.py"), "r", "utf-8") as f: |
| 25 | + exec(f.read(), about) |
27 | 26 |
|
28 | 27 | kerberos_require = ["requests_kerberos"] |
29 | 28 | sqlalchemy_require = ["sqlalchemy >= 1.3"] |
|
44 | 43 | ] |
45 | 44 |
|
46 | 45 | setup( |
47 | | - name="trino", |
48 | | - author="Trino Team", |
49 | | - author_email="python-client@trino.io", |
50 | | - version=version, |
51 | | - url="https://github.com/trinodb/trino-python-client", |
| 46 | + name=about["__title__"], |
| 47 | + author=about["__author__"], |
| 48 | + author_email=about["__author_email__"], |
| 49 | + version=about["__version__"], |
| 50 | + url=about["__url__"], |
52 | 51 | packages=find_packages(include=["trino", "trino.*"]), |
53 | 52 | package_data={"": ["LICENSE", "README.md"]}, |
54 | | - description="Client for the Trino distributed SQL Engine", |
| 53 | + description=about["__description__"], |
55 | 54 | long_description=textwrap.dedent( |
56 | 55 | """ |
57 | 56 | Client for Trino (https://trino.io), a distributed SQL engine for |
58 | 57 | interactive and batch big data processing. Provides a low-level client and |
59 | 58 | a DBAPI 2.0 implementation. |
60 | 59 | """ |
61 | 60 | ), |
62 | | - license="Apache 2.0", |
| 61 | + license=about["__license__"], |
63 | 62 | classifiers=[ |
64 | 63 | "Development Status :: 4 - Beta", |
65 | 64 | "Intended Audience :: Developers", |
|
77 | 76 | "Programming Language :: Python :: Implementation :: PyPy", |
78 | 77 | "Topic :: Database :: Front-Ends", |
79 | 78 | ], |
80 | | - python_requires='>=3.7', |
| 79 | + python_requires=">=3.7", |
81 | 80 | install_requires=[ |
82 | 81 | "backports.zoneinfo;python_version<'3.9'", |
83 | 82 | "python-dateutil", |
|
0 commit comments