nixpkgs/pkgs/development/python-modules/pypcap/default.nix
adisbladis 02dab4ab5c python3.pkgs.*: Explicitly pass buildPythonPackage format parameter
Long term we should move everything over to `pyproject = true`, but in
the mean time we can work towards deprecating the implicit `format` paremeter.

cc https://github.com/NixOS/nixpkgs/issues/253154
cc @mweinelt @figsoda
2023-12-07 17:46:49 +01:00

47 lines
1.0 KiB
Nix

{ lib
, buildPythonPackage
, dpkt
, fetchFromGitHub
, libpcap
, pytestCheckHook
}:
buildPythonPackage rec {
pname = "pypcap";
version = "1.3.0";
format = "setuptools";
src = fetchFromGitHub {
owner = "pynetwork";
repo = pname;
# No release was tagged and PyPI doesn't contain tests.
rev = "968859f0ffb5b7c990506dffe82457b7de23a026";
hash = "sha256-NfyEC3qEBm6TjebcDIsoz8tJWaJ625ZFPfx7AMyynWE=";
};
postPatch = ''
# Add the path to libpcap in the nix-store
substituteInPlace setup.py --replace "('/usr', sys.prefix)" "'${libpcap}'"
# Remove coverage from test run
sed -i "/--cov/d" setup.cfg
'';
buildInputs = [ libpcap ];
nativeCheckInputs = [
dpkt
pytestCheckHook
];
pytestFlagsArray = [ "tests" ];
pythonImportsCheck = [ "pcap" ];
meta = with lib; {
homepage = "https://github.com/pynetwork/pypcap";
description = "Simplified object-oriented Python wrapper for libpcap";
license = licenses.bsd3;
maintainers = with maintainers; [ oxzi ];
};
}