python3.packages.pyshark: fix build with wireshark4

due to the update of wireshark 3.6.5 -> 4.0.1 the tests
fail for pyshark due to a change in wireshark. This applies an
upstream patch and adds the wireshark dependency to pyshark's
propagatedBuildInputs. Otherwise one would have to add wireshark
manually to the environment. pyshark won't work without wireshark.

Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
This commit is contained in:
Florian Brandes 2022-11-01 09:06:44 +01:00 committed by Daniel Albert
parent 735ab1984b
commit 00479e2d5a
No known key found for this signature in database
GPG Key ID: 08C68B46CA8BF970

View File

@ -1,5 +1,6 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, fetchpatch
, fetchFromGitHub , fetchFromGitHub
, appdirs , appdirs
, lxml , lxml
@ -24,34 +25,36 @@ buildPythonPackage rec {
hash = "sha256-byll2GWY2841AAf8Xh+KfaCOtMGVKabTsLCe3gCdZ1o="; hash = "sha256-byll2GWY2841AAf8Xh+KfaCOtMGVKabTsLCe3gCdZ1o=";
}; };
patches = [
(fetchpatch {
name = "fix-mapping.patch";
url =
"https://github.com/KimiNewt/pyshark/pull/608/commits/c2feb17ef621390481d6acc29dbf807d6851ed4c.patch";
hash = "sha256-TY09HPxqJP3zI8+ugm518aMuBgog7wrXs5uoReHHaEI=";
})
];
# `stripLen` does not seem to work here
patchFlags = "-p2";
sourceRoot = "${src.name}/src"; sourceRoot = "${src.name}/src";
propagatedBuildInputs = [ # propagate wireshark, so pyshark can find it when used
appdirs propagatedBuildInputs = [ appdirs py lxml packaging wireshark-cli ];
py
lxml
packaging
];
preCheck = '' preCheck = ''
export HOME=$(mktemp -d) export HOME=$(mktemp -d)
''; '';
checkInputs = [ checkInputs = [ pytestCheckHook wireshark-cli ];
pytestCheckHook
wireshark-cli
];
pythonImportsCheck = [ pythonImportsCheck = [ "pyshark" ];
"pyshark"
];
pytestFlagsArray = [ pytestFlagsArray = [ "../tests/" ];
"../tests/"
];
meta = with lib; { meta = with lib; {
description = "Python wrapper for tshark, allowing Python packet parsing using Wireshark dissectors"; description =
"Python wrapper for tshark, allowing Python packet parsing using Wireshark dissectors";
homepage = "https://github.com/KimiNewt/pyshark/"; homepage = "https://github.com/KimiNewt/pyshark/";
license = licenses.mit; license = licenses.mit;
maintainers = with maintainers; [ ]; maintainers = with maintainers; [ ];