1{ lib 2, stdenv 3, appdirs 4, buildPythonPackage 5, fetchFromGitHub 6, lxml 7, packaging 8, py 9, pytestCheckHook 10, pythonOlder 11, termcolor 12, wireshark-cli 13}: 14 15buildPythonPackage rec { 16 pname = "pyshark"; 17 version = "0.6"; 18 format = "setuptools"; 19 20 disabled = pythonOlder "3.7"; 21 22 src = fetchFromGitHub { 23 owner = "KimiNewt"; 24 repo = pname; 25 rev = "refs/tags/v${version}"; 26 hash = "sha256-kzJDzUK6zknUyXPdKc4zMvWim4C5NQCSJSS45HI6hKM="; 27 }; 28 29 # `stripLen` does not seem to work here 30 patchFlags = [ "-p2" ]; 31 32 sourceRoot = "${src.name}/src"; 33 34 # propagate wireshark, so pyshark can find it when used 35 propagatedBuildInputs = [ 36 appdirs 37 lxml 38 packaging 39 py 40 termcolor 41 wireshark-cli 42 ]; 43 44 nativeCheckInputs = [ 45 py 46 pytestCheckHook 47 wireshark-cli 48 ]; 49 50 preCheck = '' 51 export HOME=$(mktemp -d) 52 ''; 53 54 disabledTests = [ 55 # flaky 56 # KeyError: 'Packet of index 0 does not exist in capture' 57 "test_getting_packet_summary" 58 ] ++ lib.optionals stdenv.isDarwin [ 59 # fails on darwin 60 # _pickle.PicklingError: logger cannot be pickled 61 "test_iterate_empty_psml_capture" 62 ]; 63 64 pythonImportsCheck = [ 65 "pyshark" 66 ]; 67 68 pytestFlagsArray = [ 69 "../tests/" 70 ]; 71 72 meta = with lib; { 73 description = "Python wrapper for tshark, allowing Python packet parsing using Wireshark dissectors"; 74 homepage = "https://github.com/KimiNewt/pyshark/"; 75 changelog = "https://github.com/KimiNewt/pyshark/releases/tag/${version}"; 76 license = licenses.mit; 77 maintainers = with maintainers; [ ]; 78 }; 79}