git.iko.soy/typeable/nixpkgs
on master help sign in
python.pkgs.r2pipe: init at 1.2.0 (#53504)
commita2ffb3fcd8422e046ab88d79cfcbcffbe583ec1f authorTimo Kaufmann <timokau@zoho.com> dateSun 6 Jan 2019, 19:10 (8 years ago) parent5b201a8
2 files changed+53
pkgs/development/python-modules/r2pipe/default.nix+51 pkgs/top-level/python-packages.nix+2
pkgs/development/python-modules/r2pipe/default.nixnew file+51
@@ -0,0 +1,51 @@
1+{ stdenv
2+, lib
3+, python
4+, buildPythonPackage
5+, fetchPypi
6+, radare2
7+, coreutils
8+}:
9+
10+buildPythonPackage rec {
11+ pname = "r2pipe";
12+ version = "1.2.0";
13+
14+ postPatch = let
15+ r2lib = "${lib.getOutput "lib" radare2}/lib";
16+ libr_core = "${r2lib}/libr_core${stdenv.hostPlatform.extensions.sharedLibrary}";
17+ in
18+ ''
19+ # Fix find_library, can be removed after
20+ # https://github.com/NixOS/nixpkgs/issues/7307 is resolved.
21+ substituteInPlace r2pipe/native.py --replace "find_library('r_core')" "'${libr_core}'"
22+
23+ # Fix the default r2 executable
24+ substituteInPlace r2pipe/open_sync.py --replace "r2e = 'radare2'" "r2e = '${radare2}/bin/radare2'"
25+ substituteInPlace r2pipe/open_base.py --replace 'which("radare2")' "'${radare2}/bin/radare2'"
26+ '';
27+
28+ src = fetchPypi {
29+ inherit pname version;
30+ sha256 = "1qs3xqmi9alahsgr8akzw06ia4c3554dz8pran1h7z5llk262nj4";
31+ };
32+
33+ # Tiny sanity check to make sure r2pipe finds radare2 (since r2pipe doesn't
34+ # provide its own tests):
35+ # Analyze ls with the fastest analysis and do nothing with the result.
36+ postCheck = ''
37+ ${python.interpreter} <<EOF
38+ import r2pipe
39+ r2 = r2pipe.open('${coreutils}/bin/ls')
40+ r2.cmd('a')
41+ r2.quit()
42+ EOF
43+ '';
44+
45+ meta = with stdenv.lib; {
46+ description = "Interact with radare2";
47+ homepage = https://github.com/radare/radare2-r2pipe;
48+ license = licenses.mit;
49+ maintainers = with maintainers; [ timokau ];
50+ };
51+}
pkgs/top-level/python-packages.nix+2
@@ -2102,6 +2102,8 @@ in {
21022102
21032103 svg-path = callPackage ../development/python-modules/svg-path { };
21042104
2105+ r2pipe = callPackage ../development/python-modules/r2pipe { };
2106+
21052107 regex = callPackage ../development/python-modules/regex { };
21062108
21072109 ratelimiter = callPackage ../development/python-modules/ratelimiter { };