1{ lib 2, stdenv 3, buildPythonPackage 4, fetchFromGitHub 5, fetchpatch 6, substituteAll 7, file 8, pytestCheckHook 9}: 10 11buildPythonPackage rec { 12 pname = "python-magic"; 13 version = "0.4.27"; 14 15 src = fetchFromGitHub { 16 owner = "ahupp"; 17 repo = "python-magic"; 18 rev = version; 19 hash = "sha256-fZ+5xJ3P0EYK+6rQ8VzXv2zckKfEH5VUdISIR6ybIfQ="; 20 }; 21 22 patches = [ 23 (substituteAll { 24 src = ./libmagic-path.patch; 25 libmagic = "${file}/lib/libmagic${stdenv.hostPlatform.extensions.sharedLibrary}"; 26 }) 27 (fetchpatch { 28 name = "update-test-for-upstream-added-gzip-extensions.patch"; 29 url = "https://github.com/ahupp/python-magic/commit/4ffcd59113fa26d7c2e9d5897b1eef919fd4b457.patch"; 30 hash = "sha256-67GpjlGiR4/os/iZ69V+ZziVLpjmid+7t+gQ2aQy9I0="; 31 }) 32 33 # Upstream patch to amend test suite for-5.45: 34 # https://github.com/ahupp/python-magic/pull/290 35 (fetchpatch { 36 name = "file-5.45.patch"; 37 url = "https://github.com/ahupp/python-magic/commit/3d2405ca80cd39b2a91decd26af81dcf181390a4.patch"; 38 hash = "sha256-HRsnO9MGfMD9BkJdC4SrEFQ1OZEaXpwakXFLoaCPK94="; 39 }) 40 ]; 41 42 preCheck = '' 43 export LC_ALL=en_US.UTF-8 44 ''; 45 46 nativeCheckInputs = [ 47 pytestCheckHook 48 ]; 49 50 meta = with lib; { 51 description = "A python interface to the libmagic file type identification library"; 52 homepage = "https://github.com/ahupp/python-magic"; 53 license = licenses.mit; 54 maintainers = with maintainers; [ ]; 55 }; 56}