1{ lib
2, stdenv
3, archinfo
4, bitstring
5, buildPythonPackage
6, cffi
7, fetchPypi
8, future
9, pycparser
10, pythonOlder
11, setuptools
12}:
13
14buildPythonPackage rec {
15 pname = "pyvex";
16 version = "9.2.25";
17 format = "pyproject";
18
19 disabled = pythonOlder "3.8";
20
21 src = fetchPypi {
22 inherit pname version;
23 hash = "sha256-7AcotD80GlBDiVtNPXlCUSNbZXybHoqWH92CxTfajhE=";
24 };
25
26 nativeBuildInputs = [
27 setuptools
28 ];
29
30 propagatedBuildInputs = [
31 archinfo
32 bitstring
33 cffi
34 future
35 pycparser
36 ];
37
38 postPatch = lib.optionalString stdenv.isDarwin ''
39 substituteInPlace vex/Makefile-gcc \
40 --replace '/usr/bin/ar' 'ar'
41 '';
42
43 setupPyBuildFlags = lib.optionals stdenv.isLinux [
44 "--plat-name"
45 "linux"
46 ];
47
48 preBuild = ''
49 export CC=${stdenv.cc.targetPrefix}cc
50 substituteInPlace pyvex_c/Makefile \
51 --replace 'AR=ar' 'AR=${stdenv.cc.targetPrefix}ar'
52 '';
53
54 # No tests are available on PyPI, GitHub release has tests
55 # Switch to GitHub release after all angr parts are present
56 doCheck = false;
57
58 pythonImportsCheck = [
59 "pyvex"
60 ];
61
62 meta = with lib; {
63 description = "Python interface to libVEX and VEX IR";
64 homepage = "https://github.com/angr/pyvex";
65 license = with licenses; [ bsd2 gpl3Plus lgpl3Plus ];
66 maintainers = with maintainers; [ fab ];
67 };
68}