From df0e0bcadda94fef28152f2c1209c8d70bf88d31 Mon Sep 17 00:00:00 2001 From: Huang Rui Date: Sun, 14 Jun 2026 03:46:07 +0800 Subject: [PATCH] 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 --- sci-electronics/yosys/yosys-0.65.ebuild | 28 +++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/sci-electronics/yosys/yosys-0.65.ebuild b/sci-electronics/yosys/yosys-0.65.ebuild index 7e248a33a4..02face6b86 100644 --- a/sci-electronics/yosys/yosys-0.65.ebuild +++ b/sci-electronics/yosys/yosys-0.65.ebuild @@ -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 +}