antlr / antlr/antlr4-tools

Python install no longer works

Open Beginner friendly
#28 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
118
Forks
30
PR merge metrics
No merged PRs in 30d

Description

The python3 install of antlr4 has several problems (on MAC OS X).

The sonatype URL used to get the latest version is malformed (+ should be replaced with +AND+),

When corrected antlr4 tries to extract the lastest version from the JSON but there's no such field (there is a 'v' field).

When that's fixed the sonatype response is also not ordered in terms of versions so it picks up an old version (4.5.1) and that version that is not on Maven so the download fails. The sonatype service can sort the version numbers with highest first but the parameter for doing so was not included.

Took a while to find the `export ANTLR4_TOOLS_ANTLR_VERSION=4.13.2` fix online but spent a few hours (a couple of AI tools nudge towards on older install!)

A fix for the script latest_version() is below for the ```antlr4_tool_runner.py``` file

```
def latest_version():
try:
with urlopen("https://central.sonatype.com/solrsearch/select?q=g:org.antlr+AND+a:antlr4-master&rows=1&sort=v+desc",
timeout=10) as response:
s = response.read().decode("UTF-8")
searchResult = json.loads(s)['response']
# searchResult = s.json()['response']
antlr_info = searchResult['docs'][0]
# print(json.dump(searchResult))
latest = antlr_info['v']
return latest
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with latest_version() in antlr4_tool_runner.py and inspect the Sonatype request and response handling described in the issue. Verify that the install path retrieves the current ANTLR version and downloads successfully on macOS, including the documented ANTLR4_TOOLS_ANTLR_VERSION workaround path.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.