2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
appdirs,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
lxml,
|
|
|
|
packaging,
|
|
|
|
py,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
termcolor,
|
|
|
|
wireshark-cli,
|
2022-06-16 17:23:12 +00:00
|
|
|
}:
|
2021-02-13 14:23:35 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pyshark";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "0.6";
|
2022-06-16 17:23:12 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2021-02-13 14:23:35 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "KimiNewt";
|
|
|
|
repo = pname;
|
2022-06-16 17:23:12 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2023-07-15 17:15:38 +00:00
|
|
|
hash = "sha256-kzJDzUK6zknUyXPdKc4zMvWim4C5NQCSJSS45HI6hKM=";
|
2021-02-13 14:23:35 +00:00
|
|
|
};
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
# `stripLen` does not seem to work here
|
2022-12-17 10:02:37 +00:00
|
|
|
patchFlags = [ "-p2" ];
|
2022-11-21 17:40:18 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
sourceRoot = "${src.name}/src";
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
# propagate wireshark, so pyshark can find it when used
|
2023-07-15 17:15:38 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
appdirs
|
|
|
|
lxml
|
|
|
|
packaging
|
|
|
|
py
|
|
|
|
termcolor
|
|
|
|
wireshark-cli
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
py
|
|
|
|
pytestCheckHook
|
|
|
|
wireshark-cli
|
|
|
|
];
|
2021-02-13 14:23:35 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
preCheck = ''
|
2022-08-21 13:32:41 +00:00
|
|
|
export HOME=$(mktemp -d)
|
2022-08-12 12:06:08 +00:00
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
disabledTests =
|
|
|
|
[
|
|
|
|
# flaky
|
|
|
|
# KeyError: 'Packet of index 0 does not exist in capture'
|
|
|
|
"test_getting_packet_summary"
|
|
|
|
]
|
|
|
|
++ lib.optionals stdenv.isDarwin [
|
|
|
|
# fails on darwin
|
|
|
|
# _pickle.PicklingError: logger cannot be pickled
|
|
|
|
"test_iterate_empty_psml_capture"
|
|
|
|
];
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "pyshark" ];
|
2022-06-16 17:23:12 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pytestFlagsArray = [ "../tests/" ];
|
2021-03-19 17:17:44 +00:00
|
|
|
|
2021-02-13 14:23:35 +00:00
|
|
|
meta = with lib; {
|
2023-07-15 17:15:38 +00:00
|
|
|
description = "Python wrapper for tshark, allowing Python packet parsing using Wireshark dissectors";
|
2021-02-13 14:23:35 +00:00
|
|
|
homepage = "https://github.com/KimiNewt/pyshark/";
|
2023-07-15 17:15:38 +00:00
|
|
|
changelog = "https://github.com/KimiNewt/pyshark/releases/tag/${version}";
|
2021-02-13 14:23:35 +00:00
|
|
|
license = licenses.mit;
|
2024-07-31 10:19:44 +00:00
|
|
|
maintainers = [ ];
|
2021-02-13 14:23:35 +00:00
|
|
|
};
|
|
|
|
}
|