{python3Packages.,}monosat: modernize (#426471)

This commit is contained in:
Marcin Serwin
2026-02-17 22:43:33 +00:00
committed by GitHub
2 changed files with 23 additions and 22 deletions
+22 -18
View File
@@ -14,18 +14,14 @@
}:
let
boolToCmake = x: if x then "ON" else "OFF";
rev = "1.8.0";
sha256 = "0q3a8x3iih25xkp2bm842sm2hxlb8hxlls4qmvj7vzwrh4lvsl7b";
pname = "monosat";
version = rev;
version = "1.8.0";
src = fetchFromGitHub {
owner = "sambayless";
repo = "monosat";
inherit rev sha256;
tag = version;
sha256 = "0q3a8x3iih25xkp2bm842sm2hxlb8hxlls4qmvj7vzwrh4lvsl7b";
};
patches = [
@@ -41,7 +37,7 @@ let
# https://github.com/sambayless/monosat/issues/33
commonPostPatch = lib.optionalString (!stdenv.hostPlatform.isx86) ''
substituteInPlace src/monosat/Main.cc \
--replace 'defined(__linux__)' '0'
--replace-fail 'defined(__linux__)' '0'
'';
core = stdenv.mkDerivation {
@@ -63,12 +59,11 @@ let
];
cmakeFlags = [
"-DBUILD_STATIC=OFF"
"-DJAVA=${boolToCmake includeJava}"
"-DGPL=${boolToCmake includeGplCode}"
(lib.cmakeBool "BUILD_STATIC" false)
(lib.cmakeBool "JAVA" includeJava)
(lib.cmakeBool "GPL" includeGplCode)
# file RPATH_CHANGE could not write new RPATH
"-DCMAKE_SKIP_BUILD_RPATH=ON"
(lib.cmakeBool "CMAKE_SKIP_BUILD_RPATH" true)
];
postInstall = lib.optionalString includeJava ''
@@ -91,11 +86,13 @@ let
python =
{
buildPythonPackage,
setuptools,
cython,
pytestCheckHook,
}:
buildPythonPackage {
format = "setuptools";
pyproject = true;
inherit
pname
version
@@ -103,13 +100,15 @@ let
patches
;
propagatedBuildInputs = [
core
build-system = [
setuptools
cython
];
buildInputs = [ core ];
# This tells setup.py to use cython, which should produce faster bindings
MONOSAT_CYTHON = true;
env.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.
@@ -124,7 +123,7 @@ let
# shared lib? The current setup.py copies the .dylib/.so...
''
substituteInPlace setup.py \
--replace 'library_dir = "../../../../"' 'library_dir = "${core}/lib/"'
--replace-fail 'library_dir = "../../../../"' 'library_dir = "${core}/lib/"'
'';
nativeCheckInputs = [ pytestCheckHook ];
@@ -133,6 +132,11 @@ let
"test_assertAtMostOne"
"test_assertEqual"
];
pythonImportsCheck = [
"monosat"
"monosat.monosat_p"
];
};
in
core
+1 -4
View File
@@ -10029,10 +10029,7 @@ self: super: with self; {
monkeytype = callPackage ../development/python-modules/monkeytype { };
monosat = pkgs.monosat.python {
inherit buildPythonPackage;
inherit (self) cython pytestCheckHook;
};
monosat = callPackage pkgs.monosat.python { };
monotonic = callPackage ../development/python-modules/monotonic { };