forked from python/typed_ast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
130 lines (121 loc) · 4.33 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import ast
import re
import sys
if sys.version_info[0] < 3 or sys.version_info[1] < 3:
sys.exit('Error: typed_ast only runs on Python 3.3 and above.')
try:
from setuptools import setup, Extension
except ImportError:
from distutils.core import setup, Extension
_ast27 = Extension(
'_ast27',
include_dirs = ['ast27/Include'],
sources = [
'ast27/Parser/acceler.c',
'ast27/Parser/bitset.c',
'ast27/Parser/grammar.c',
'ast27/Parser/grammar1.c',
'ast27/Parser/node.c',
'ast27/Parser/parser.c',
'ast27/Parser/parsetok.c',
'ast27/Parser/tokenizer.c',
'ast27/Python/asdl.c',
'ast27/Python/ast.c',
'ast27/Python/graminit.c',
'ast27/Python/mystrtoul.c',
'ast27/Python/Python-ast.c',
'ast27/Custom/typed_ast.c',
],
depends = [
'ast27/Include/asdl.h',
'ast27/Include/ast.h',
'ast27/Include/bitset.h',
'ast27/Include/compile.h',
'ast27/Include/errcode.h',
'ast27/Include/graminit.h',
'ast27/Include/grammar.h',
'ast27/Include/node.h',
'ast27/Include/parsetok.h',
'ast27/Include/pgenheaders.h',
'ast27/Include/Python-ast.h',
'ast27/Include/token.h',
'ast27/Parser/parser.h',
'ast27/Parser/tokenizer.h',
])
_ast3 = Extension(
'_ast3',
include_dirs = ['ast3/Include'],
sources = [
'ast3/Parser/acceler.c',
'ast3/Parser/bitset.c',
'ast3/Parser/grammar.c',
'ast3/Parser/grammar1.c',
'ast3/Parser/node.c',
'ast3/Parser/parser.c',
'ast3/Parser/parsetok.c',
'ast3/Parser/tokenizer.c',
'ast3/Python/asdl.c',
'ast3/Python/ast.c',
'ast3/Python/graminit.c',
'ast3/Python/Python-ast.c',
'ast3/Custom/typed_ast.c',
],
depends = [
'ast3/Include/asdl.h',
'ast3/Include/ast.h',
'ast3/Include/bitset.h',
'ast3/Include/compile-ast3.h',
'ast3/Include/errcode.h',
'ast3/Include/graminit.h',
'ast3/Include/grammar.h',
'ast3/Include/node.h',
'ast3/Include/parsetok.h',
'ast3/Include/pgenheaders.h',
'ast3/Include/Python-ast.h',
'ast3/Include/token.h',
'ast3/Parser/parser.h',
'ast3/Parser/tokenizer.h',
])
long_description = """
`typed_ast` is a Python 3 package that provides a Python 2.7 and Python 3
parser similar to the standard `ast` library. Unlike `ast` below Python 3.8,
the parsers in
`typed_ast` include PEP 484 type comments and are independent of the version of
Python under which they are run. The `typed_ast` parsers produce the standard
Python AST (plus type comments), and are both fast and correct, as they are
based on the CPython 2.7 and 3.7 parsers.
**Note:** The `ast` module of Python 3.8+ supports all features of `typed_ast`.
`typed_ast` does not support parsing code that uses syntax introduced in
Python 3.8 onwards.
We recommend using `ast` on Python 3.8 or above.
""".strip()
_version_re = re.compile(r'__version__\s+=\s+(?P<version>.*)')
with open('typed_ast/__init__.py', 'r', encoding='utf8') as f:
version = _version_re.search(f.read()).group('version')
version = str(ast.literal_eval(version))
setup (name = 'typed_ast',
version = version,
description = 'a fork of Python 2 and 3 ast modules with type comment support',
long_description = long_description,
author = 'David Fisher',
url = 'https://github.com/python/typed_ast',
license='Apache License 2.0',
platforms = ['POSIX', 'Windows'],
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
'Operating System :: POSIX',
'Operating System :: Microsoft',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Topic :: Software Development',
],
python_requires=">=3.6",
packages = ['typed_ast', 'typed_ast.tests'],
package_dir={ 'typed_ast.tests': 'ast3/tests' },
ext_package='typed_ast',
ext_modules = [_ast27, _ast3])