From f46ef01f5ff7a19fab6985b0dd93194b03a2470c Mon Sep 17 00:00:00 2001 From: "Aaron D. Lee" Date: Sat, 10 Jan 2026 23:06:17 -0500 Subject: [PATCH] RPi: Fix setup.py patching (use Python regex instead of sed) --- rpi/setup.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/rpi/setup.sh b/rpi/setup.sh index 14fab7e..d684cb8 100755 --- a/rpi/setup.sh +++ b/rpi/setup.sh @@ -368,9 +368,17 @@ else # Skip turbo/mozjpeg - they need cmake-generated headers # Patch setup.py to only build standard libjpeg versions echo " Patching setup.py to skip turbo/mozjpeg (need cmake)..." - sed -i "s/libjpeg_versions = {/libjpeg_versions = {\n # turbo\/mozjpeg disabled - need cmake\n/g" setup.py - sed -i "/turbo/d" setup.py - sed -i "/mozjpeg/d" setup.py + python3 -c " +import re +with open('setup.py', 'r') as f: + content = f.read() +# Remove turbo and mozjpeg entries from libjpeg_versions dict +content = re.sub(r\"\\s*'turbo\\d+':[^,]+,\", '', content) +content = re.sub(r\"\\s*'mozjpeg\\d+':[^,]+,\", '', content) +content = re.sub(r\"\\s*#.*turbo.*\\n\", '\\n', content) +with open('setup.py', 'w') as f: + f.write(content) +" # Build and install echo " Building jpeglib (this takes a few minutes)..."