1{ lib
2, buildPythonPackage
3, cffi
4, fetchFromGitHub
5, minidump
6, nose
7, pefile
8, pyelftools
9, pytestCheckHook
10, pythonOlder
11, pyvex
12, pyxbe
13, setuptools
14, sortedcontainers
15}:
16
17let
18 # The binaries are following the argr projects release cycle
19 version = "9.2.77";
20
21 # Binary files from https://github.com/angr/binaries (only used for testing and only here)
22 binaries = fetchFromGitHub {
23 owner = "angr";
24 repo = "binaries";
25 rev = "refs/tags/v${version}";
26 hash = "sha256-YPxdKwR+pq0S1B9GltE8r3bFWDPpCU8OQ05w+kp4lAs=";
27 };
28
29in
30buildPythonPackage rec {
31 pname = "cle";
32 inherit version;
33 pyproject = true;
34
35 disabled = pythonOlder "3.11";
36
37 src = fetchFromGitHub {
38 owner = "angr";
39 repo = "cle";
40 rev = "refs/tags/v${version}";
41 hash = "sha256-tdfV+DoDcRO+8TjiBc0u1huA+etF4MY5uYj670lqudY=";
42 };
43
44 nativeBuildInputs = [
45 setuptools
46 ];
47
48 propagatedBuildInputs = [
49 cffi
50 minidump
51 pefile
52 pyelftools
53 pyvex
54 pyxbe
55 sortedcontainers
56 ];
57
58 nativeCheckInputs = [
59 nose
60 pytestCheckHook
61 ];
62
63 # Place test binaries in the right location (location is hard-coded in the tests)
64 preCheck = ''
65 export HOME=$TMPDIR
66 cp -r ${binaries} $HOME/binaries
67 '';
68
69 disabledTests = [
70 # PPC tests seems to fails
71 "test_ppc_rel24_relocation"
72 "test_ppc_addr16_ha_relocation"
73 "test_ppc_addr16_lo_relocation"
74 "test_plt_full_relro"
75 # Test fails
76 "test_tls_pe_incorrect_tls_data_start"
77 "test_x86"
78 "test_x86_64"
79 # The required parts is not present on Nix
80 "test_remote_file_map"
81 ];
82
83 pythonImportsCheck = [
84 "cle"
85 ];
86
87 meta = with lib; {
88 description = "Python loader for many binary formats";
89 homepage = "https://github.com/angr/cle";
90 license = with licenses; [ bsd2 ];
91 maintainers = with maintainers; [ fab ];
92 };
93}