python3Packages.hydra-core: unpin antlr4-python3-runtime

This commit is contained in:
Martin Weinelt 2022-12-27 20:01:20 +01:00
parent 47967562fa
commit b71ad92137
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 7159d22615..73db312bbe 100644
--- a/build_helpers/build_helpers.py
+++ b/build_helpers/build_helpers.py
@@ -185,7 +185,7 @@ class ANTLRCommand(Command): # type: ignore
command = [
"java",
"-jar",
- join(root_dir, "bin/antlr-4.9.3-complete.jar"),
+ "@antlr_jar@",
"-Dlanguage=Python3",
"-o",
join(project_root, "hydra/grammar/gen/"),

View file

@ -1,5 +1,6 @@
{ stdenv
, lib
, antlr4
, antlr4-python3-runtime
, buildPythonPackage
, fetchFromGitHub
@ -8,6 +9,7 @@
, omegaconf
, pytestCheckHook
, pythonOlder
, substituteAll
}:
buildPythonPackage rec {
@ -24,6 +26,21 @@ buildPythonPackage rec {
hash = "sha256-4FOh1Jr+LM8ffh/xcAqMqKudKbXb2DZdxU+czq2xwxs=";
};
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/requirements.txt
'';
nativeBuildInputs = [
jre_headless
];