-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
53 lines (48 loc) · 1.57 KB
/
setup.py
File metadata and controls
53 lines (48 loc) · 1.57 KB
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
from setuptools import setup, find_packages
from setuptools.command.build_py import build_py
import subprocess
import sys
import os
from pathlib import Path
class CustomBuildPy(build_py):
"""Custom build command that generates ANTLR parsers before building"""
def run(self):
# Generate parsers before building
script_dir = Path(__file__).parent / "src" / "grammars"
build_script = script_dir / "build_parsers.py"
if build_script.exists():
print("Generating ANTLR parsers...")
try:
result = subprocess.run([sys.executable, str(build_script)],
check=True, capture_output=True, text=True)
print("ANTLR parsers generated successfully")
except subprocess.CalledProcessError as e:
print(f"Failed to generate ANTLR parsers: {e}")
print(f"STDOUT: {e.stdout}")
print(f"STDERR: {e.stderr}")
sys.exit(1)
else:
print("Warning: build_parsers.py not found, skipping parser generation")
super().run()
setup(
name="cbert",
version="0.1.0",
packages=find_packages(where="src"),
package_dir={"": "src"},
cmdclass={"build_py": CustomBuildPy},
python_requires=">=3.8",
install_requires=[
"torch",
"transformers",
"sentencepiece",
"clang",
"requests",
"numpy<2.0",
"antlr4-python3-runtime==4.13.2"
],
extras_require={
"dev": [
"pytest"
]
}
)