nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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, sortedcontainers
14}:
15
16let
17 # The binaries are following the argr projects release cycle
18 version = "9.2.4";
19
20 # Binary files from https://github.com/angr/binaries (only used for testing and only here)
21 binaries = fetchFromGitHub {
22 owner = "angr";
23 repo = "binaries";
24 rev = "v${version}";
25 sha256 = "1qlrxfj1n34xvwkac6mbcc7zmixxbp34fj7lkf0fvp7zcz1rpla1";
26 };
27
28in
29buildPythonPackage rec {
30 pname = "cle";
31 inherit version;
32 format = "pyproject";
33
34 disabled = pythonOlder "3.6";
35
36 src = fetchFromGitHub {
37 owner = "angr";
38 repo = pname;
39 rev = "v${version}";
40 hash = "sha256-SlYayKfosSicMxMZszZpxJ3ewKScyLpv6s5ayoVE9Ko=";
41 };
42
43 propagatedBuildInputs = [
44 cffi
45 minidump
46 pefile
47 pyelftools
48 pyvex
49 pyxbe
50 sortedcontainers
51 ];
52
53 checkInputs = [
54 nose
55 pytestCheckHook
56 ];
57
58 # Place test binaries in the right location (location is hard-coded in the tests)
59 preCheck = ''
60 export HOME=$TMPDIR
61 cp -r ${binaries} $HOME/binaries
62 '';
63
64 disabledTests = [
65 # PPC tests seems to fails
66 "test_ppc_rel24_relocation"
67 "test_ppc_addr16_ha_relocation"
68 "test_ppc_addr16_lo_relocation"
69 # Binary not found, seems to be missing in the current binaries release
70 "test_plt_full_relro"
71 # Test fails
72 "test_tls_pe_incorrect_tls_data_start"
73 # The required parts is not present on Nix
74 "test_remote_file_map"
75 ];
76
77 pythonImportsCheck = [
78 "cle"
79 ];
80
81 meta = with lib; {
82 description = "Python loader for many binary formats";
83 homepage = "https://github.com/angr/cle";
84 license = with licenses; [ bsd2 ];
85 maintainers = with maintainers; [ fab ];
86 };
87}