about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/unicorn/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/unicorn/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/unicorn/default.nix32
1 files changed, 29 insertions, 3 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/unicorn/default.nix b/nixpkgs/pkgs/development/python-modules/unicorn/default.nix
index 484f422adf3e..1f2876bdc693 100644
--- a/nixpkgs/pkgs/development/python-modules/unicorn/default.nix
+++ b/nixpkgs/pkgs/development/python-modules/unicorn/default.nix
@@ -1,10 +1,17 @@
-{ lib, stdenv, buildPythonPackage, setuptools, unicorn-emu }:
+{ lib
+, stdenv
+, buildPythonPackage
+, setuptools
+, unicorn-emu
+}:
 
 buildPythonPackage rec {
   pname = "unicorn";
   version = lib.getVersion unicorn-emu;
+  format = "setuptools";
 
   src = unicorn-emu.src;
+
   sourceRoot = "source/bindings/python";
 
   prePatch = ''
@@ -12,12 +19,31 @@ buildPythonPackage rec {
     ln -s ${unicorn-emu}/lib/libunicorn.a prebuilt/
   '';
 
-  propagatedBuildInputs = [ setuptools ];
+  # needed on non-x86 linux
+  setupPyBuildFlags = lib.optionals stdenv.isLinux [ "--plat-name" "linux" ];
+
+  propagatedBuildInputs = [
+    setuptools
+  ];
+
+  checkPhase = ''
+    runHook preCheck
+
+    mv unicorn unicorn.hidden
+    patchShebangs sample_*.py shellcode.py
+    sh -e sample_all.sh
+
+    runHook postCheck
+  '';
+
+  pythonImportsCheck = [
+    "unicorn"
+  ];
 
   meta = with lib; {
     description = "Python bindings for Unicorn CPU emulator engine";
     homepage = "https://www.unicorn-engine.org/";
-    license = [ licenses.gpl2 ];
+    license = licenses.gpl2Plus;
     maintainers = with maintainers; [ bennofs ris ];
   };
 }