1{
2 lib,
3 archinfo,
4 buildPythonPackage,
5 cffi,
6 fetchFromGitHub,
7 minidump,
8 pefile,
9 pyelftools,
10 pynose,
11 pytestCheckHook,
12 pythonOlder,
13 pyvex,
14 pyxbe,
15 setuptools,
16 sortedcontainers,
17}:
18
19let
20 # The binaries are following the argr projects release cycle
21 version = "9.2.102";
22
23 # Binary files from https://github.com/angr/binaries (only used for testing and only here)
24 binaries = fetchFromGitHub {
25 owner = "angr";
26 repo = "binaries";
27 rev = "refs/tags/v${version}";
28 hash = "sha256-6FVxlQ1MiJP2mtu4V/mPAyaeCRdBp/sk+u4fdFqxTyA=";
29 };
30in
31buildPythonPackage rec {
32 pname = "cle";
33 inherit version;
34 pyproject = true;
35
36 disabled = pythonOlder "3.11";
37
38 src = fetchFromGitHub {
39 owner = "angr";
40 repo = "cle";
41 rev = "refs/tags/v${version}";
42 hash = "sha256-BPKNrFBEKV8UuSdrl+HIgBqFClHTvRsGidz+X81bBLI=";
43 };
44
45 build-system = [ setuptools ];
46
47 dependencies = [
48 archinfo
49 cffi
50 minidump
51 pefile
52 pyelftools
53 pyvex
54 pyxbe
55 sortedcontainers
56 ];
57
58 nativeCheckInputs = [
59 pynose
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 = [ "cle" ];
84
85 meta = with lib; {
86 description = "Python loader for many binary formats";
87 homepage = "https://github.com/angr/cle";
88 license = with licenses; [ bsd2 ];
89 maintainers = with maintainers; [ fab ];
90 };
91}