at 18.03-beta 1.4 kB view raw
1{ stdenv, lib, writeText, buildPythonPackage, fetchPypi, libpcap, dpkt }: 2 3buildPythonPackage rec { 4 pname = "pypcap"; 5 version = "1.2.0"; 6 name = "${pname}-${version}"; 7 8 src = fetchPypi { 9 inherit pname version; 10 sha256 = "0n01xjgg8n5mf1cs9yg9ljsx1kvir8cm6wwrd2069fawjxdbk0b9"; 11 }; 12 13 patches = [ 14 # The default setup.py searchs for pcap.h in a static list of default 15 # folders. So we have to add the path to libpcap in the nix-store. 16 (writeText "libpcap-path.patch" 17 '' 18 --- a/setup.py 19 +++ b/setup.py 20 @@ -27,7 +27,8 @@ def recursive_search(path, target_files): 21 22 def get_extension(): 23 # A list of all the possible search directories 24 - dirs = ['/usr', sys.prefix] + glob.glob('/opt/libpcap*') + \ 25 + dirs = ['${libpcap}', '/usr', sys.prefix] + \ 26 + glob.glob('/opt/libpcap*') + \ 27 glob.glob('../libpcap*') + glob.glob('../wpdpack*') + \ 28 glob.glob('/Applications/Xcode.app/Contents/Developer/Platforms/' + 29 'MacOSX.platform/Developer/SDKs/*') 30 '') 31 ]; 32 33 buildInputs = [ libpcap ]; 34 nativeBuildInputs = [ dpkt ]; 35 36 meta = { 37 homepage = https://github.com/pynetwork/pypcap; 38 description = "Simplified object-oriented Python wrapper for libpcap"; 39 license = lib.licenses.bsd3; 40 maintainers = with lib.maintainers; [ geistesk ]; 41 }; 42}