science/cantera: Unbreak by fixing wheel-filename mismatch via SConscript sentinel/glob
Also: Python ABI parameterized in strip target and pkg-plist.
This commit is contained in:
@@ -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__ \
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user