From a16ddeec5f1f36555411410a0bd708125fcaf7bf Mon Sep 17 00:00:00 2001 From: yehuda arav Date: Sun, 19 Apr 2026 00:34:02 +0300 Subject: [PATCH] fix(install-env): patch PyFoam vendored six.py for Python 3.12+ PyFoam 2023.7 ships six.py v1.10 (2016), whose _SixMetaPathImporter trick no longer works under Python 3.12's tightened import machinery, breaking `from PyFoam.ThirdParty.six.moves import configparser`. Overwrite the vendored copy with the venv's modern six during install so the fix is reproducible across clean environments. Co-Authored-By: Claude Opus 4.7 (1M context) --- set_hera_environment.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/set_hera_environment.sh b/set_hera_environment.sh index 739448fc4..7ba7d06d4 100755 --- a/set_hera_environment.sh +++ b/set_hera_environment.sh @@ -29,6 +29,15 @@ else "${VENV_DIR}/bin/pip" install --upgrade pip "${VENV_DIR}/bin/pip" install -r "${SCRIPT_DIR}/requirements.txt" "${VENV_DIR}/bin/pip" install -e "${SCRIPT_DIR}" + + # Patch PyFoam's vendored six.py (v1.10 from 2016) which breaks on Python 3.12+. + SITE_SIX="$("${VENV_DIR}/bin/python" -c 'import six, pathlib; print(pathlib.Path(six.__file__))' 2>/dev/null)" + PYFOAM_SIX="$("${VENV_DIR}/bin/python" -c 'import PyFoam.ThirdParty, pathlib; print(pathlib.Path(PyFoam.ThirdParty.__file__).parent / "six.py")' 2>/dev/null)" + if [ -f "${SITE_SIX}" ] && [ -f "${PYFOAM_SIX}" ]; then + cp "${SITE_SIX}" "${PYFOAM_SIX}" + echo "Patched PyFoam vendored six.py -> ${PYFOAM_SIX}" + fi + echo "Virtual environment created and packages installed at ${VENV_DIR}." else echo "Skipped virtual environment creation."