Unverified Commit 2b5f8c67 authored by Martin Weinelt's avatar Martin Weinelt Committed by GitHub
Browse files

Merge pull request #207851 from mweinelt/antlr4_11

parents 0f0929f4 e0beb61e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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; {
+27 −2
Original line number Diff line number Diff line
@@ -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";
+48 −0
Original line number Diff line number Diff line
{ 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;
  };
}
+13 −0
Original line number Diff line number Diff line
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/"),
+22 −5
Original line number Diff line number Diff line
{ 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;
Loading