git: d4600726b06d - main - science/cantera: Unbreak by fixing wheel-filename mismatch via SConscript sentinel/glob

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Sat, 11 Jul 2026 00:24:36 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d4600726b06da604cf84c0a33e5f70ab2d5e2dd4

commit d4600726b06da604cf84c0a33e5f70ab2d5e2dd4
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2026-07-11 00:18:27 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-07-11 00:24:33 +0000

    science/cantera: Unbreak by fixing wheel-filename mismatch via SConscript sentinel/glob
    
    Also: Python ABI parameterized in strip target and pkg-plist.
---
 science/cantera/Makefile                           |  5 ++-
 .../files/patch-interfaces_cython_SConscript       | 40 ++++++++++++++++++++++
 science/cantera/pkg-plist                          |  2 +-
 3 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/science/cantera/Makefile b/science/cantera/Makefile
index a8262a4bf1d6..d2bda7c35c69 100644
--- a/science/cantera/Makefile
+++ b/science/cantera/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	cantera
 DISTVERSIONPREFIX=	v
 DISTVERSION=	3.2.0
+PORTREVISION=	1
 CATEGORIES=	science # chemistry physics
 
 MAINTAINER=	yuri@FreeBSD.org
@@ -28,6 +29,8 @@ LIB_DEPENDS=	libfmt.so:devel/libfmt \
 USES=		compiler:c++17-lang eigen:3 gettext-runtime localbase python scons
 USE_LDCONFIG=	yes
 
+PLIST_SUB=	PYTHON_ABIVER=${PYTHON_VERSION:C/python3\\.([0-9]+)/\\1/}
+
 USE_GITHUB=	yes
 GH_ACCOUNT=	Cantera
 GH_TUPLE=	LLNL:sundials:887af43:sundials/ext/sundials # bundled sundials is only needed for the Octave option
@@ -93,7 +96,7 @@ do-install-PYTHON-on:
 	# strip
 	@${STRIP_CMD} \
 		${STAGEDIR}${PYTHON_SITELIBDIR}/cantera/_cantera.cpython-${PYTHON_SUFFIX}.so \
-		${STAGEDIR}${PREFIX}/lib/libcantera_python3_11.so
+		${STAGEDIR}${PREFIX}/lib/libcantera_python3_${PYTHON_VERSION:C/python3\\.([0-9]+)/\\1/}.so
 	# remove empty dirs
 	@${RMDIR} \
 		${STAGEDIR}${PYTHON_SITELIBDIR}/cantera/__pycache__ \
diff --git a/science/cantera/files/patch-interfaces_cython_SConscript b/science/cantera/files/patch-interfaces_cython_SConscript
new file mode 100644
index 000000000000..0bd2f4df5569
--- /dev/null
+++ b/science/cantera/files/patch-interfaces_cython_SConscript
@@ -0,0 +1,40 @@
+-- Make the Python wheel build/install robust against platform tag mismatches.
+-- pip wheel derives the platform tag from sysconfig.get_platform(), which can
+-- differ from what SCons reconstructs (for example, host/jail OSVERSION
+-- differences in Poudriere). Instead of hardcoding the expected wheel filename,
+-- build a sentinel file and discover the actual .whl when installing.
+-- See https://github.com/Cantera/cantera/issues/1862
+
+--- interfaces/cython/SConscript.orig	2025-11-17 22:34:45 UTC
++++ interfaces/cython/SConscript
+@@ -86,16 +86,11 @@ if parse_version(localenv["py_version_short"]) >= env[
+ if parse_version(localenv["py_version_short"]) >= env["python_max_version"]:
+     build_cmd += " --ignore-requires-python"
+ 
+-# Setuptools 75.3.1 and later always lowercase the package name
+-if localenv["setuptools_version"] >= parse_version("75.3.1"):
+-    pkg_name = "cantera"
+-else:
+-    pkg_name = "Cantera"
+-
+-wheel_name = (pkg_name + "-${cantera_version}-cp${py_version_nodot}"
+-              "-cp${py_version_nodot}-${py_plat}.whl")
+-mod = build(localenv.Command(f"#build/python/dist/{wheel_name}", "setup.cfg",
+-                             build_cmd))
++# Use a sentinel target rather than a hardcoded wheel filename, because pip may
++# produce a different platform tag than the one computed from sysconfig.
++wheel_marker = "build/python/dist/.cantera-wheel-built"
++build_cmd += f" && touch {wheel_marker}"
++mod = build(localenv.Command(f"#{wheel_marker}", "setup.cfg", build_cmd))
+ env['python_module'] = mod
+ env['python_extension'] = ext
+ 
+@@ -184,7 +179,7 @@ install_cmd.extend(("--no-build-isolation", "--no-deps
+     install_cmd.append(f"--root={stage_dir.resolve()}")
+ 
+ install_cmd.extend(("--no-build-isolation", "--no-deps", "-v", "--force-reinstall",
+-                    "$SOURCE"))
++                    "$$(ls -1 build/python/dist/*.whl | head -n 1)"))
+ 
+ mod_inst = install(localenv.Command, "dummy", mod, " ".join(install_cmd))
+ env["install_python_action"] = mod_inst
diff --git a/science/cantera/pkg-plist b/science/cantera/pkg-plist
index 082a0d70f112..16d452118617 100644
--- a/science/cantera/pkg-plist
+++ b/science/cantera/pkg-plist
@@ -624,7 +624,7 @@ include/cantera_clib/cttrans.h
 %%OCTAVE%%lib/cantera/matlab/toolbox/polynom.m
 %%OCTAVE%%lib/cantera/matlab/toolbox/useLegacyRateConstants.m
 lib/libcantera.a
-%%PYTHON%%lib/libcantera_python3_11.so
+%%PYTHON%%lib/libcantera_python3_%%PYTHON_ABIVER%%.so
 lib/libcantera_shared.so
 lib/libcantera_shared.so.3
 lib/libcantera_shared.so.3.2.0