1{ 2 lib, 3 buildPythonPackage, 4 chardet, 5 fetchFromGitHub, 6 karton-core, 7 pytestCheckHook, 8 python-magic, 9 pythonOlder, 10}: 11 12buildPythonPackage rec { 13 pname = "karton-classifier"; 14 version = "2.0.0"; 15 format = "setuptools"; 16 17 disabled = pythonOlder "3.7"; 18 19 src = fetchFromGitHub { 20 owner = "CERT-Polska"; 21 repo = pname; 22 rev = "refs/tags/v${version}"; 23 hash = "sha256-DH8I4Lbbs2TVMvYlvh/P2I/7O4+VechP2JDDVHNsTSg="; 24 }; 25 26 propagatedBuildInputs = [ 27 chardet 28 karton-core 29 python-magic 30 ]; 31 32 nativeCheckInputs = [ pytestCheckHook ]; 33 34 postPatch = '' 35 substituteInPlace requirements.txt \ 36 --replace "chardet==3.0.4" "chardet" \ 37 --replace "python-magic==0.4.18" "python-magic" 38 ''; 39 40 pythonImportsCheck = [ "karton.classifier" ]; 41 42 disabledTests = [ 43 # Tests expecting results from a different version of libmagic 44 "test_process_archive_ace" 45 "test_process_runnable_win32_lnk" 46 "test_process_misc_csv" 47 ]; 48 49 meta = with lib; { 50 description = "File type classifier for the Karton framework"; 51 mainProgram = "karton-classifier"; 52 homepage = "https://github.com/CERT-Polska/karton-classifier"; 53 changelog = "https://github.com/CERT-Polska/karton-classifier/releases/tag/v${version}"; 54 license = with licenses; [ bsd3 ]; 55 maintainers = with maintainers; [ fab ]; 56 }; 57}