Gentoo Archives: gentoo-commits

From: Andrew Ammerlaan <andrewammerlaan@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/cantera/, sci-libs/cantera/files/
Date: Mon, 30 Jan 2023 10:35:04
Message-Id: 1675072796.bfc20ea17c60b59183334f78da824b39077ebcae.andrewammerlaan@gentoo
1 commit: bfc20ea17c60b59183334f78da824b39077ebcae
2 Author: Sergey Torokhov <torokhov-s-a <AT> yandex <DOT> ru>
3 AuthorDate: Tue Dec 27 21:32:46 2022 +0000
4 Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
5 CommitDate: Mon Jan 30 09:59:56 2023 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bfc20ea1
7
8 sci-libs/cantera: 2.6.0-r2 revision bump
9
10 1. EAPI8 bump
11 2. Add Python 3.11 compat, rm deprecated open U option (upstream patch)
12 3. Rectrict USE=lapack with >=sci-libs/sundials-6.5.0[lapack?]
13 4. Set std=c++14 to avoid build fail with upcoming dev-libs/boost-1.82
14 and sci-libs/sundials-6.5.0 detection (the last is strange).
15
16 Bug: https://bugs.gentoo.org/888667
17 Closes: https://bugs.gentoo.org/888527
18 Closes: https://bugs.gentoo.org/890427
19
20 Signed-off-by: Sergey Torokhov <torokhov-s-a <AT> yandex.ru>
21 Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>
22
23 sci-libs/cantera/cantera-2.6.0-r2.ebuild | 151 +++++++++++++++++++++
24 ...ntera-2.6.0_drop_deprecated_open_U_option.patch | 49 +++++++
25 2 files changed, 200 insertions(+)
26
27 diff --git a/sci-libs/cantera/cantera-2.6.0-r2.ebuild b/sci-libs/cantera/cantera-2.6.0-r2.ebuild
28 new file mode 100644
29 index 000000000000..31d393df1c40
30 --- /dev/null
31 +++ b/sci-libs/cantera/cantera-2.6.0-r2.ebuild
32 @@ -0,0 +1,151 @@
33 +# Copyright 1999-2023 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=8
37 +
38 +PYTHON_COMPAT=( python3_{9..11} )
39 +
40 +FORTRAN_NEEDED=fortran
41 +FORTRAN_STANDARD="77 90"
42 +
43 +inherit fortran-2 python-single-r1 scons-utils toolchain-funcs
44 +
45 +DESCRIPTION="Object-oriented tool suite for chemical kinetics, thermodynamics, and transport"
46 +HOMEPAGE="https://www.cantera.org"
47 +SRC_URI="https://github.com/Cantera/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
48 +
49 +LICENSE="BSD"
50 +SLOT="0"
51 +KEYWORDS="~amd64 ~x86"
52 +IUSE="+cti fortran lapack +python test"
53 +RESTRICT="!test? ( test )"
54 +
55 +REQUIRED_USE="
56 + python? ( cti )
57 + ${PYTHON_REQUIRED_USE}
58 +"
59 +
60 +RDEPEND="
61 + ${PYTHON_DEPS}
62 + lapack? ( virtual/lapack )
63 + cti? (
64 + $(python_gen_cond_dep '
65 + dev-python/ruamel-yaml[${PYTHON_USEDEP}]
66 + ')
67 + )
68 + python? (
69 + $(python_gen_cond_dep '
70 + dev-python/numpy[${PYTHON_USEDEP}]
71 + ')
72 + )
73 + dev-cpp/yaml-cpp
74 + !lapack? ( sci-libs/sundials:0= )
75 + lapack? ( >=sci-libs/sundials-6.5.0:0=[lapack?] )
76 +"
77 +
78 +DEPEND="
79 + ${RDEPEND}
80 + dev-cpp/eigen:3
81 + dev-libs/boost:=
82 + dev-libs/libfmt
83 + python? (
84 + $(python_gen_cond_dep '
85 + dev-python/cython[${PYTHON_USEDEP}]
86 + dev-python/pip[${PYTHON_USEDEP}]
87 + ')
88 + )
89 + test? (
90 + >=dev-cpp/gtest-1.11.0
91 + python? (
92 + $(python_gen_cond_dep '
93 + dev-python/h5py[${PYTHON_USEDEP}]
94 + dev-python/pandas[${PYTHON_USEDEP}]
95 + dev-python/pytest[${PYTHON_USEDEP}]
96 + dev-python/scipy[${PYTHON_USEDEP}]
97 + ')
98 + )
99 + )
100 +"
101 +
102 +PATCHES=(
103 + "${FILESDIR}/${P}_env.patch"
104 + "${FILESDIR}/${P}_drop_deprecated_open_U_option.patch"
105 +)
106 +
107 +pkg_setup() {
108 + fortran-2_pkg_setup
109 + python-single-r1_pkg_setup
110 +}
111 +
112 +## Full list of configuration options of Cantera is presented here:
113 +## http://cantera.org/docs/sphinx/html/compiling/config-options.html
114 +src_configure() {
115 + scons_vars=(
116 + AR="$(tc-getAR)"
117 + CC="$(tc-getCC)"
118 + CXX="$(tc-getCXX)"
119 + cc_flags="${CXXFLAGS}"
120 + cxx_flags="-std=c++14"
121 + debug="no"
122 + FORTRAN="$(tc-getFC)"
123 + FORTRANFLAGS="${FCFLAGS}"
124 + optimize_flags="-Wno-inline"
125 + renamed_shared_libraries="no"
126 + use_pch="no"
127 + ## In some cases other order can break the detection of right location of Boost: ##
128 + system_fmt="y"
129 + system_sundials="y"
130 + system_eigen="y"
131 + system_yamlcpp="y"
132 + env_vars="all"
133 + extra_inc_dirs="/usr/include/eigen3"
134 + )
135 + use lapack && scons_vars+=( blas_lapack_libs="lapack,blas" )
136 + use test || scons_vars+=( googletest="none" )
137 +
138 + scons_targets=(
139 + f90_interface=$(usex fortran y n)
140 + )
141 +
142 + if use cti ; then
143 + local scons_python=$(usex python full minimal)
144 + scons_targets+=( python_package="${scons_python}" python_cmd="${EPYTHON}" )
145 + else
146 + scons_targets+=( python_package="none" )
147 + fi
148 +}
149 +
150 +src_compile() {
151 + escons build "${scons_vars[@]}" "${scons_targets[@]}" prefix="/usr"
152 +}
153 +
154 +src_test() {
155 + escons test
156 +}
157 +
158 +src_install() {
159 + escons install stage_dir="${D}" libdirname="$(get_libdir)"
160 + if ! use cti ; then
161 + rm -r "${D}/usr/share/man" || die "Can't remove man files."
162 + else
163 + # Run the byte-compile of modules
164 + python_optimize "${D}$(python_get_sitedir)/${PN}"
165 + fi
166 +
167 + # User could remove this line if require static libs for development purpose
168 + find "${ED}" -name '*.a' -delete || die
169 +}
170 +
171 +pkg_postinst() {
172 + if use cti && ! use python ; then
173 + elog "Cantera was build without 'python' use-flag therefore the CTI tools 'ck2cti' and 'ck2yaml"
174 + elog "will convert Chemkin files to Cantera format without verification of kinetic mechanism."
175 + fi
176 +
177 + local post_msg=$(usex fortran "and Fortran " "")
178 + elog "C++ ${post_msg}samples are installed to '/usr/share/${PN}/samples/' directory."
179 +
180 + if use python ; then
181 + elog "Python examples are installed to '$(python_get_sitedir)/${PN}/examples/' directories."
182 + fi
183 +}
184
185 diff --git a/sci-libs/cantera/files/cantera-2.6.0_drop_deprecated_open_U_option.patch b/sci-libs/cantera/files/cantera-2.6.0_drop_deprecated_open_U_option.patch
186 new file mode 100644
187 index 000000000000..41243da82f68
188 --- /dev/null
189 +++ b/sci-libs/cantera/files/cantera-2.6.0_drop_deprecated_open_U_option.patch
190 @@ -0,0 +1,49 @@
191 +From 0b407e11fe0bae4707286ab3cbf6a7a72a906817 Mon Sep 17 00:00:00 2001
192 +From: "Mark E. Fuller" <mark.e.fuller@×××.de>
193 +Date: Thu, 23 Jun 2022 00:04:22 +0300
194 +Subject: [PATCH] drop deprecated 'U' open option
195 +
196 +---
197 + site_scons/site_tools/subst.py | 15 +++------------
198 + 1 file changed, 3 insertions(+), 12 deletions(-)
199 +
200 +diff --git a/site_scons/site_tools/subst.py b/site_scons/site_tools/subst.py
201 +index 3a1c4f6fb8..05d520491b 100644
202 +--- a/site_scons/site_tools/subst.py
203 ++++ b/site_scons/site_tools/subst.py
204 +@@ -12,7 +12,7 @@
205 +
206 + from SCons.Script import *
207 + import SCons.Errors
208 +-
209 ++from pathlib import Path
210 +
211 + # Helper/core functions
212 + ##############################################################################
213 +@@ -20,12 +20,7 @@
214 + # Do the substitution
215 + def _subst_file(target, source, env, pattern, replace):
216 + # Read file
217 +- #print 'CALLING SUBST_FILE'
218 +- f = open(source, "rU")
219 +- try:
220 +- contents = f.read()
221 +- finally:
222 +- f.close()
223 ++ contents = Path(source).read_text()
224 +
225 + # Substitute, make sure result is a string
226 + def subfn(mo):
227 +@@ -46,11 +41,7 @@ def subfn(mo):
228 + # Determine which keys are used
229 + def _subst_keys(source, pattern):
230 + # Read file
231 +- f = open(source, "rU")
232 +- try:
233 +- contents = f.read()
234 +- finally:
235 +- f.close()
236 ++ contents = Path(source).read_text()
237 +
238 + # Determine keys
239 + keys = []