From a2ffb3fcd8422e046ab88d79cfcbcffbe583ec1f Mon Sep 17 00:00:00 2001 From: Timo Kaufmann Date: Sun, 6 Jan 2019 19:10:47 +0100 Subject: [PATCH] python.pkgs.r2pipe: init at 1.2.0 (#53504) --- .../python-modules/r2pipe/default.nix | 51 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 53 insertions(+) create mode 100644 pkgs/development/python-modules/r2pipe/default.nix diff --git a/pkgs/development/python-modules/r2pipe/default.nix b/pkgs/development/python-modules/r2pipe/default.nix new file mode 100644 index 00000000000..354f2743e98 --- /dev/null +++ b/pkgs/development/python-modules/r2pipe/default.nix @@ -0,0 +1,51 @@ +{ stdenv +, lib +, python +, buildPythonPackage +, fetchPypi +, radare2 +, coreutils +}: + +buildPythonPackage rec { + pname = "r2pipe"; + version = "1.2.0"; + + postPatch = let + r2lib = "${lib.getOutput "lib" radare2}/lib"; + libr_core = "${r2lib}/libr_core${stdenv.hostPlatform.extensions.sharedLibrary}"; + in + '' + # Fix find_library, can be removed after + # https://github.com/NixOS/nixpkgs/issues/7307 is resolved. + substituteInPlace r2pipe/native.py --replace "find_library('r_core')" "'${libr_core}'" + + # Fix the default r2 executable + substituteInPlace r2pipe/open_sync.py --replace "r2e = 'radare2'" "r2e = '${radare2}/bin/radare2'" + substituteInPlace r2pipe/open_base.py --replace 'which("radare2")' "'${radare2}/bin/radare2'" + ''; + + src = fetchPypi { + inherit pname version; + sha256 = "1qs3xqmi9alahsgr8akzw06ia4c3554dz8pran1h7z5llk262nj4"; + }; + + # Tiny sanity check to make sure r2pipe finds radare2 (since r2pipe doesn't + # provide its own tests): + # Analyze ls with the fastest analysis and do nothing with the result. + postCheck = '' + ${python.interpreter} <