at master 1.8 kB view raw
1{ 2 lib, 3 stdenv, 4 appdirs, 5 buildPythonPackage, 6 fetchFromGitHub, 7 fetchpatch, 8 lxml, 9 packaging, 10 pytestCheckHook, 11 replaceVars, 12 setuptools, 13 termcolor, 14 wireshark-cli, 15}: 16 17buildPythonPackage rec { 18 pname = "pyshark"; 19 version = "0.6"; 20 pyproject = true; 21 22 src = fetchFromGitHub { 23 owner = "KimiNewt"; 24 repo = "pyshark"; 25 tag = "v${version}"; 26 hash = "sha256-kzJDzUK6zknUyXPdKc4zMvWim4C5NQCSJSS45HI6hKM="; 27 }; 28 29 # `stripLen` does not seem to work here 30 patchFlags = [ "-p2" ]; 31 32 patches = [ 33 # fixes capture test 34 (fetchpatch { 35 url = "https://github.com/KimiNewt/pyshark/commit/7142c5bf88abcd4c65c81052a00226d6155dda42.patch"; 36 hash = "sha256-Ti7cwRyYSbF4a4pEEV9FntNevkV/JVXNqACQWzoma7g="; 37 }) 38 (replaceVars ./hardcode-tshark-path.patch { 39 tshark = lib.getExe' wireshark-cli "tshark"; 40 }) 41 ]; 42 43 sourceRoot = "${src.name}/src"; 44 45 build-system = [ setuptools ]; 46 47 dependencies = [ 48 appdirs 49 lxml 50 packaging 51 termcolor 52 ]; 53 54 nativeCheckInputs = [ 55 pytestCheckHook 56 ]; 57 58 preCheck = '' 59 export HOME=$(mktemp -d) 60 ''; 61 62 disabledTests = [ 63 # flaky 64 # KeyError: 'Packet of index 0 does not exist in capture' 65 "test_getting_packet_summary" 66 ] 67 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 68 # fails on darwin 69 # _pickle.PicklingError: logger cannot be pickled 70 "test_iterate_empty_psml_capture" 71 ]; 72 73 pythonImportsCheck = [ "pyshark" ]; 74 75 enabledTestPaths = [ "../tests/" ]; 76 77 meta = with lib; { 78 description = "Python wrapper for tshark, allowing Python packet parsing using Wireshark dissectors"; 79 homepage = "https://github.com/KimiNewt/pyshark/"; 80 changelog = "https://github.com/KimiNewt/pyshark/releases/tag/${version}"; 81 license = licenses.mit; 82 maintainers = [ ]; 83 }; 84}