at master 1.9 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchPypi, 6 pythonOlder, 7 dbus, 8 pkgsLibpcap, 9 pkg-about, 10 setuptools, 11 pytestCheckHook, 12}: 13 14buildPythonPackage rec { 15 pname = "libpcap"; 16 version = "1.11.0b25"; 17 pyproject = true; 18 19 disabled = pythonOlder "3.10"; 20 21 src = fetchPypi { 22 inherit pname version; 23 hash = "sha256-GzrTqpkiKJjWBuZ7ez707BGZez9wXB96psygDQykO6c="; 24 }; 25 26 build-system = [ setuptools ]; 27 28 # tox is listed in build requirements but not actually used to build 29 # keeping it as a requirement breaks the build unnecessarily 30 postPatch = '' 31 sed -i "/requires/s/, 'tox>=[^']*'//" pyproject.toml 32 cat <<EOF >src/libpcap/libpcap.cfg 33 [libpcap] 34 LIBPCAP = ${lib.getLib pkgsLibpcap}/lib/libpcap${stdenv.hostPlatform.extensions.sharedLibrary} 35 EOF 36 ''; 37 38 buildInputs = [ 39 dbus.lib 40 pkgsLibpcap 41 pkg-about 42 ]; 43 44 preCheck = '' 45 pushd tests 46 ''; 47 postCheck = '' 48 popd 49 ''; 50 nativeCheckInputs = [ pytestCheckHook ]; 51 52 pythonImportsCheck = [ "libpcap" ]; 53 54 meta = with lib; { 55 description = "Python binding for the libpcap C library"; 56 longDescription = '' 57 Python libpcap module is a low-level binding for libpcap C library. 58 59 It is an effort to allow python programs full access to the API provided by the well known libpcap Unix C library and by its implementations provided under Win32 systems by such packet capture systems as: Npcap, WinPcap 60 61 libpcap is a lightweight Python package, based on the ctypes library. 62 63 It is fully compliant implementation of the original C libpcap from 1.0.0 up to 1.9.0 API and the WinPcaps 4.1.3 libpcap (1.0.0rel0b) API by implementing whole its functionality in a clean Python instead of C. 64 ''; 65 homepage = "https://github.com/karpierz/libpcap/"; 66 changelog = "https://github.com/karpierz/libpcap/blob/${version}/CHANGES.rst"; 67 license = licenses.bsd3; 68 teams = [ teams.ororatech ]; 69 }; 70}