From d63ed4aadeabbc3c3fc72307fe72cfc238af5b07 Mon Sep 17 00:00:00 2001 From: Lloyd Date: Thu, 25 Jun 2026 22:11:48 +0100 Subject: [PATCH 1/3] fix: update repository references in Docker publish workflow --- .github/workflows/docker-publish.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index b96d3d3..feb376f 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -16,8 +16,8 @@ jobs: docker: if: | github.event_name == 'workflow_dispatch' || - github.repository == 'pyMC-dev/openhop-repeater' || - github.repository == 'yellowcooln/openhop-repeater' + github.repository == 'openhop-dev/openhop_repeater' || + github.repository == 'yellowcooln/openhop_repeater' runs-on: ubuntu-latest permissions: contents: read @@ -58,7 +58,7 @@ jobs: run: | if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ inputs.image_repository }}" ]; then image_repository="${{ inputs.image_repository }}" - elif [ "${{ github.repository }}" = "yellowcooln/openhop-repeater" ]; then + elif [ "${{ github.repository }}" = "yellowcooln/openhop_repeater" ]; then image_repository="yellowcooln/openhop-repeater" else image_repository="pymcdev/openhop-repeater" @@ -92,7 +92,7 @@ jobs: cache-to: type=gha,mode=max - name: Notify Home Assistant add-on repository - if: github.repository == 'pyMC-dev/openhop-repeater' + if: github.repository == 'openhop-dev/openhop_repeater' env: DISPATCH_TOKEN: ${{ secrets.HA_ADDON_REPO_DISPATCH_TOKEN }} CHANNEL: ${{ github.ref_name }} From cc0dc2ffd6705d3f2d1ac11d9d3af3279297672c Mon Sep 17 00:00:00 2001 From: Lloyd Date: Thu, 25 Jun 2026 23:13:28 +0100 Subject: [PATCH 2/3] fix: virtual environment creation logic in manage.sh --- manage.sh | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/manage.sh b/manage.sh index 2975673..e57d9df 100755 --- a/manage.sh +++ b/manage.sh @@ -90,12 +90,30 @@ migrate_legacy_paths() { # Create (or re-create) the dedicated venv for openhop_repeater ensure_venv() { + local recreate=0 + if [ ! -x "$VENV_PYTHON" ]; then - echo ">>> Creating virtual environment at $VENV_DIR ..." - python3 -m venv --system-site-packages "$VENV_DIR" - # Upgrade pip inside the venv - "$VENV_PIP" install --upgrade pip setuptools wheel >/dev/null 2>&1 || true + recreate=1 + elif ! "$VENV_PYTHON" -c 'import sys; print(sys.executable)' >/dev/null 2>&1; then + # Venv python exists but points to a missing interpreter (stale venv). + recreate=1 + elif ! "$VENV_PYTHON" -m pip --version >/dev/null 2>&1; then + # Pip script/shebang can break after Python upgrades; treat as stale. + recreate=1 fi + + if [ "$recreate" -eq 1 ]; then + if [ -d "$VENV_DIR" ]; then + echo ">>> Rebuilding broken virtual environment at $VENV_DIR ..." + rm -rf "$VENV_DIR" + else + echo ">>> Creating virtual environment at $VENV_DIR ..." + fi + python3 -m venv --system-site-packages "$VENV_DIR" + fi + + # Always use python -m pip so we don't rely on a potentially stale pip wrapper. + "$VENV_PYTHON" -m pip install --upgrade pip setuptools wheel >/dev/null 2>&1 || true } # Migrate an existing system-pip install into the venv. From 9748058010e9c956bc1053a42c898da81cf5b3fd Mon Sep 17 00:00:00 2001 From: Lloyd Date: Thu, 25 Jun 2026 23:32:19 +0100 Subject: [PATCH 3/3] fix: update virtual environment pip usage in manage.sh --- manage.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/manage.sh b/manage.sh index e57d9df..170317f 100755 --- a/manage.sh +++ b/manage.sh @@ -585,7 +585,7 @@ fi if [ ! -x "$VENV_PYTHON" ]; then echo "[pymc-do-upgrade] Creating venv at $VENV_DIR ..." python3 -m venv --system-site-packages "$VENV_DIR" - "$VENV_PIP" install --upgrade pip setuptools wheel >/dev/null 2>&1 || true + "$VENV_PYTHON" -m pip install --upgrade pip setuptools wheel >/dev/null 2>&1 || true fi # ---- Migration: clean up legacy service unit issues ---- SVC_UNIT=/etc/systemd/system/openhop-repeater.service @@ -633,10 +633,10 @@ if [ -n "$ARCH_TAG" ]; then PY_TAG=$("$VENV_PYTHON" -c 'import sys; v=f"cp{sys.version_info.major}{sys.version_info.minor}"; print(f"{v}-{v}")' 2>/dev/null || echo "cp311-cp311") WHEEL_BASE="${R2_BASE_URL}/${ARCH_TAG}/${PLATFORM_TAG}/${PY_TAG}" echo "[pymc-do-upgrade] Trying dependencies from R2 wheels..." - "$VENV_PIP" install --find-links "${WHEEL_BASE}/index.html" --no-cache-dir "pycryptodome>=3.23.0" "PyNaCl>=1.5.0" cffi "pyyaml>=6.0.0" 2>/dev/null || true + "$VENV_PYTHON" -m pip install --find-links "${WHEEL_BASE}/index.html" --no-cache-dir "pycryptodome>=3.23.0" "PyNaCl>=1.5.0" cffi "pyyaml>=6.0.0" 2>/dev/null || true fi # ---- Install openhop_repeater from git ---- -if "$VENV_PIP" install \ +if "$VENV_PYTHON" -m pip install \ --upgrade \ --no-cache-dir \ "openhop_repeater[hardware] @ git+https://github.com/rightup/openhop-repeater.git@${CHANNEL}"; then @@ -705,7 +705,7 @@ UPGRADEEOF WHEEL_BASE="${R2_BASE_URL}/${ARCH_TAG}/${PLATFORM_TAG}/${PY_TAG}" echo " Checking for R2 wheels (${ARCH_TAG}/${PLATFORM_TAG}/${PY_TAG})..." echo " Trying install from R2 pre-built wheels..." - "$VENV_PIP" install --find-links "${WHEEL_BASE}/index.html" --no-cache-dir "pycryptodome>=3.23.0" "PyNaCl>=1.5.0" cffi "pyyaml>=6.0.0" 2>/dev/null && R2_SUCCESS=1 || R2_SUCCESS=0 + "$VENV_PYTHON" -m pip install --find-links "${WHEEL_BASE}/index.html" --no-cache-dir "pycryptodome>=3.23.0" "PyNaCl>=1.5.0" cffi "pyyaml>=6.0.0" 2>/dev/null && R2_SUCCESS=1 || R2_SUCCESS=0 if [ "$R2_SUCCESS" -eq 1 ]; then echo " ✓ R2 wheels installed" else @@ -714,7 +714,7 @@ UPGRADEEOF fi fi - if "$VENV_PIP" install --upgrade --no-cache-dir .[hardware]; then + if "$VENV_PYTHON" -m pip install --upgrade --no-cache-dir .[hardware]; then echo "" echo "✓ Python package installation completed successfully!" @@ -1020,7 +1020,7 @@ fi if [ ! -x "$VENV_PYTHON" ]; then echo "[pymc-do-upgrade] Creating venv at $VENV_DIR ..." python3 -m venv --system-site-packages "$VENV_DIR" - "$VENV_PIP" install --upgrade pip setuptools wheel >/dev/null 2>&1 || true + "$VENV_PYTHON" -m pip install --upgrade pip setuptools wheel >/dev/null 2>&1 || true fi # ---- Migration: clean up legacy service unit issues ---- SVC_UNIT=/etc/systemd/system/openhop-repeater.service @@ -1068,10 +1068,10 @@ python3 -m pip uninstall -y pymc_core 2>/dev/null || true PY_TAG=$("$VENV_PYTHON" -c 'import sys; v=f"cp{sys.version_info.major}{sys.version_info.minor}"; print(f"{v}-{v}")' 2>/dev/null || echo "cp311-cp311") WHEEL_BASE="${R2_BASE_URL}/${ARCH_TAG}/${PLATFORM_TAG}/${PY_TAG}" echo "[pymc-do-upgrade] Trying dependencies from R2 wheels..." - "$VENV_PIP" install --find-links "${WHEEL_BASE}/index.html" --no-cache-dir "pycryptodome>=3.23.0" "PyNaCl>=1.5.0" cffi "pyyaml>=6.0.0" 2>/dev/null || true + "$VENV_PYTHON" -m pip install --find-links "${WHEEL_BASE}/index.html" --no-cache-dir "pycryptodome>=3.23.0" "PyNaCl>=1.5.0" cffi "pyyaml>=6.0.0" 2>/dev/null || true fi # ---- Install openhop_repeater from git ---- - if "$VENV_PIP" install \ + if "$VENV_PYTHON" -m pip install \ --upgrade \ --no-cache-dir \ "openhop_repeater[hardware] @ git+https://github.com/rightup/openhop-repeater.git@${CHANNEL}"; then @@ -1140,7 +1140,7 @@ UPGRADEEOF WHEEL_BASE="${R2_BASE_URL}/${ARCH_TAG}/${PLATFORM_TAG}/${PY_TAG}" echo " Checking for R2 wheels (${ARCH_TAG}/${PLATFORM_TAG}/${PY_TAG})..." echo " Trying install from R2 pre-built wheels..." - "$VENV_PIP" install --find-links "${WHEEL_BASE}/index.html" --no-cache-dir "pycryptodome>=3.23.0" "PyNaCl>=1.5.0" cffi "pyyaml>=6.0.0" 2>/dev/null && R2_SUCCESS=1 || R2_SUCCESS=0 + "$VENV_PYTHON" -m pip install --find-links "${WHEEL_BASE}/index.html" --no-cache-dir "pycryptodome>=3.23.0" "PyNaCl>=1.5.0" cffi "pyyaml>=6.0.0" 2>/dev/null && R2_SUCCESS=1 || R2_SUCCESS=0 if [ "$R2_SUCCESS" -eq 1 ]; then echo " ✓ R2 wheels installed" else @@ -1149,7 +1149,7 @@ UPGRADEEOF fi fi - if "$VENV_PIP" install --upgrade --no-cache-dir .[hardware]; then + if "$VENV_PYTHON" -m pip install --upgrade --no-cache-dir .[hardware]; then echo "" echo "✓ Package and dependencies upgraded successfully!" else