commit:     958deb821b366d4ad159fff9ee601d2128d3dec7
Author:     Maciej Barć <xgqt <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 12 23:30:48 2024 +0000
Commit:     Maciej Barć <xgqt <AT> gentoo <DOT> org>
CommitDate: Wed Jun 12 23:40:24 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=958deb82

sci-mathematics/cryptominisat: enable python support

Signed-off-by: Maciej Barć <xgqt <AT> gentoo.org>

 ...1.21.ebuild => cryptominisat-5.11.21-r1.ebuild} | 52 +++++++++++++++++++++-
 .../files/cryptominisat-5.11.21-setup-py.patch     | 18 ++++++++
 2 files changed, 69 insertions(+), 1 deletion(-)

diff --git a/sci-mathematics/cryptominisat/cryptominisat-5.11.21.ebuild 
b/sci-mathematics/cryptominisat/cryptominisat-5.11.21-r1.ebuild
similarity index 52%
rename from sci-mathematics/cryptominisat/cryptominisat-5.11.21.ebuild
rename to sci-mathematics/cryptominisat/cryptominisat-5.11.21-r1.ebuild
index 7de12b4067d1..db2ca950f559 100644
--- a/sci-mathematics/cryptominisat/cryptominisat-5.11.21.ebuild
+++ b/sci-mathematics/cryptominisat/cryptominisat-5.11.21-r1.ebuild
@@ -3,7 +3,15 @@
 
 EAPI=8
 
-inherit cmake
+CMAKE_IN_SOURCE_BUILD="ON"
+
+PYTHON_COMPAT=( python3_{11..13} )
+
+DISTUTILS_EXT="1"
+DISTUTILS_OPTIONAL="1"
+DISTUTILS_USE_PEP517="setuptools"
+
+inherit cmake distutils-r1
 
 DESCRIPTION="Advanced SAT solver with C++ and command-line interfaces"
 HOMEPAGE="https://github.com/msoos/cryptominisat/";
@@ -21,24 +29,66 @@ fi
 
 LICENSE="GPL-2 MIT"
 SLOT="0/${PV}"
+IUSE="python"
 RESTRICT="test"                               # Tests require some git modules.
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
 
 RDEPEND="
        dev-libs/boost:=
        sys-libs/zlib:=
+       python? (
+               ${PYTHON_DEPS}
+               $(python_gen_cond_dep '
+                       dev-python/tomli[${PYTHON_USEDEP}]
+               ')
+       )
 "
 DEPEND="
        ${RDEPEND}
 "
+BDEPEND="
+       python? (
+               ${DISTUTILS_DEPS}
+       )
+"
 
 PATCHES=(
+       "${FILESDIR}/${PN}-5.11.21-setup-py.patch"
        "${FILESDIR}/${PN}-5.11.21-unistd.patch"
 )
 
+src_prepare() {
+       cmake_src_prepare
+
+       if use python ; then
+               distutils-r1_src_prepare
+       fi
+}
+
 src_configure() {
        local -a mycmakeargs=(
                -DNOBREAKID=ON
                -DENABLE_TESTING=OFF
        )
        cmake_src_configure
+
+       if use python ; then
+               python_setup
+       fi
+}
+
+src_compile() {
+       cmake_src_compile
+
+       if use python ; then
+               distutils-r1_src_compile
+       fi
+}
+
+src_install() {
+       cmake_src_install
+
+       if use python ; then
+               distutils-r1_src_install
+       fi
 }

diff --git 
a/sci-mathematics/cryptominisat/files/cryptominisat-5.11.21-setup-py.patch 
b/sci-mathematics/cryptominisat/files/cryptominisat-5.11.21-setup-py.patch
new file mode 100644
index 000000000000..6b13b3e05b26
--- /dev/null
+++ b/sci-mathematics/cryptominisat/files/cryptominisat-5.11.21-setup-py.patch
@@ -0,0 +1,18 @@
+--- a/setup.py
++++ b/setup.py
+@@ -27,13 +27,13 @@ import sys
+ import os
+ from setuptools import Extension, setup
+ import sysconfig
+-import toml
++import tomli
+ import pathlib
+ from sys import platform
+ 
+ def _parse_toml(pyproject_path):
+     pyproject_text = pyproject_path.read_text()
+-    pyproject_data = toml.loads(pyproject_text)
++    pyproject_data = tomli.loads(pyproject_text)
+     return pyproject_data['project']['version']
+ 
+ picosatlib = ('picosatlib', {

Reply via email to