2021-04-11 15:20:21 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, chardet
|
|
|
|
, fetchFromGitHub
|
|
|
|
, karton-core
|
2021-09-27 20:52:49 +00:00
|
|
|
, pytestCheckHook
|
2022-05-06 23:18:35 +00:00
|
|
|
, python-magic
|
2021-09-27 20:52:49 +00:00
|
|
|
, pythonOlder
|
2021-04-11 15:20:21 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "karton-classifier";
|
2023-06-22 12:11:51 +00:00
|
|
|
version = "2.0.0";
|
2022-08-09 20:55:41 +00:00
|
|
|
format = "setuptools";
|
2021-09-27 20:52:49 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2021-04-11 15:20:21 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "CERT-Polska";
|
|
|
|
repo = pname;
|
2023-02-09 11:21:44 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2023-06-22 12:11:51 +00:00
|
|
|
hash = "sha256-DH8I4Lbbs2TVMvYlvh/P2I/7O4+VechP2JDDVHNsTSg=";
|
2021-04-11 15:20:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
chardet
|
|
|
|
karton-core
|
2022-05-06 23:18:35 +00:00
|
|
|
python-magic
|
2021-04-11 15:20:21 +00:00
|
|
|
];
|
|
|
|
|
2023-01-21 12:00:00 +00:00
|
|
|
nativeCheckInputs = [
|
2022-08-09 20:55:41 +00:00
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
2021-04-11 15:20:21 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace requirements.txt \
|
|
|
|
--replace "chardet==3.0.4" "chardet" \
|
|
|
|
--replace "python-magic==0.4.18" "python-magic"
|
|
|
|
'';
|
|
|
|
|
2022-08-09 20:55:41 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"karton.classifier"
|
2021-09-27 20:52:49 +00:00
|
|
|
];
|
2021-04-11 15:20:21 +00:00
|
|
|
|
2022-08-09 20:55:41 +00:00
|
|
|
disabledTests = [
|
|
|
|
# Tests expecting results from a different version of libmagic
|
|
|
|
"test_process_archive_ace"
|
|
|
|
"test_process_runnable_win32_lnk"
|
2023-09-17 14:37:54 +00:00
|
|
|
"test_process_misc_csv"
|
2022-08-09 20:55:41 +00:00
|
|
|
];
|
2021-04-11 15:20:21 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "File type classifier for the Karton framework";
|
|
|
|
homepage = "https://github.com/CERT-Polska/karton-classifier";
|
2023-02-09 11:21:44 +00:00
|
|
|
changelog = "https://github.com/CERT-Polska/karton-classifier/releases/tag/v${version}";
|
2021-04-11 15:20:21 +00:00
|
|
|
license = with licenses; [ bsd3 ];
|
|
|
|
maintainers = with maintainers; [ fab ];
|
|
|
|
};
|
|
|
|
}
|