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