Spaces:
Running
Running
Z User commited on
Commit ·
25d86d2
1
Parent(s): aa686c9
fix: correct patch path for editable install
Browse files- scripts/patch_file_delivery.py +15 -17
scripts/patch_file_delivery.py
CHANGED
|
@@ -12,6 +12,8 @@ on Feishu and WeChat instead of appearing as a plain text path.
|
|
| 12 |
|
| 13 |
import re
|
| 14 |
import sys
|
|
|
|
|
|
|
| 15 |
|
| 16 |
def patch_file(filepath: str):
|
| 17 |
with open(filepath, 'r') as f:
|
|
@@ -55,27 +57,23 @@ def patch_file(filepath: str):
|
|
| 55 |
print(f"Patched {filepath}: added document/audio/archive extensions to _LOCAL_MEDIA_EXTS")
|
| 56 |
|
| 57 |
if __name__ == "__main__":
|
| 58 |
-
#
|
| 59 |
-
|
|
|
|
|
|
|
| 60 |
|
| 61 |
-
#
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
if
|
| 67 |
-
filepath =
|
| 68 |
break
|
| 69 |
|
| 70 |
if not filepath:
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
matches = glob.glob("/app/venv/lib/**/gateway/platforms/base.py", recursive=True)
|
| 74 |
-
if matches:
|
| 75 |
-
filepath = matches[0]
|
| 76 |
-
|
| 77 |
-
if not filepath or not os.path.isfile(filepath):
|
| 78 |
-
print(f"ERROR: base.py not found", file=sys.stderr)
|
| 79 |
sys.exit(1)
|
| 80 |
|
| 81 |
patch_file(filepath)
|
|
|
|
| 12 |
|
| 13 |
import re
|
| 14 |
import sys
|
| 15 |
+
import os
|
| 16 |
+
import glob
|
| 17 |
|
| 18 |
def patch_file(filepath: str):
|
| 19 |
with open(filepath, 'r') as f:
|
|
|
|
| 57 |
print(f"Patched {filepath}: added document/audio/archive extensions to _LOCAL_MEDIA_EXTS")
|
| 58 |
|
| 59 |
if __name__ == "__main__":
|
| 60 |
+
# hermes-agent is installed in editable mode (-e), so source is in /app/hermes-agent/
|
| 61 |
+
candidates = [
|
| 62 |
+
"/app/hermes-agent/gateway/platforms/base.py",
|
| 63 |
+
]
|
| 64 |
|
| 65 |
+
# Also search venv site-packages as fallback
|
| 66 |
+
candidates.extend(glob.glob("/app/venv/lib/**/gateway/platforms/base.py", recursive=True))
|
| 67 |
+
|
| 68 |
+
filepath = None
|
| 69 |
+
for c in candidates:
|
| 70 |
+
if os.path.isfile(c):
|
| 71 |
+
filepath = c
|
| 72 |
break
|
| 73 |
|
| 74 |
if not filepath:
|
| 75 |
+
print("ERROR: base.py not found in any candidate location", file=sys.stderr)
|
| 76 |
+
print(f"Checked: {candidates}", file=sys.stderr)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
sys.exit(1)
|
| 78 |
|
| 79 |
patch_file(filepath)
|