From 5a68840725dc17bf2bd1b27ee36ca18af4cbae36 Mon Sep 17 00:00:00 2001 From: "Aaron D. Lee" Date: Sat, 10 Jan 2026 23:15:34 -0500 Subject: [PATCH] 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 --- rpi/setup.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/rpi/setup.sh b/rpi/setup.sh index 478c135..09a18af 100755 --- a/rpi/setup.sh +++ b/rpi/setup.sh @@ -366,16 +366,25 @@ else done # 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)..." - python3 -c " + python3 << 'PYPATCH' with open('setup.py', 'r') as f: lines = f.readlines() -# Filter out lines containing turbo or mozjpeg -filtered = [l for l in lines if 'turbo' not in l and 'mozjpeg' not in l] +filtered = [] +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: f.writelines(filtered) -" +PYPATCH # Build and install echo " Building jpeglib (this takes a few minutes)..."