diff --git a/pkgs/development/python-modules/argos-translate-files/default.nix b/pkgs/development/python-modules/argos-translate-files/default.nix index dc86edc06605..6003dd24a067 100644 --- a/pkgs/development/python-modules/argos-translate-files/default.nix +++ b/pkgs/development/python-modules/argos-translate-files/default.nix @@ -1,5 +1,6 @@ { lib, + stdenv, buildPythonPackage, fetchFromGitHub, pytestCheckHook, @@ -11,6 +12,10 @@ translatehtml, }: +let + inherit (stdenv.hostPlatform) isLinux isAarch64; + isAarch64Linux = isLinux && isAarch64; +in buildPythonPackage (finalAttrs: { pname = "argos-translate-files"; version = "1.4.4"; @@ -43,15 +48,16 @@ buildPythonPackage (finalAttrs: { translatehtml ]; - doCheck = true; - nativeCheckInputs = [ pytestCheckHook # pythonImportsCheck needs a home dir for argostranslatefiles writableTmpDirAsHomeHook ]; - pythonImportsCheck = [ "argostranslatefiles" ]; + # aarch64-linux fails cpuinfo test, because /sys/devices/system/cpu/ does not exist in the sandbox: + # terminate called after throwing an instance of 'onnxruntime::OnnxRuntimeException' + pythonImportsCheck = lib.optional (!isAarch64Linux) "argostranslatefiles"; + doCheck = !isAarch64Linux; meta = { description = "Translate files using Argos Translate"; diff --git a/pkgs/development/python-modules/libretranslate/default.nix b/pkgs/development/python-modules/libretranslate/default.nix index 1b3cc31e3cf4..7a5561effa66 100644 --- a/pkgs/development/python-modules/libretranslate/default.nix +++ b/pkgs/development/python-modules/libretranslate/default.nix @@ -1,5 +1,6 @@ { lib, + stdenv, pkgs, buildPythonPackage, fetchFromGitHub, @@ -32,6 +33,10 @@ lndir, }: +let + inherit (stdenv.hostPlatform) isLinux isAarch64; + isAarch64Linux = isLinux && isAarch64; +in buildPythonPackage (finalAttrs: { pname = "libretranslate"; version = "1.9.5"; @@ -90,7 +95,11 @@ buildPythonPackage (finalAttrs: { # needed to import the argostranslate module nativeCheckInputs = [ writableTmpDirAsHomeHook ]; - pythonImportsCheck = [ "libretranslate" ]; + + # aarch64-linux fails cpuinfo test, because /sys/devices/system/cpu/ does not exist in the sandbox: + # terminate called after throwing an instance of 'onnxruntime::OnnxRuntimeException' + pythonImportsCheck = lib.optional (!isAarch64Linux) "libretranslate"; + doCheck = !isAarch64Linux; passthru = { static-compressed = diff --git a/pkgs/development/python-modules/translatehtml/default.nix b/pkgs/development/python-modules/translatehtml/default.nix index 3ae69fd354e1..87acf0ff9d99 100644 --- a/pkgs/development/python-modules/translatehtml/default.nix +++ b/pkgs/development/python-modules/translatehtml/default.nix @@ -1,49 +1,44 @@ { lib, + stdenv, buildPythonPackage, - fetchPypi, - fetchpatch, + fetchFromGitHub, + writableTmpDirAsHomeHook, + setuptools, argostranslate, beautifulsoup4, }: -buildPythonPackage rec { +let + inherit (stdenv.hostPlatform) isLinux isAarch64; + isAarch64Linux = isLinux && isAarch64; +in +buildPythonPackage (finalAttrs: { pname = "translatehtml"; - version = "1.5.2"; + version = "1.5.3"; + pyproject = true; - format = "setuptools"; - - src = fetchPypi { - inherit pname version; - sha256 = "6b30ceb8b6f174917e2660caf2d2ccbaa71d8d24c815316edf56b061d678820d"; + src = fetchFromGitHub { + owner = "argosopentech"; + repo = "translate-html"; + tag = "v${finalAttrs.version}"; + hash = "sha256-A94N/nfYSVwi0M3SpNFqlXrRNOCpIi9agOCAlH66QcI="; }; - patches = [ - # https://github.com/argosopentech/translate-html/pull/15 - (fetchpatch { - url = "https://github.com/argosopentech/translate-html/commit/b1c2d210ec1b5fcd0eb79f578bdb5d3ed5c9963a.patch"; - hash = "sha256-U65vVuRodMS32Aw6PZlLwaCos51P5B88n5hDgJNMZXU="; - }) - ]; + build-system = [ setuptools ]; - propagatedBuildInputs = [ + pythonRelaxDeps = [ "beautifulsoup4" ]; + + dependencies = [ argostranslate beautifulsoup4 ]; - postPatch = '' - ln -s */requires.txt requirements.txt - - substituteInPlace requirements.txt \ - --replace "==" ">=" - ''; - - # required for import check to work (argostranslate) - env.HOME = "/tmp"; - - pythonImportsCheck = [ "translatehtml" ]; - - doCheck = false; # no tests + # aarch64-linux fails cpuinfo test, because /sys/devices/system/cpu/ does not exist in the sandbox: + # terminate called after throwing an instance of 'onnxruntime::OnnxRuntimeException' + pythonImportsCheck = lib.optional (!isAarch64Linux) "translatehtml"; + nativeCheckInputs = [ writableTmpDirAsHomeHook ]; + doCheck = !isAarch64Linux; meta = { description = "Translate HTML using Beautiful Soup and Argos Translate"; @@ -51,4 +46,4 @@ buildPythonPackage rec { license = lib.licenses.mit; maintainers = with lib.maintainers; [ misuzu ]; }; -} +})