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.25";
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 = "v${version}";
26 hash = "sha256-LpYi5Ty6OBcW0zokCliMDhujJ7tPPl1XdPs5ad1tv5s=";
27 };
28
29in
30buildPythonPackage rec {
31 pname = "cle";
32 inherit version;
33 format = "pyproject";
34
35 disabled = pythonOlder "3.8";
36
37 src = fetchFromGitHub {
38 owner = "angr";
39 repo = pname;
40 rev = "v${version}";
41 hash = "sha256-4igNQqH3mU8Gyk8vpPKp3a4BCyRezmJ5dfZhR5KwyAo=";
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 checkInputs = [
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 # The required parts is not present on Nix
78 "test_remote_file_map"
79 ];
80
81 pythonImportsCheck = [
82 "cle"
83 ];
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}