RPi: Fix setup.py patching (use Python regex instead of sed)
This commit is contained in:
14
rpi/setup.sh
14
rpi/setup.sh
@@ -368,9 +368,17 @@ else
|
|||||||
# 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
|
# Patch setup.py to only build standard libjpeg versions
|
||||||
echo " Patching setup.py to skip turbo/mozjpeg (need cmake)..."
|
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
|
python3 -c "
|
||||||
sed -i "/turbo/d" setup.py
|
import re
|
||||||
sed -i "/mozjpeg/d" setup.py
|
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
|
# Build and install
|
||||||
echo " Building jpeglib (this takes a few minutes)..."
|
echo " Building jpeglib (this takes a few minutes)..."
|
||||||
|
|||||||
Reference in New Issue
Block a user