From 8817036a3140dc8496dd627ed6c7e8994b086b9a Mon Sep 17 00:00:00 2001 From: Robert Scott Date: Thu, 2 Jan 2020 20:06:50 +0000 Subject: [PATCH] pythonPackages.capstone: 3.0.5.post1 -> 4.0.1, redesign as wrapper package around main capstone package this allows us to keep the two packages in sync and handle overrides more flexibly --- .../python-modules/capstone/default.nix | 38 +++++++------------ pkgs/top-level/python-packages.nix | 2 +- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/pkgs/development/python-modules/capstone/default.nix b/pkgs/development/python-modules/capstone/default.nix index 035632f9cf25..7fc0b16522ed 100644 --- a/pkgs/development/python-modules/capstone/default.nix +++ b/pkgs/development/python-modules/capstone/default.nix @@ -3,43 +3,33 @@ , fetchPypi , fetchpatch , setuptools +, capstone }: buildPythonPackage rec { pname = "capstone"; - version = "3.0.5.post1"; + version = stdenv.lib.getVersion capstone; - setupPyBuildFlags = [ - "--plat-name x86_64-linux" - ]; + src = capstone.src; + sourceRoot = "${capstone.name}/bindings/python"; - src = fetchPypi { - inherit pname version; - sha256 = "3c0f73db9f8392f7048c8a244809f154d7c39f354e2167f6c477630aa517ed04"; - }; + postPatch = '' + ln -s ${capstone}/lib/libcapstone${stdenv.targetPlatform.extensions.sharedLibrary} prebuilt/ + ln -s ${capstone}/lib/libcapstone.a prebuilt/ + ''; propagatedBuildInputs = [ setuptools ]; - patches = [ - (fetchpatch { - stripLen = 2; - url = "https://patch-diff.githubusercontent.com/raw/aquynh/capstone/pull/783/commits/23fe9f36622573c747e2bab6119ff245437bf276.patch"; - sha256 = "0yizqrdlxqxn16873593kdx2vrr7gvvilhgcf9xy6hr0603d3m5r"; - }) - ]; - - postPatch = '' - patchShebangs src/make.sh - ''; - - preCheck = '' - mv src/libcapstone.so capstone + checkPhase = '' + mv capstone capstone.hidden + patchShebangs test_* + make check ''; meta = with stdenv.lib; { homepage = "http://www.capstone-engine.org/"; license = licenses.bsdOriginal; - description = "Capstone disassembly engine"; - maintainers = with maintainers; [ bennofs ]; + description = "Python bindings for Capstone disassembly engine"; + maintainers = with maintainers; [ bennofs ris ]; }; } diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index f510f29facc7..603b2cf5dfee 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1816,7 +1816,7 @@ in { inherit (self) python numpy boost; }); - capstone = callPackage ../development/python-modules/capstone { }; + capstone = callPackage ../development/python-modules/capstone { inherit (pkgs) capstone; }; capturer = callPackage ../development/python-modules/capturer { };