at master 1.3 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 capstone, 6 pytestCheckHook, 7 setuptools-scm, 8 setuptools, 9 unicorn, 10}: 11 12buildPythonPackage rec { 13 pname = "unicorn"; 14 version = lib.getVersion unicorn; 15 pyproject = true; 16 17 src = unicorn.src; 18 19 sourceRoot = "${src.name}/bindings/python"; 20 21 prePatch = '' 22 ln -s ${unicorn}/lib/libunicorn.* prebuilt/ 23 ''; 24 25 # Needed on non-x86 linux 26 setupPyBuildFlags = 27 lib.optionals stdenv.hostPlatform.isLinux [ 28 "--plat-name" 29 "linux" 30 ] 31 # aarch64 only available from MacOS SDK 11 onwards, so fix the version tag. 32 # otherwise, bdist_wheel may detect "macosx_10_6_arm64" which doesn't make sense. 33 ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [ 34 "--plat-name" 35 "macosx_11_0" 36 ]; 37 38 build-system = [ 39 setuptools 40 setuptools-scm 41 ]; 42 43 nativeCheckInputs = [ 44 capstone 45 pytestCheckHook 46 ]; 47 48 # this test does not appear to be intended as a pytest-style test 49 disabledTests = [ "test_i386" ]; 50 51 pythonImportsCheck = [ "unicorn" ]; 52 53 meta = with lib; { 54 description = "Python bindings for Unicorn CPU emulator engine"; 55 homepage = "https://www.unicorn-engine.org/"; 56 license = licenses.gpl2Plus; 57 maintainers = with maintainers; [ 58 bennofs 59 ris 60 ]; 61 }; 62}