From 5539eaf123e4d30530ca695d0c1a37d82ff827f0 Mon Sep 17 00:00:00 2001 From: Jacob Heider Date: Sat, 13 Jun 2026 16:58:34 -0400 Subject: [PATCH] better-pyvenv-fix --- libexec/bkpyvenv | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/libexec/bkpyvenv b/libexec/bkpyvenv index 2e0f0b4e..73498cab 100755 --- a/libexec/bkpyvenv +++ b/libexec/bkpyvenv @@ -37,13 +37,23 @@ stage) poetry config virtualenvs.create true poetry config virtualenvs.in-project true else - # --copies: copy the python binary into the venv instead of - # symlinking it. With the default --symlinks behavior the resulting - # `$PREFIX/venv/bin/python` is an absolute symlink to - # `/opt/python.org/v/bin/python`, which breaks any bottle - # installed somewhere other than /opt (eg. /usr/local/pkgs/... - # via pkgm). See pkgxdev/pantry#8487 for the original report. - python -m venv --copies "$PREFIX"/venv + case "$(uname -s)" in + Linux) + # --copies: copy the python binary into the venv instead of + # symlinking it. With the default --symlinks behavior the resulting + # `$PREFIX/venv/bin/python` is an absolute symlink to + # `/opt/python.org/v/bin/python`, which breaks any bottle + # installed somewhere other than /opt (eg. /usr/local/pkgs/... + # via pkgm). See pkgxdev/pantry#8487 for the original report. + python -m venv --copies "$PREFIX"/venv + ;; + *) + # macOS: --copies breaks signed/framework python binaries. + # The pkgm-relocation problem #8487 doesn't apply on darwin in + # the same way (different runtime resolution) + python -m venv "$PREFIX"/venv + ;; + esac fi ;; seal)