1{ lib
2, buildPythonPackage
3, fetchpatch
4, fetchFromGitHub
5, appdirs
6, lxml
7, packaging
8, py
9, pytestCheckHook
10, pythonOlder
11, wireshark-cli
12}:
13
14buildPythonPackage rec {
15 pname = "pyshark";
16 version = "0.5.3";
17 format = "setuptools";
18
19 disabled = pythonOlder "3.7";
20
21 src = fetchFromGitHub {
22 owner = "KimiNewt";
23 repo = pname;
24 rev = "refs/tags/v${version}";
25 hash = "sha256-byll2GWY2841AAf8Xh+KfaCOtMGVKabTsLCe3gCdZ1o=";
26 };
27
28 patches = [
29 (fetchpatch {
30 name = "fix-mapping.patch";
31 url =
32 "https://github.com/KimiNewt/pyshark/pull/608/commits/c2feb17ef621390481d6acc29dbf807d6851ed4c.patch";
33 hash = "sha256-TY09HPxqJP3zI8+ugm518aMuBgog7wrXs5uoReHHaEI=";
34 })
35 ];
36
37 # `stripLen` does not seem to work here
38 patchFlags = "-p2";
39
40 sourceRoot = "${src.name}/src";
41
42 # propagate wireshark, so pyshark can find it when used
43 propagatedBuildInputs = [ appdirs py lxml packaging wireshark-cli ];
44
45 preCheck = ''
46 export HOME=$(mktemp -d)
47 '';
48
49 checkInputs = [ pytestCheckHook wireshark-cli ];
50
51 pythonImportsCheck = [ "pyshark" ];
52
53 pytestFlagsArray = [ "../tests/" ];
54
55 meta = with lib; {
56 description =
57 "Python wrapper for tshark, allowing Python packet parsing using Wireshark dissectors";
58 homepage = "https://github.com/KimiNewt/pyshark/";
59 license = licenses.mit;
60 maintainers = with maintainers; [ ];
61 };
62}