Skip to content

Commit 055b53b

Browse files
Copilothzhangxyz
andauthored
Fix Dependabot build failure in bnf package by making ANTLR generation optional (#140)
Dependabot was failing to resolve Python dependencies because the build required the `antlr4` command, which isn't available in Dependabot's environment. ## Changes - **`bnf/setup.py`**: Made ANTLR parser generation optional during build. If `antlr4` command is unavailable, skip generation with a warning instead of failing. This allows dependency resolution without requiring the full build toolchain. The check is placed at the top of the `generate_antlr_parsers()` method for early return. The package can now be built for metadata extraction (what Dependabot needs) without ANTLR, while parser generation still works normally when the tool is available (CI, production builds). <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>bnf下的uv dependabot有点问题</issue_title> > <issue_description>``` > Dependabot can't resolve your Python dependency files > > Dependabot failed to update your dependencies because there was an error resolving your Python dependency files. > > Dependabot encountered the following error: > > × Failed to build `apyds-bnf @ > │ file://dependabot_tmp_dir` > ├─▶ The build backend returned an error > ╰─▶ Call to `setuptools.build_meta.build_editable` failed (exit status: 1) > > [stdout] > running egg_info > creating apyds_bnf.egg-info > writing apyds_bnf.egg-info/PKG-INFO > writing dependency_links to apyds_bnf.egg-info/dependency_links.txt > writing requirements to apyds_bnf.egg-info/requires.txt > writing top-level names to apyds_bnf.egg-info/top_level.txt > writing manifest file 'apyds_bnf.egg-info/SOURCES.txt' > > [stderr] > error: package directory 'apyds_bnf' does not exist > > hint: This usually indicates a problem with the package or the build > environment. > > [Troubleshoot Dependabot errors](https://docs.github.com/github/managing-security-vulnerabilities/troubleshooting-dependabot-errors) > ```</issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > <comment_new><author>@hzhangxyz</author><body> > https://github.com/USTC-KnowledgeComputingLab/ds/network/updates/1187262040</body></comment_new> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #139 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/USTC-KnowledgeComputingLab/ds/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
1 parent 52fb2a5 commit 055b53b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

bnf/setup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import subprocess
2+
import shutil
23
from pathlib import Path
34
from setuptools import setup
45
from setuptools.command.build_py import build_py
@@ -10,6 +11,11 @@ def run(self):
1011
super().run()
1112

1213
def generate_antlr_parsers(self):
14+
if not shutil.which("antlr4"):
15+
print("Warning: antlr4 command not found. Skipping parser generation.")
16+
print("This is normal when resolving dependencies (e.g., with Dependabot).")
17+
return
18+
1319
base_dir = Path(__file__).parent
1420
grammars_dir = base_dir
1521
output_dir = base_dir / "apyds_bnf"

0 commit comments

Comments
 (0)