summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/magika/default.nix
diff options
context:
space:
mode:
authorGaƩtan Lepage <gaetan@glepage.com>2026-01-21 13:47:00 +0000
committerGitHub <noreply@github.com>2026-01-21 13:47:00 +0000
commite336b4e1e78b5a5f135fa72f7ec091c5d03ca0e1 (patch)
treee7e9fecd522cc45e7aa236f7eae84ce4a860fde3 /pkgs/development/python-modules/magika/default.nix
parent655d632475aab9d431e81cbcec8c361e4233bb82 (diff)
parentf2d8a154a5d63d8d22a23489ff4ccaa420ce6753 (diff)
python3Packages.{magika,rembg,markitdown}: fix build on aarch64-linux by disabling tests (#482225)HEADmaster
Diffstat (limited to 'pkgs/development/python-modules/magika/default.nix')
-rw-r--r--pkgs/development/python-modules/magika/default.nix29
1 files changed, 22 insertions, 7 deletions
diff --git a/pkgs/development/python-modules/magika/default.nix b/pkgs/development/python-modules/magika/default.nix
index 504063f6e12c..a1846e289f69 100644
--- a/pkgs/development/python-modules/magika/default.nix
+++ b/pkgs/development/python-modules/magika/default.nix
@@ -1,20 +1,30 @@
{
lib,
+ stdenv,
buildPythonPackage,
- click,
fetchPypi,
+
+ # build-system
+ hatchling,
+
+ # dependencies
+ click,
numpy,
onnxruntime,
- hatchling,
python-dotenv,
tabulate,
tqdm,
+
+ # tests
pytestCheckHook,
dacite,
versionCheckHook,
}:
-buildPythonPackage rec {
+let
+ isNotAarch64Linux = !(stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64);
+in
+buildPythonPackage (finalAttrs: {
pname = "magika";
version = "1.0.1";
pyproject = true;
@@ -23,7 +33,7 @@ buildPythonPackage rec {
# Pypi tarball contains a pure python implementation of magika
# while GitHub source requires compiling magika-cli
src = fetchPypi {
- inherit pname version;
+ inherit (finalAttrs) pname version;
hash = "sha256-MT+Mv83Jp+VcJChicyMKJzK4mCXlipPeK1dlMTk7g5g=";
};
@@ -63,14 +73,19 @@ buildPythonPackage rec {
"test_magika_module_with_previously_missdetected_samples"
];
- pythonImportsCheck = [ "magika" ];
+ # 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'
+ #
+ # -> Skip all tests that require importing magika
+ pythonImportsCheck = lib.optionals isNotAarch64Linux [ "magika" ];
+ doCheck = isNotAarch64Linux;
meta = {
description = "Detect file content types with deep learning";
homepage = "https://github.com/google/magika";
- changelog = "https://github.com/google/magika/blob/python-v${version}/python/CHANGELOG.md";
+ changelog = "https://github.com/google/magika/blob/python-v${finalAttrs.version}/python/CHANGELOG.md";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ mihaimaruseac ];
mainProgram = "magika-python-client";
};
-}
+})