Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bnf/setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import subprocess
import shutil
from pathlib import Path
from setuptools import setup
from setuptools.command.build_py import build_py
Expand All @@ -10,6 +11,11 @@ def run(self):
super().run()

def generate_antlr_parsers(self):
if not shutil.which("antlr4"):
Comment thread
hzhangxyz marked this conversation as resolved.
print("Warning: antlr4 command not found. Skipping parser generation.")
print("This is normal when resolving dependencies (e.g., with Dependabot).")
return
Comment on lines +14 to +17

Copilot AI Dec 20, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skipping parser generation will cause runtime import errors. The package's __init__.py imports generated files like DspLexer, DspParser, DsLexer, and DsParser (lines 5-10 in apyds_bnf/init.py), which won't exist if generation is skipped. Since these generated files are excluded from git (.gitignore), the package will be non-functional when installed.

Consider one of these approaches:

  1. Check if generated files already exist before skipping generation, only skip if they're present
  2. Include pre-generated parser files in the repository and source distribution (remove from .gitignore or use MANIFEST.in)
  3. Use a try-except block in init.py to provide a more informative error message when parsers are missing

Copilot uses AI. Check for mistakes.

base_dir = Path(__file__).parent
grammars_dir = base_dir
output_dir = base_dir / "apyds_bnf"
Expand Down