sci-electronics/yosys: call python_setup for valid PYTHON_EXECUTABLE

- llvm-r2 pkg_setup shadowed python-any-r1 so PYTHON was empty in all phases
- call python_setup in pkg_setup and drop the src_prepare shebang/chmod loop
- python_fix_shebang the installed yosys-smtbmc and yosys-witness wrappers

Closes: https://bugs.gentoo.org/976328
Signed-off-by: Huang Rui <vowstar@gmail.com>
This commit is contained in:
Huang Rui
2026-06-14 03:46:07 +08:00
parent 2b8f831d5a
commit df0e0bcadd

View File

@@ -38,19 +38,13 @@ BDEPEND="
virtual/pkgconfig
"
src_prepare() {
default
# Fix execute permissions and add shebang for Python scripts
local script
while IFS= read -r -d '' script; do
chmod +x "${script}" || die
# Add shebang if missing
if ! head -n 1 "${script}" | grep -q '^#!'; then
sed -i '1i#!/usr/bin/env python3' "${script}" || die
fi
done < <(find . -name "*.py" -print0)
pkg_setup() {
# llvm-r2 and python-any-r1 both export pkg_setup and llvm-r2 wins,
# leaving PYTHON unset, so call python_setup ourselves. An empty
# PYTHON_EXECUTABLE makes the Makefile run helper scripts via their env
# python3 shebang, which breaks with python-exec[-native-symlinks].
llvm-r2_pkg_setup
python_setup
}
src_configure() {
@@ -64,3 +58,11 @@ src_configure() {
default
}
src_install() {
default
# yosys-smtbmc and yosys-witness keep an env python3 shebang that also
# breaks under python-exec[-native-symlinks]; retarget them at EPYTHON.
python_fix_shebang "${ED}"/usr/bin/yosys-smtbmc "${ED}"/usr/bin/yosys-witness
}