forked from datacamp/antlr-ast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
47 lines (42 loc) · 1.57 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python
import re
import ast
from os import path
from setuptools import setup
PACKAGE_NAME = "antlr_ast"
REQUIREMENT_NAMES = ["antlr4-python3-runtime"]
HERE = path.abspath(path.dirname(__file__))
VERSION_FILE = path.join(HERE, PACKAGE_NAME, "__init__.py")
REQUIREMENTS_FILE = path.join(HERE, "requirements.txt")
README_FILE = path.join(HERE, "README.md")
with open(VERSION_FILE, encoding="utf-8") as fp:
_version_re = re.compile(r"__version__\s+=\s+(.*)")
VERSION = str(ast.literal_eval(_version_re.search(fp.read()).group(1)))
with open(REQUIREMENTS_FILE, encoding="utf-8") as fp:
req_txt = fp.read()
_requirements_re_template = r"^({}(?:\s*[~<>=]+\s*\S*)?)\s*(?:#.*)?$"
REQUIREMENTS = [
re.search(_requirements_re_template.format(requirement), req_txt, re.M).group(0)
for requirement in REQUIREMENT_NAMES
]
with open(README_FILE, encoding="utf-8") as fp:
README = fp.read()
setup(
name=PACKAGE_NAME.replace("_", "-"),
version=VERSION,
packages=[PACKAGE_NAME],
install_requires=REQUIREMENTS,
description="AST shaping for antlr parsers",
long_description=README,
long_description_content_type="text/markdown",
author="Michael Chow",
author_email="[email protected]",
maintainer="Jeroen Hermans",
maintainer_email="[email protected]",
url="https://github.com/datacamp/antlr-ast",
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Operating System :: OS Independent",
],
)