2021-04-12 18:23:04 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, chardet
|
|
|
|
, fetchFromGitHub
|
|
|
|
, karton-core
|
2021-10-01 09:20:50 +00:00
|
|
|
, pytestCheckHook
|
2022-05-18 14:49:53 +00:00
|
|
|
, python-magic
|
2021-10-01 09:20:50 +00:00
|
|
|
, pythonOlder
|
2021-04-12 18:23:04 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "karton-classifier";
|
2022-08-12 12:06:08 +00:00
|
|
|
version = "1.4.0";
|
|
|
|
format = "setuptools";
|
2021-10-01 09:20:50 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2021-04-12 18:23:04 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "CERT-Polska";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2022-08-12 12:06:08 +00:00
|
|
|
hash = "sha256-TRmAin0TAOIwR5EBMwTOJ9QaHO+mOx/eAjgqvyQZDj4=";
|
2021-04-12 18:23:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
chardet
|
|
|
|
karton-core
|
2022-05-18 14:49:53 +00:00
|
|
|
python-magic
|
2021-04-12 18:23:04 +00:00
|
|
|
];
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
checkInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
2021-04-12 18:23:04 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace requirements.txt \
|
|
|
|
--replace "chardet==3.0.4" "chardet" \
|
|
|
|
--replace "python-magic==0.4.18" "python-magic"
|
|
|
|
'';
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"karton.classifier"
|
2021-10-01 09:20:50 +00:00
|
|
|
];
|
2021-04-12 18:23:04 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
disabledTests = [
|
|
|
|
# Tests expecting results from a different version of libmagic
|
|
|
|
"test_process_archive_ace"
|
|
|
|
"test_process_runnable_win32_lnk"
|
|
|
|
];
|
2021-04-12 18:23:04 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "File type classifier for the Karton framework";
|
|
|
|
homepage = "https://github.com/CERT-Polska/karton-classifier";
|
|
|
|
license = with licenses; [ bsd3 ];
|
|
|
|
maintainers = with maintainers; [ fab ];
|
|
|
|
};
|
|
|
|
}
|