git: e875842b611d - main - devel/py-omegaconf: Generate the parser with devel/antlr4

From: Jochen Neumeister <joneum_at_FreeBSD.org>
Date: Fri, 18 Sep 2026 16:27:27 UTC
The branch main has been updated by joneum:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e875842b611d1f6588cc2c4718096d3e6eb546f2

commit e875842b611d1f6588cc2c4718096d3e6eb546f2
Author:     Jochen Neumeister <joneum@FreeBSD.org>
AuthorDate: 2026-09-18 16:25:34 +0000
Commit:     Jochen Neumeister <joneum@FreeBSD.org>
CommitDate: 2026-09-18 16:26:51 +0000

    devel/py-omegaconf: Generate the parser with devel/antlr4
    
    The bundled antlr 4.9.3 jar generates a parser that the antlr4 runtime in
    the tree refuses to load, so every consumer fails at import time.  Generate
    it with devel/antlr4 instead and depend on the matching Python runtime.
    
    PR:             298604
    Approved by:    yuri (maintainer)
    Sponsored by:   Netzkommune GmbH
---
 devel/py-omegaconf/Makefile | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/devel/py-omegaconf/Makefile b/devel/py-omegaconf/Makefile
index f6ebf88c6531..1dfe7687b351 100644
--- a/devel/py-omegaconf/Makefile
+++ b/devel/py-omegaconf/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	omegaconf
 DISTVERSION=	2.3.1
+PORTREVISION=	1
 CATEGORIES=	devel python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -12,9 +13,10 @@ LICENSE=	BSD3CLAUSE
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
 BUILD_DEPENDS=	${PY_SETUPTOOLS} \
-		${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR}
-RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pyyaml>0:devel/py-pyyaml@${PY_FLAVOR}
-TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}antlr4-python3-runtime>0:devel/py-antlr4-python3-runtime@${PY_FLAVOR}
+		${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR} \
+		${ANTLR_JAR}:devel/antlr4
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}antlr4-python3-runtime>=4.13:devel/py-antlr4-python3-runtime@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pyyaml>0:devel/py-pyyaml@${PY_FLAVOR}
 
 USES=		java:build python
 
@@ -24,6 +26,15 @@ TEST_ENV=	PYTHONPATH=${STAGEDIR}${PYTHON_SITELIBDIR}
 
 NO_ARCH=	yes
 
-# tests as of 2.3.0: 10 failed, 7761 passed, 354 skipped, 8 xfailed in 57.22s, failures are because if the missing build_helpers/test_files
+ANTLR_JAR=	${JAVAJARDIR}/antlr-4.13.2-complete.jar
+
+# tests as of 2.3.1: 10 failed, 7761 passed, 354 skipped, 8 xfailed in 57.22s, failures are because if the missing build_helpers/test_files
+
+# The bundled antlr 4.9.3 generates a parser that the antlr4 runtime in the
+# tree refuses to load, so generate it with devel/antlr4 instead
+post-patch:
+	@${REINPLACE_CMD} -e 's|^\( *\)"java",$$|\1"${JAVA}",|' \
+		-e 's|str(build_dir / "bin" / "antlr-4.9.3-complete.jar")|"${ANTLR_JAR}"|' \
+		${WRKSRC}/build_helpers/build_helpers.py
 
 .include <bsd.port.mk>