-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
44 lines (35 loc) · 1.9 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
from setuptools import setup, find_packages
import subprocess
import setuptools.command.build_py
class BuildPyWithGenerateCommand(setuptools.command.build_py.build_py):
"""Custom build command."""
def run(self):
self.gen()
setuptools.command.build_py.build_py.run(self)
def gen(self):
cmds = [
'java -jar vendor/antlr-4.11.1-complete.jar -Dlanguage=Python3 src/solidity_parser/grammar/v060/Solidity.g4 -o src/solidity_parser/grammar/v060/ -Xexact-output-dir',
'java -jar vendor/antlr-4.11.1-complete.jar -Dlanguage=Python3 src/solidity_parser/grammar/v070/Solidity.g4 -o src/solidity_parser/grammar/v070/ -Xexact-output-dir',
'java -jar vendor/antlr-4.11.1-complete.jar -Dlanguage=Python3 src/solidity_parser/grammar/v080/SolidityParser.g4 src/solidity_parser/grammar/v080/SolidityLexer.g4 -o src/solidity_parser/grammar/v080/ -Xexact-output-dir',
'java -jar vendor/antlr-4.11.1-complete.jar -Dlanguage=Python3 src/solidity_parser/grammar/v088/SolidityParser.g4 src/solidity_parser/grammar/v088/SolidityLexer.g4 -o src/solidity_parser/grammar/v088/ -Xexact-output-dir',
'java -jar vendor/antlr-4.11.1-complete.jar -Dlanguage=Python3 src/solidity_parser/grammar/v08_22/SolidityParser.g4 src/solidity_parser/grammar/v08_22/SolidityLexer.g4 -o src/solidity_parser/grammar/v08_22/ -Xexact-output-dir']
print("Generating antlr parsers")
for c in cmds:
subprocess.run(c.split(' '), check=True)
print("Generated antlr parsers")
setup(
name='solidity-parser',
version='0.1.22',
install_requires=[
"antlr4-python3-runtime==4.11.1",
"parameterized==0.9.0",
"mock==5.0.2",
"jsons==1.6.3",
"snapshottest==0.6.0"
],
cmdclass={
'build_py': BuildPyWithGenerateCommand,
},
packages=find_packages(where='src'),
package_dir={'': 'src'}
)