-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
44 lines (34 loc) · 999 Bytes
/
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 glob import glob
from os import chdir
from os.path import dirname
from subprocess import run
from setuptools import Command, setup
class RegenerateParserCommand(Command):
description = "regenerate the antlr4-based VHDL parser"
user_options = [] # type: ignore
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
chdir(dirname(__file__))
chdir("redhdl/vhdl")
antlr_command_parts = [
"antlr4",
"-Dlanguage=Python3",
"-lib",
".",
"-o",
"autogen",
"-visitor",
"-listener",
"vhdl.g4",
]
print("Running `" + " ".join(antlr_command_parts) + "`.")
run(antlr_command_parts)
chdir("../vhdl")
run(["cp"] + glob("autogen/*.py") + ["."])
# See setup.cfg for metadata, options, and setup tools.
setup(
cmdclass={"gen_parser": RegenerateParserCommand},
)