Spaces:
Running
Running
Commit ·
5354fa9
1
Parent(s): 2681e46
Update: fixed syntax issue and improvements
Browse files
fix.sh
CHANGED
|
@@ -1,27 +1,23 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
if [ -
|
| 8 |
-
echo "
|
| 9 |
-
cp "$TARGET_FILE" "${TARGET_FILE}.bak"
|
| 10 |
-
else
|
| 11 |
-
echo "Error: Target file not found: $TARGET_FILE"
|
| 12 |
exit 1
|
| 13 |
fi
|
| 14 |
|
| 15 |
-
|
| 16 |
-
echo "Patching file to remove 'u' from 'ur' strings..."
|
| 17 |
-
sed -i 's/ur"/r"/g; s/ur'\''/r'\''/g' "$TARGET_FILE"
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
|
| 21 |
-
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
+
# Target directory where 'pyth' is installed
|
| 4 |
+
PYTH_DIR="/usr/local/lib/python3.10/site-packages/pyth"
|
| 5 |
|
| 6 |
+
# Check if directory exists
|
| 7 |
+
if [ ! -d "$PYTH_DIR" ]; then
|
| 8 |
+
echo "❌ pyth directory not found: $PYTH_DIR"
|
|
|
|
|
|
|
|
|
|
| 9 |
exit 1
|
| 10 |
fi
|
| 11 |
|
| 12 |
+
echo "🔧 Patching pyth for Python 3 compatibility..."
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
# Fix all ur'' strings to r''
|
| 15 |
+
find "$PYTH_DIR" -type f -name "*.py" -exec sed -i 's/ur"/r"/g' {} +
|
| 16 |
+
find "$PYTH_DIR" -type f -name "*.py" -exec sed -i "s/ur'/r'/g" {} +
|
| 17 |
|
| 18 |
+
# Replace unicode with str
|
| 19 |
+
find "$PYTH_DIR" -type f -name "*.py" -exec sed -i 's/\bunicode\b/str/g' {} +
|
| 20 |
+
|
| 21 |
+
echo "✅ Patching completed."
|
| 22 |
+
|
| 23 |
+
# Restart your app if needed
|