Merge pull request #207851 from mweinelt/antlr4_11

This commit is contained in:
Martin Weinelt 2022-12-28 13:31:13 +01:00 committed by GitHub
commit 2b5f8c67f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 178 additions and 35 deletions

View File

@ -14,7 +14,7 @@ buildPythonPackage rec {
# in 4.9, test was renamed to tests
checkPhase = ''
cd test*
${python.interpreter} ctest.py
${python.interpreter} run.py
'';
meta = with lib; {

View File

@ -2,9 +2,11 @@
, buildPythonPackage
, fetchFromGitHub
, fetchpatch
, antlr4
, antlr4-python3-runtime
, igraph
, pygments
, pytestCheckHook
}:
buildPythonPackage rec {
@ -18,6 +20,10 @@ buildPythonPackage rec {
sha256 = "1vzyliiyrxx8l9sfbqcyr4xn5swd7znkxy69kn0vb5rban8hm9c1";
};
nativeBuildInputs = [
antlr4
];
patches = [
# https://github.com/SkyTemple/ExplorerScript/pull/17
(fetchpatch {
@ -26,8 +32,27 @@ buildPythonPackage rec {
})
];
propagatedBuildInputs = [ antlr4-python3-runtime igraph ];
checkInputs = [ pygments ];
postPatch = ''
sed -i "s/antlr4-python3-runtime.*/antlr4-python3-runtime',/" setup.py
antlr -Dlanguage=Python3 -visitor explorerscript/antlr/{ExplorerScript,SsbScript}.g4
'';
propagatedBuildInputs = [
antlr4-python3-runtime
igraph
];
passthru.optional-dependencies.pygments = [
pygments
];
checkInputs = [
pytestCheckHook
] ++ passthru.optional-dependencies.pygments;
pythonImportsCheck = [
"explorerscript"
];
meta = with lib; {
homepage = "https://github.com/SkyTemple/explorerscript";

View File

@ -0,0 +1,48 @@
{ lib
, buildPythonPackage
, fetchPypi
# propagates
, antlr4-python3-runtime
, dataclasses-json
, pyyaml
# tests
, pytestCheckHook
}:
let
pname = "hassil";
version = "0.1.3";
in
buildPythonPackage {
inherit pname version;
format = "setuptools";
src = fetchPypi {
inherit pname version;
hash = "sha256-KWkzHWMo50OIrZ2kwFhhqDSleFFkAD7/JugjvSyCkww=";
};
postPatch = ''
sed -i 's/antlr4-python3-runtime==.*/antlr4-python3-runtime/' requirements.txt
'';
propagatedBuildInputs = [
antlr4-python3-runtime
dataclasses-json
pyyaml
];
checkInputs = [
pytestCheckHook
];
meta = with lib; {
changelog = "https://github.com/home-assistant/hassil/releases/tag/v${version}";
description = "Intent parsing for Home Assistant";
homepage = "https://github.com/home-assistant/hassil";
license = licenses.asl20;
maintainers = teams.home-assistant.members;
};
}

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,6 +1,7 @@
{ stdenv
, lib
, antlr4_9-python3-runtime
, antlr4
, antlr4-python3-runtime
, buildPythonPackage
, fetchFromGitHub
, importlib-resources
@ -8,10 +9,11 @@
, omegaconf
, pytestCheckHook
, pythonOlder
, substituteAll
}:
buildPythonPackage rec {
pname = "hydra";
pname = "hydra-core";
version = "1.3.1";
format = "setuptools";
@ -19,17 +21,32 @@ buildPythonPackage rec {
src = fetchFromGitHub {
owner = "facebookresearch";
repo = pname;
repo = "hydra";
rev = "refs/tags/v${version}";
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
];
propagatedBuildInputs = [
antlr4_9-python3-runtime
antlr4-python3-runtime
omegaconf
] ++ lib.optionals (pythonOlder "3.9") [
importlib-resources
@ -55,7 +72,7 @@ buildPythonPackage rec {
];
meta = with lib; {
broken = (stdenv.isLinux && stdenv.isAarch64) || stdenv.isDarwin;
broken = stdenv.isDarwin;
description = "A framework for configuring complex applications";
homepage = "https://hydra.cc";
license = licenses.mit;

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,5 +1,6 @@
{ lib
, antlr4_9-python3-runtime
, antlr4
, antlr4-python3-runtime
, buildPythonPackage
, fetchFromGitHub
, jre_minimal
@ -8,6 +9,7 @@
, pytestCheckHook
, pythonOlder
, pyyaml
, substituteAll
}:
buildPythonPackage rec {
@ -24,12 +26,27 @@ 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
];
propagatedBuildInputs = [
antlr4_9-python3-runtime
antlr4-python3-runtime
pyyaml
];

View File

@ -1,4 +1,8 @@
{ lib, stdenv, fetchFromGitHub, substituteAll, antlr4, libargs, catch2, cmake, libyamlcpp }:
{ lib, stdenv, fetchFromGitHub, substituteAll, antlr4_9, libargs, catch2, cmake, libyamlcpp }:
let
antlr4 = antlr4_9;
in
stdenv.mkDerivation rec {
pname = "luaformatter";

View File

@ -2,30 +2,38 @@
, fetchFromGitLab
, makeWrapper
, python3
, antlr4_9
}:
let
baserow_premium = with python3.pkgs; ( buildPythonPackage rec {
pname = "baserow_premium";
version = "1.12.1";
foramt = "setuptools";
python = python3.override {
packageOverrides = self: super: {
antlr4-python3-runtime = super.antlr4-python3-runtime.override {
antlr4 = antlr4_9;
};
src = fetchFromGitLab {
owner = "bramw";
repo = pname;
rev = "refs/tags/${version}";
hash = "sha256-zT2afl3QNE2dO3JXjsZXqSmm1lv3EorG3mYZLQQMQ2Q=";
baserow_premium = self.buildPythonPackage rec {
pname = "baserow_premium";
version = "1.12.1";
foramt = "setuptools";
src = fetchFromGitLab {
owner = "bramw";
repo = pname;
rev = "refs/tags/${version}";
hash = "sha256-zT2afl3QNE2dO3JXjsZXqSmm1lv3EorG3mYZLQQMQ2Q=";
};
sourceRoot = "source/premium/backend";
doCheck = false;
};
};
sourceRoot = "source/premium/backend";
doCheck = false;
});
};
in
with python3.pkgs; buildPythonPackage rec {
with python.pkgs; buildPythonApplication rec {
pname = "baserow";
version = "1.12.1";
format = "setuptools";

View File

@ -16652,7 +16652,7 @@ with pkgs;
antlr4_10
antlr4_11;
antlr4 = antlr4_8;
antlr4 = antlr4_11;
antlr = antlr4;

View File

@ -488,13 +488,9 @@ self: super: with self; {
ansiwrap = callPackage ../development/python-modules/ansiwrap { };
antlr4_8-python3-runtime = callPackage ../development/python-modules/antlr4-python3-runtime {
antlr4 = pkgs.antlr4_8;
antlr4-python3-runtime = callPackage ../development/python-modules/antlr4-python3-runtime {
inherit (pkgs) antlr4;
};
antlr4_9-python3-runtime = callPackage ../development/python-modules/antlr4-python3-runtime {
antlr4 = pkgs.antlr4_9;
};
antlr4-python3-runtime = self.antlr4_8-python3-runtime;
anyascii = callPackage ../development/python-modules/anyascii { };
@ -4173,6 +4169,8 @@ self: super: with self; {
hass-nabucasa = callPackage ../development/python-modules/hass-nabucasa { };
hassil = callPackage ../development/python-modules/hassil { };
hatasmota = callPackage ../development/python-modules/hatasmota { };
hatchling = callPackage ../development/python-modules/hatchling { };
@ -4389,7 +4387,7 @@ self: super: with self; {
hy = callPackage ../development/python-modules/hy { };
hydra = callPackage ../development/python-modules/hydra { };
hydra-core = callPackage ../development/python-modules/hydra-core { };
hydra-check = callPackage ../development/python-modules/hydra-check { };