libretranslate: 1.9.0 -> 1.9.5; modernize (#501086)

This commit is contained in:
misuzu
2026-03-19 17:32:45 +00:00
committed by GitHub
2 changed files with 41 additions and 25 deletions
@@ -1,7 +1,8 @@
{
lib,
buildPythonPackage,
fetchPypi,
fetchFromGitHub,
pytestCheckHook,
writableTmpDirAsHomeHook,
setuptools,
lxml,
@@ -10,18 +11,31 @@
translatehtml,
}:
buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
pname = "argos-translate-files";
version = "1.4.1";
version = "1.4.4";
pyproject = true;
src = fetchPypi {
inherit pname version;
hash = "sha256-9ufNuExfyW3gr8+pIpp6Ie03e0hE4l3l3kk6EiVH0x8=";
src = fetchFromGitHub {
owner = "LibreTranslate";
repo = "argos-translate-files";
tag = "v${finalAttrs.version}";
hash = "sha256-6AxVBiK0g6ajstyCQZ9ExF9MRYSLd4Frw03N7c9bvuI=";
};
build-system = [ setuptools ];
pythonRelaxDeps = [ "beautifulsoup4" ];
# LibreTranslate has forked argos-translate [1] to fix some bugs and
# make stanza optional, but it's unclear what the future of this fork
# is.
#
# We'll stay on upstream argostranslate for now.
#
# [1]: https://github.com/Libretranslate/argos-translate/
pythonRemoveDeps = [ "argos-translate-lt" ];
dependencies = [
lxml
pymupdf
@@ -29,15 +43,14 @@ buildPythonPackage rec {
translatehtml
];
doCheck = true;
nativeCheckInputs = [
pytestCheckHook
# pythonImportsCheck needs a home dir for argostranslatefiles
writableTmpDirAsHomeHook
];
postPatch = ''
ln -s */requires.txt requirements.txt
'';
pythonImportsCheck = [ "argostranslatefiles" ];
meta = {
@@ -46,4 +59,4 @@ buildPythonPackage rec {
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ misuzu ];
};
}
})
@@ -3,7 +3,7 @@
pkgs,
buildPythonPackage,
fetchFromGitHub,
pytestCheckHook,
writableTmpDirAsHomeHook,
runCommand,
hatchling,
argostranslate,
@@ -32,16 +32,16 @@
lndir,
}:
buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
pname = "libretranslate";
version = "1.9.0";
version = "1.9.5";
pyproject = true;
src = fetchFromGitHub {
owner = "LibreTranslate";
repo = "LibreTranslate";
tag = "v${version}";
hash = "sha256-bBs7gG42H4MNca5RUiedKNQkLjKpBm2SbPMRyh2gh6c=";
tag = "v${finalAttrs.version}";
hash = "sha256-VcMo1GX+ituQOW8Dpt0ABJG5fsJbFuxAPmi59Byg5ww=";
};
build-system = [
@@ -50,6 +50,14 @@ buildPythonPackage rec {
pythonRelaxDeps = true;
# LibreTranslate has forked argos-translate [1] to fix some bugs and make stanza optional, but it's
# unclear what the future of this fork is.
#
# We'll stay on upstream argostranslate for now.
#
# [1]: https://github.com/Libretranslate/argos-translate/
pythonRemoveDeps = [ "argos-translate-lt" ];
dependencies = [
argostranslate
flask
@@ -80,13 +88,8 @@ buildPythonPackage rec {
ln -s $out/${python.sitePackages}/libretranslate/static $out/share/libretranslate/static
'';
doCheck = false; # needs network access
nativeCheckInputs = [ pytestCheckHook ];
# required for import check to work (argostranslate)
env.HOME = "/tmp";
# needed to import the argostranslate module
nativeCheckInputs = [ writableTmpDirAsHomeHook ];
pythonImportsCheck = [ "libretranslate" ];
passthru = {
@@ -112,8 +115,8 @@ buildPythonPackage rec {
meta = {
description = "Free and Open Source Machine Translation API. Self-hosted, no limits, no ties to proprietary services";
homepage = "https://libretranslate.com";
changelog = "https://github.com/LibreTranslate/LibreTranslate/releases/tag/${src.tag}";
changelog = "https://github.com/LibreTranslate/LibreTranslate/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.agpl3Only;
maintainers = with lib.maintainers; [ misuzu ];
};
}
})