2021-04-12 18:23:04 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, chardet
|
|
|
|
, fetchFromGitHub
|
|
|
|
, karton-core
|
2021-10-01 09:20:50 +00:00
|
|
|
, pytestCheckHook
|
2021-04-12 18:23:04 +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";
|
2021-10-01 09:20:50 +00:00
|
|
|
version = "1.2.0";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2021-04-12 18:23:04 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "CERT-Polska";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-10-01 09:20:50 +00:00
|
|
|
sha256 = "sha256-AG2CtNMgXYfbdlOqB1ZdjMT8H67fsSMXTgiFg6K41IQ=";
|
2021-04-12 18:23:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
chardet
|
|
|
|
karton-core
|
|
|
|
python_magic
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace requirements.txt \
|
|
|
|
--replace "chardet==3.0.4" "chardet" \
|
|
|
|
--replace "python-magic==0.4.18" "python-magic"
|
|
|
|
'';
|
|
|
|
|
2021-10-01 09:20:50 +00:00
|
|
|
checkInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
2021-04-12 18:23:04 +00:00
|
|
|
|
|
|
|
pythonImportsCheck = [ "karton.classifier" ];
|
|
|
|
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|