about summary refs log tree commit diff
path: root/pkgs/applications/science/logic
diff options
context:
space:
mode:
authorAiken Cairncross <acairncross@gmail.com>2020-03-02 22:18:08 +0000
committerFrederik Rietdijk <freddyrietdijk@fridh.nl>2020-03-03 07:40:57 +0100
commit2148a154c627845194217bb9886d24268052d9b4 (patch)
tree7670fe5e7e78265d7b53a3c0c8558357bcd5d2bc /pkgs/applications/science/logic
parent3fe7a65e236e55dfb70ad722b174177426e5cecf (diff)
downloadnixlib-2148a154c627845194217bb9886d24268052d9b4.tar
nixlib-2148a154c627845194217bb9886d24268052d9b4.tar.gz
nixlib-2148a154c627845194217bb9886d24268052d9b4.tar.bz2
nixlib-2148a154c627845194217bb9886d24268052d9b4.tar.lz
nixlib-2148a154c627845194217bb9886d24268052d9b4.tar.xz
nixlib-2148a154c627845194217bb9886d24268052d9b4.tar.zst
nixlib-2148a154c627845194217bb9886d24268052d9b4.zip
python3Packages.monosat: Fix Python 3.8 build
Diffstat (limited to 'pkgs/applications/science/logic')
-rw-r--r--pkgs/applications/science/logic/monosat/default.nix24
1 files changed, 17 insertions, 7 deletions
diff --git a/pkgs/applications/science/logic/monosat/default.nix b/pkgs/applications/science/logic/monosat/default.nix
index c0512b744884..d7718f71b727 100644
--- a/pkgs/applications/science/logic/monosat/default.nix
+++ b/pkgs/applications/science/logic/monosat/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, zlib, gmp, jdk8,
+{ stdenv, fetchpatch, fetchFromGitHub, cmake, zlib, gmp, jdk8,
   # The JDK we use on Darwin currenly makes extensive use of rpaths which are
   # annoying and break the python library, so let's not bother for now
   includeJava ? !stdenv.hostPlatform.isDarwin, includeGplCode ? true }:
@@ -20,9 +20,17 @@ let
     inherit rev sha256;
   };
 
+  patches = [
+    # Python 3.8 compatibility
+    (fetchpatch {
+      url = https://github.com/sambayless/monosat/commit/a5079711d0df0451f9840f3a41248e56dbb03967.patch;
+      sha256 = "0fwsk67798dns7izdry19r7r3nmym4cbgxfpbjbnx4b4mlak65j8";
+    })
+  ];
+
   core = stdenv.mkDerivation {
     name = "${pname}-${version}";
-    inherit src;
+    inherit src patches;
     buildInputs = [ cmake zlib gmp jdk8 ];
 
     cmakeFlags = [
@@ -48,20 +56,22 @@ let
   };
 
   python = { buildPythonPackage, cython }: buildPythonPackage {
-    inherit pname version src;
-
-    # The top-level "source" is what fetchFromGitHub gives us. The rest is inside the repo
-    sourceRoot = "source/src/monosat/api/python/";
+    inherit pname version src patches;
 
     propagatedBuildInputs = [ core cython ];
 
     # This tells setup.py to use cython, which should produce faster bindings
     MONOSAT_CYTHON = true;
 
+    # After patching src, move to where the actually relevant source is. This could just be made
+    # the sourceRoot if it weren't for the patch.
+    postPatch = ''
+      cd src/monosat/api/python
+    '' +
     # The relative paths here don't make sense for our Nix build
     # TODO: do we want to just reference the core monosat library rather than copying the
     # shared lib? The current setup.py copies the .dylib/.so...
-    postPatch = ''
+    ''
       substituteInPlace setup.py \
         --replace 'library_dir = "../../../../"' 'library_dir = "${core}/lib/"'
     '';