RPi: Fix jpeglib ARM64 build - skip turbo/mozjpeg correctly

Only remove dictionary entries for turbo/mozjpeg versions in setup.py
(they need cmake-generated headers). Keep the if blocks intact - they
safely evaluate to False for standard libjpeg versions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Aaron D. Lee
2026-01-10 23:15:34 -05:00
parent ebc999b2b3
commit 5a68840725

View File

@@ -366,16 +366,25 @@ else
done done
# Skip turbo/mozjpeg - they need cmake-generated headers # Skip turbo/mozjpeg - they need cmake-generated headers
# Patch setup.py to only build standard libjpeg versions # Only remove dict entries (lines 49-59), keep if blocks (they're safe when is_turbo=False)
echo " Patching setup.py to skip turbo/mozjpeg (need cmake)..." echo " Patching setup.py to skip turbo/mozjpeg (need cmake)..."
python3 -c " python3 << 'PYPATCH'
with open('setup.py', 'r') as f: with open('setup.py', 'r') as f:
lines = f.readlines() lines = f.readlines()
# Filter out lines containing turbo or mozjpeg filtered = []
filtered = [l for l in lines if 'turbo' not in l and 'mozjpeg' not in l] for line in lines:
# Only skip dict entries like "'turbo120': ..." or "'mozjpeg101': ..."
stripped = line.strip()
if stripped.startswith("'turbo") and ':' in stripped:
continue
if stripped.startswith("'mozjpeg") and ':' in stripped:
continue
if stripped.startswith("# 'turbo"): # commented turbo line
continue
filtered.append(line)
with open('setup.py', 'w') as f: with open('setup.py', 'w') as f:
f.writelines(filtered) f.writelines(filtered)
" PYPATCH
# Build and install # Build and install
echo " Building jpeglib (this takes a few minutes)..." echo " Building jpeglib (this takes a few minutes)..."