Spaces:
Running
Running
Push Bot
commited on
Commit
Β·
468c76a
1
Parent(s):
360b5be
Fix SyntaxError; simplify debug; stage repo zip; make packages.txt empty
Browse files
app.py
CHANGED
|
@@ -962,6 +962,24 @@ def debug_compile_uploaded_zip(zip_file):
|
|
| 962 |
|
| 963 |
def debug_compile_output_zip():
|
| 964 |
"""Compile the repo-root output.zip (a real LaTeX project) and preview the resulting PDF."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 965 |
logs = [f"π Debug(real) at {_now_str()}"]
|
| 966 |
zip_path = ROOT / "output.zip"
|
| 967 |
if not zip_path.exists():
|
|
@@ -1073,7 +1091,18 @@ def debug_compile_last_pipeline_zip():
|
|
| 1073 |
logs = [f"π Debug(last-pipeline-zip) at {_now_str()}"]
|
| 1074 |
last_zip = _find_last_pipeline_zip()
|
| 1075 |
if not last_zip:
|
| 1076 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1077 |
|
| 1078 |
# Prepare workspace
|
| 1079 |
run_id, WORK_DIR, LOG_PATH, _ = _prepare_workspace(logs)
|
|
|
|
| 962 |
|
| 963 |
def debug_compile_output_zip():
|
| 964 |
"""Compile the repo-root output.zip (a real LaTeX project) and preview the resulting PDF."""
|
| 965 |
+
# Stage repo output.zip to runs/<id>/output.zip to follow pipeline layout, then delegate
|
| 966 |
+
zip_path = ROOT / "output.zip"
|
| 967 |
+
if not zip_path.exists():
|
| 968 |
+
return (
|
| 969 |
+
"<div style='color:#b00'><b>output.zip not found at repo root.</b></div>"
|
| 970 |
+
+ f"<div>Expected at: {zip_path}</div>"
|
| 971 |
+
)
|
| 972 |
+
logs = [f"π Stage(repo zip) at {_now_str()}"]
|
| 973 |
+
_, WORK_DIR, LOG_PATH, ZIP_PATH = _prepare_workspace(logs)
|
| 974 |
+
try:
|
| 975 |
+
shutil.copy2(zip_path, ZIP_PATH)
|
| 976 |
+
logs.append(f"π¦ Staged repo output.zip β runs/{WORK_DIR.name}/output.zip")
|
| 977 |
+
_write_logs(LOG_PATH, logs)
|
| 978 |
+
except Exception as e:
|
| 979 |
+
logs.append(f"β Failed staging output.zip: {e}")
|
| 980 |
+
_write_logs(LOG_PATH, logs)
|
| 981 |
+
return "<div style='color:#b00'>Failed to stage output.zip</div>"
|
| 982 |
+
return debug_compile_last_pipeline_zip()
|
| 983 |
logs = [f"π Debug(real) at {_now_str()}"]
|
| 984 |
zip_path = ROOT / "output.zip"
|
| 985 |
if not zip_path.exists():
|
|
|
|
| 1091 |
logs = [f"π Debug(last-pipeline-zip) at {_now_str()}"]
|
| 1092 |
last_zip = _find_last_pipeline_zip()
|
| 1093 |
if not last_zip:
|
| 1094 |
+
repo_zip = ROOT / "output.zip"
|
| 1095 |
+
if repo_zip.exists():
|
| 1096 |
+
try:
|
| 1097 |
+
_, W, L, Z = _prepare_workspace(logs)
|
| 1098 |
+
shutil.copy2(repo_zip, Z)
|
| 1099 |
+
logs.append(f"π¦ Auto-staged repo output.zip β runs/{W.name}/output.zip")
|
| 1100 |
+
last_zip = Z
|
| 1101 |
+
except Exception as e:
|
| 1102 |
+
logs.append(f"β Auto-stage failed: {e}")
|
| 1103 |
+
return "<div style='color:#b00'>No recent pipeline output.zip found and auto-stage failed.</div>"
|
| 1104 |
+
else:
|
| 1105 |
+
return "<div style='color:#b00'>No recent pipeline output.zip found under runs/.</div>"
|
| 1106 |
|
| 1107 |
# Prepare workspace
|
| 1108 |
run_id, WORK_DIR, LOG_PATH, _ = _prepare_workspace(logs)
|