at master 1.5 kB view raw
1{ 2 stdenv, 3 lib, 4 python, 5 buildPythonPackage, 6 fetchPypi, 7 radare2, 8 coreutils, 9 pythonOlder, 10}: 11 12buildPythonPackage rec { 13 pname = "r2pipe"; 14 version = "1.9.6"; 15 format = "setuptools"; 16 17 disabled = pythonOlder "3.7"; 18 19 postPatch = 20 let 21 r2lib = "${lib.getOutput "lib" radare2}/lib"; 22 libr_core = "${r2lib}/libr_core${stdenv.hostPlatform.extensions.sharedLibrary}"; 23 in 24 '' 25 # Fix find_library, can be removed after 26 # https://github.com/NixOS/nixpkgs/issues/7307 is resolved. 27 substituteInPlace r2pipe/native.py --replace 'find_library("r_core")' "'${libr_core}'" 28 29 # Fix the default r2 executable 30 substituteInPlace r2pipe/open_sync.py --replace 'r2e = "radare2"' "r2e = '${radare2}/bin/radare2'" 31 substituteInPlace r2pipe/open_base.py --replace 'which("radare2")' "'${radare2}/bin/radare2'" 32 ''; 33 34 src = fetchPypi { 35 inherit pname version; 36 hash = "sha256-OAS3Yr1CmMMuhEP/tRO9YAdYZ3emib0huXl3/rjLLJk="; 37 }; 38 39 # Tiny sanity check to make sure r2pipe finds radare2 (since r2pipe doesn't 40 # provide its own tests): 41 # Analyze ls with the fastest analysis and do nothing with the result. 42 postCheck = '' 43 ${python.interpreter} <<EOF 44 import r2pipe 45 r2 = r2pipe.open('${coreutils}/bin/ls') 46 r2.cmd('a') 47 EOF 48 ''; 49 50 meta = with lib; { 51 description = "Interact with radare2"; 52 homepage = "https://github.com/radare/radare2-r2pipe"; 53 license = licenses.mit; 54 maintainers = with maintainers; [ timokau ]; 55 }; 56}