python313Packages.argostranslate: modernize and enable tests
1. Modernize per feedback received in #491271. 2. Enable checks and disable the single one that doesn't work. Co-authored-by: Sarah Clark <seclark@nextquestion.net>
This commit is contained in:
co-authored by
Sarah Clark
parent
3224dc88db
commit
c3765f82f7
@@ -1,13 +1,18 @@
|
||||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchPypi,
|
||||
pytestCheckHook,
|
||||
fetchFromGitHub,
|
||||
# build-system
|
||||
setuptools,
|
||||
# dependencies
|
||||
ctranslate2,
|
||||
ctranslate2-cpp,
|
||||
sacremoses,
|
||||
sentencepiece,
|
||||
stanza,
|
||||
# tests
|
||||
pytestCheckHook,
|
||||
writableTmpDirAsHomeHook,
|
||||
}:
|
||||
let
|
||||
ctranslate2OneDNN = ctranslate2.override {
|
||||
@@ -18,38 +23,36 @@ let
|
||||
};
|
||||
};
|
||||
in
|
||||
buildPythonPackage rec {
|
||||
buildPythonPackage (finalAttrs: {
|
||||
pname = "argostranslate";
|
||||
version = "1.9.6";
|
||||
pyproject = true;
|
||||
|
||||
format = "setuptools";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
hash = "sha256-3YzBMnqmcTIpn5UOFg3SDTFLjPSE9UDw0i8fB8LYh2s=";
|
||||
src = fetchFromGitHub {
|
||||
owner = "argosopentech";
|
||||
repo = "argos-translate";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-OFF2DAcuRwEJxZebgRq5Ukb/TaNsP/rsO7BUAcD+lz8=";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [
|
||||
build-system = [ setuptools ];
|
||||
|
||||
dependencies = [
|
||||
ctranslate2OneDNN
|
||||
sacremoses
|
||||
sentencepiece
|
||||
stanza
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
ln -s */requires.txt requirements.txt
|
||||
nativeCheckInputs = [
|
||||
pytestCheckHook
|
||||
writableTmpDirAsHomeHook
|
||||
];
|
||||
|
||||
substituteInPlace requirements.txt \
|
||||
--replace "==" ">="
|
||||
'';
|
||||
|
||||
doCheck = false; # needs network access
|
||||
|
||||
nativeCheckInputs = [ pytestCheckHook ];
|
||||
|
||||
# required for import check to work
|
||||
# PermissionError: [Errno 13] Permission denied: '/homeless-shelter'
|
||||
env.HOME = "/tmp";
|
||||
pythonRelaxDeps = [
|
||||
"stanza"
|
||||
"sentencepiece"
|
||||
];
|
||||
|
||||
pythonImportsCheck = [
|
||||
"argostranslate"
|
||||
@@ -59,7 +62,8 @@ buildPythonPackage rec {
|
||||
meta = {
|
||||
description = "Open-source offline translation library written in Python";
|
||||
homepage = "https://www.argosopentech.com";
|
||||
changelog = "https://github.com/argosopentech/argos-translate/releases/tag/${finalAttrs.src.tag}";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ misuzu ];
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user