commit:     49bffbbd7d4f3fdf3c4c35fc006336562fe7bf39
Author:     Sergey Torokhov <torokhov-s-a <AT> yandex <DOT> ru>
AuthorDate: Sun Jan 14 09:03:07 2024 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Thu Feb  8 09:17:34 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=49bffbbd

sci-libs/cantera: 3.0.0-r1 to enable python-3.12 (upstream patch)

Signed-off-by: Sergey Torokhov <torokhov-s-a <AT> yandex.ru>
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 sci-libs/cantera/cantera-3.0.0-r1.ebuild           | 144 +++++++++++++++++++++
 .../files/cantera-3.0.0_enable_python-3.12.patch   |  75 +++++++++++
 2 files changed, 219 insertions(+)

diff --git a/sci-libs/cantera/cantera-3.0.0-r1.ebuild 
b/sci-libs/cantera/cantera-3.0.0-r1.ebuild
new file mode 100644
index 000000000000..8ab4a8c5f104
--- /dev/null
+++ b/sci-libs/cantera/cantera-3.0.0-r1.ebuild
@@ -0,0 +1,144 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+
+FORTRAN_NEEDED=fortran
+FORTRAN_STANDARD="77 90"
+
+inherit fortran-2 python-single-r1 scons-utils toolchain-funcs
+
+DESCRIPTION="Object-oriented tool suite for chemical kinetics, thermodynamics, 
and transport"
+HOMEPAGE="https://www.cantera.org";
+SRC_URI="https://github.com/Cantera/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="fortran hdf5 lapack +python test"
+RESTRICT="!test? ( test )"
+
+REQUIRED_USE="
+       ${PYTHON_REQUIRED_USE}
+"
+
+RDEPEND="
+       ${PYTHON_DEPS}
+       dev-cpp/yaml-cpp
+       hdf5? ( sci-libs/HighFive )
+       !lapack? ( sci-libs/sundials:0= )
+       lapack? (
+               >=sci-libs/sundials-6.5.0:0=[lapack?]
+               virtual/lapack
+       )
+       python? (
+               $(python_gen_cond_dep '
+                       dev-python/numpy[${PYTHON_USEDEP}]
+                       dev-python/ruamel-yaml[${PYTHON_USEDEP}]
+               ')
+       )
+"
+
+DEPEND="
+       ${RDEPEND}
+       dev-cpp/eigen:3
+       dev-libs/boost:=
+       dev-libs/libfmt
+       python? (
+               $(python_gen_cond_dep '
+                       dev-python/cython[${PYTHON_USEDEP}]
+                       dev-python/pip[${PYTHON_USEDEP}]
+               ')
+       )
+       test? (
+               >=dev-cpp/gtest-1.11.0
+               python? (
+                       $(python_gen_cond_dep '
+                               dev-python/h5py[${PYTHON_USEDEP}]
+                               dev-python/pandas[${PYTHON_USEDEP}]
+                               dev-python/pytest[${PYTHON_USEDEP}]
+                               dev-python/scipy[${PYTHON_USEDEP}]
+                       ')
+               )
+       )
+"
+
+PATCHES=(
+       "${FILESDIR}/${P}_env.patch"
+       "${FILESDIR}/${P}_enable_python-3.12.patch"
+)
+
+pkg_setup() {
+       fortran-2_pkg_setup
+       python-single-r1_pkg_setup
+}
+
+## Full list of configuration options of Cantera is presented here:
+## http://cantera.org/docs/sphinx/html/compiling/config-options.html
+src_configure() {
+       scons_vars=(
+               AR="$(tc-getAR)"
+               CC="$(tc-getCC)"
+               CXX="$(tc-getCXX)"
+               cc_flags="${CXXFLAGS}"
+               cxx_flags="-std=c++17"
+               debug="no"
+               FORTRAN="$(tc-getFC)"
+               FORTRANFLAGS="${FCFLAGS}"
+               optimize_flags="-Wno-inline"
+               renamed_shared_libraries="no"
+               use_pch="no"
+               ## In some cases other order can break the detection of right 
location of Boost: ##
+               system_fmt="y"
+               system_sundials="y"
+               system_eigen="y"
+               system_yamlcpp="y"
+               hdf_support=$(usex hdf5 y n)
+               system_blas_lapack=$(usex lapack y n)
+               env_vars="all"
+               extra_inc_dirs="/usr/include/eigen3"
+               use_rpath_linkage="yes"
+               extra_lib_dirs="/usr/$(get_libdir)/${PN}"
+       )
+       use hdf5 && scons_vars+=( system_highfive="y" )
+       use lapack && scons_vars+=( blas_lapack_libs="lapack,blas" )
+       use test || scons_vars+=( googletest="none" )
+
+       scons_targets=(
+               f90_interface=$(usex fortran y n)
+       )
+
+       if use python ; then
+               scons_targets+=( python_package="full" python_cmd="${EPYTHON}" )
+       else
+               scons_targets+=( python_package="none" )
+       fi
+}
+
+src_compile() {
+       escons build "${scons_vars[@]}" "${scons_targets[@]}" prefix="/usr"
+}
+
+src_test() {
+       escons test
+}
+
+src_install() {
+       escons install stage_dir="${D}" libdirname="$(get_libdir)"
+       if ! use python ; then
+               rm -r "${D}/usr/share/man" || die "Can't remove man files."
+       else
+               # Run the byte-compile of modules
+               python_optimize "${D}$(python_get_sitedir)/${PN}"
+       fi
+
+       # User could remove this line if require static libs for development 
purpose
+       find "${ED}" -name '*.a' -delete || die
+}
+
+pkg_postinst() {
+       local post_msg=$(usex fortran "and Fortran " "")
+       elog "C++ ${post_msg}samples are installed to 
'/usr/share/${PN}/samples/' directory."
+}

diff --git a/sci-libs/cantera/files/cantera-3.0.0_enable_python-3.12.patch 
b/sci-libs/cantera/files/cantera-3.0.0_enable_python-3.12.patch
new file mode 100644
index 000000000000..8efa7b0df9c5
--- /dev/null
+++ b/sci-libs/cantera/files/cantera-3.0.0_enable_python-3.12.patch
@@ -0,0 +1,75 @@
+From 27f8362f537fc313f8fdb5c07649ef0d92e3b7f6 Mon Sep 17 00:00:00 2001
+From: "Mark E. Fuller" <[email protected]>
+Date: Sat, 26 Aug 2023 01:04:03 +0300
+Subject: [PATCH] mods to enable python3.12
+
+---
+ .github/workflows/main.yml             | 2 +-
+ interfaces/cython/setup.cfg.in         | 1 +
+ interfaces/python_minimal/setup.cfg.in | 1 +
+ interfaces/python_sdist/setup.cfg.in   | 1 +
+ src/base/application.h                 | 2 +-
+ 5 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
+index 60822189bb..366ddd8435 100644
+--- a/.github/workflows/main.yml
++++ b/.github/workflows/main.yml
+@@ -65,7 +65,7 @@ jobs:
+     timeout-minutes: 60
+     strategy:
+       matrix:
+-        python-version: ['3.8', '3.10', '3.11']
++        python-version: ['3.8', '3.10', '3.11', '3.12']
+         os: ['ubuntu-20.04', 'ubuntu-22.04']
+       fail-fast: false
+     env:
+diff --git a/interfaces/cython/setup.cfg.in b/interfaces/cython/setup.cfg.in
+index 1a0358a77d..fd3c0b53c4 100644
+--- a/interfaces/cython/setup.cfg.in
++++ b/interfaces/cython/setup.cfg.in
+@@ -27,6 +27,7 @@ classifiers =
+     Programming Language :: Python :: 3.9
+     Programming Language :: Python :: 3.10
+     Programming Language :: Python :: 3.11
++    Programming Language :: Python :: 3.12
+     Programming Language :: Python :: Implementation :: CPython
+     Topic :: Scientific/Engineering :: Chemistry
+     Topic :: Scientific/Engineering :: Physics
+diff --git a/interfaces/python_minimal/setup.cfg.in 
b/interfaces/python_minimal/setup.cfg.in
+index 2d96c75eda..753b619ede 100644
+--- a/interfaces/python_minimal/setup.cfg.in
++++ b/interfaces/python_minimal/setup.cfg.in
+@@ -23,6 +23,7 @@ classifiers =
+     Programming Language :: Python :: 3.9
+     Programming Language :: Python :: 3.10
+     Programming Language :: Python :: 3.11
++    Programming Language :: Python :: 3.12
+     Topic :: Scientific/Engineering :: Chemistry
+     Topic :: Scientific/Engineering :: Physics
+ project_urls =
+diff --git a/interfaces/python_sdist/setup.cfg.in 
b/interfaces/python_sdist/setup.cfg.in
+index 219e53a3f0..e356b422b8 100644
+--- a/interfaces/python_sdist/setup.cfg.in
++++ b/interfaces/python_sdist/setup.cfg.in
+@@ -27,6 +27,7 @@ classifiers =
+     Programming Language :: Python :: 3.9
+     Programming Language :: Python :: 3.10
+     Programming Language :: Python :: 3.11
++    Programming Language :: Python :: 3.12
+     Programming Language :: Python :: Implementation :: CPython
+     Topic :: Scientific/Engineering :: Chemistry
+     Topic :: Scientific/Engineering :: Physics
+diff --git a/src/base/application.h b/src/base/application.h
+index 76a6c671a2..b03c049f14 100644
+--- a/src/base/application.h
++++ b/src/base/application.h
+@@ -434,7 +434,7 @@ class Application
+     vector<string> inputDirs;
+ 
+     //! Versions of Python to consider when attempting to load user extensions
+-    vector<string> m_pythonSearchVersions = {"3.11", "3.10", "3.9", "3.8"};
++    vector<string> m_pythonSearchVersions = {"3.12", "3.11", "3.10", "3.9", 
"3.8"};
+ 
+     //! Set of deprecation warnings that have been emitted (to suppress 
duplicates)
+     set<string> warnings;

Reply via email to