python3Packages.omegaconf: relax antlr4 version

This commit is contained in:
Martin Weinelt 2022-12-27 19:42:39 +01:00
parent 56918eebba
commit 47967562fa
No known key found for this signature in database
GPG key ID: 87C1E9888F856759
2 changed files with 30 additions and 0 deletions

View file

@ -0,0 +1,13 @@
diff --git a/build_helpers/build_helpers.py b/build_helpers/build_helpers.py
index 6419e26..9e6c21c 100644
--- a/build_helpers/build_helpers.py
+++ b/build_helpers/build_helpers.py
@@ -30,7 +30,7 @@ class ANTLRCommand(Command): # type: ignore # pragma: no cover
command = [
"java",
"-jar",
- str(build_dir / "bin" / "antlr-4.9.3-complete.jar"),
+ "@antlr_jar@",
"-Dlanguage=Python3",
"-o",
str(project_root / "omegaconf" / "grammar" / "gen"),

View file

@ -1,4 +1,5 @@
{ lib
, antlr4
, antlr4-python3-runtime
, buildPythonPackage
, fetchFromGitHub
@ -8,6 +9,7 @@
, pytestCheckHook
, pythonOlder
, pyyaml
, substituteAll
}:
buildPythonPackage rec {
@ -24,6 +26,21 @@ buildPythonPackage rec {
hash = "sha256-Qxa4uIiX5TAyQ5rFkizdev60S4iVAJ08ES6FpNqf8zI=";
};
patches = [
(substituteAll {
src = ./antlr4.patch;
antlr_jar = "${antlr4.out}/share/java/antlr-${antlr4.version}-complete.jar";
})
];
postPatch = ''
# We substitute the path to the jar with the one from our antlr4
# package, so this file becomes unused
rm -v build_helpers/bin/antlr*-complete.jar
sed -i 's/antlr4-python3-runtime==.*/antlr4-python3-runtime/' requirements/base.txt
'';
nativeBuildInputs = [
jre_minimal
];