acecalisto3 commited on
Commit
5354fa9
Β·
1 Parent(s): 2681e46

Update: fixed syntax issue and improvements

Browse files
Files changed (1) hide show
  1. fix.sh +15 -19
fix.sh CHANGED
@@ -1,27 +1,23 @@
1
  #!/bin/bash
2
 
3
- # File to patch
4
- TARGET_FILE="/usr/local/lib/python3.10/site-packages/pyth/plugins/rtf15/reader.py"
5
 
6
- # Backup first (good practice)
7
- if [ -f "$TARGET_FILE" ]; then
8
- echo "Backing up original file to ${TARGET_FILE}.bak"
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
- # Perform the patch: replace ur'...' with r'...' on matching lines
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
- # Confirm change
20
- echo "Patch complete. Checking if patch was successful:"
21
- grep "ur\"" "$TARGET_FILE" || grep "ur'" "$TARGET_FILE"
22
 
23
- if [ $? -eq 0 ]; then
24
- echo "⚠️ Warning: Some 'ur' strings may still remain. Please review manually."
25
- else
26
- echo "βœ… Patch successful! No remaining 'ur' strings."
27
- fi
 
 
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