Commit 15622e7e authored by Steven Allen's avatar Steven Allen
Browse files

python3Packages.lexilang: compile and install dictionaries

parent 8f7ad1dd
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
  python,
}:

buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
  pname = "lexilang";
  version = "1.0.7";
  pyproject = true;
@@ -14,12 +14,20 @@ buildPythonPackage rec {
  src = fetchFromGitHub {
    owner = "LibreTranslate";
    repo = "LexiLang";
    tag = "v${version}";
    tag = "v${finalAttrs.version}";
    hash = "sha256-5/P9u2naTTyG5l3uhrinRIAekyOYn8OKLwb/VEON2Vc=";
  };

  build-system = [ setuptools ];

  # Upstream builds in CI:
  # https://github.com/LibreTranslate/LexiLang/blob/ba49108a736b9c077ea45cbe61d54fa635fe25d5/.github/workflows/publish.yml#L30-L31
  postInstall = ''
    ${lib.getExe python} -c "from lexilang.utils import compile_data; compile_data()"
    rm -f lexilang/data/.gitignore
    cp -r lexilang/data $out/${python.sitePackages}/lexilang/data
  '';

  pythonImportsCheck = [ "lexilang" ];

  checkPhase = ''
@@ -34,4 +42,4 @@ buildPythonPackage rec {
    license = lib.licenses.agpl3Only;
    maintainers = with lib.maintainers; [ izorkin ];
  };
}
})