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