Push Bot commited on
Commit
8a9497a
Β·
1 Parent(s): 23f541f

Fix SyntaxError; simplify debug; stage repo zip; make packages.txt empty

Browse files
Files changed (1) hide show
  1. app.py +30 -1
app.py CHANGED
@@ -1015,6 +1015,24 @@ def debug_compile_uploaded_zip(zip_file):
1015
 
1016
  def debug_compile_output_zip():
1017
  """Compile the repo-root output.zip (a real LaTeX project) and preview the resulting PDF."""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1018
  logs = [f"🐞 Debug(real) at {_now_str()}"]
1019
  zip_path = ROOT / "output.zip"
1020
  if not zip_path.exists():
@@ -1126,7 +1144,18 @@ def debug_compile_last_pipeline_zip():
1126
  logs = [f"🐞 Debug(last-pipeline-zip) at {_now_str()}"]
1127
  last_zip = _find_last_pipeline_zip()
1128
  if not last_zip:
1129
- return "<div style='color:#b00'>No recent pipeline output.zip found under runs/.</div>"
 
 
 
 
 
 
 
 
 
 
 
1130
 
1131
  # Prepare workspace
1132
  run_id, WORK_DIR, LOG_PATH, _ = _prepare_workspace(logs)
 
1015
 
1016
  def debug_compile_output_zip():
1017
  """Compile the repo-root output.zip (a real LaTeX project) and preview the resulting PDF."""
1018
+ # Stage repo output.zip to runs/<id>/output.zip to follow pipeline layout, then delegate
1019
+ zip_path = ROOT / "output.zip"
1020
+ if not zip_path.exists():
1021
+ return (
1022
+ "<div style='color:#b00'><b>output.zip not found at repo root.</b></div>"
1023
+ + f"<div>Expected at: {zip_path}</div>"
1024
+ )
1025
+ logs = [f"🐞 Stage(repo zip) at {_now_str()}"]
1026
+ _, WORK_DIR, LOG_PATH, ZIP_PATH = _prepare_workspace(logs)
1027
+ try:
1028
+ shutil.copy2(zip_path, ZIP_PATH)
1029
+ logs.append(f"πŸ“¦ Staged repo output.zip β†’ runs/{WORK_DIR.name}/output.zip")
1030
+ _write_logs(LOG_PATH, logs)
1031
+ except Exception as e:
1032
+ logs.append(f"❌ Failed staging output.zip: {e}")
1033
+ _write_logs(LOG_PATH, logs)
1034
+ return "<div style='color:#b00'>Failed to stage output.zip</div>"
1035
+ return debug_compile_last_pipeline_zip()
1036
  logs = [f"🐞 Debug(real) at {_now_str()}"]
1037
  zip_path = ROOT / "output.zip"
1038
  if not zip_path.exists():
 
1144
  logs = [f"🐞 Debug(last-pipeline-zip) at {_now_str()}"]
1145
  last_zip = _find_last_pipeline_zip()
1146
  if not last_zip:
1147
+ repo_zip = ROOT / "output.zip"
1148
+ if repo_zip.exists():
1149
+ try:
1150
+ _, W, L, Z = _prepare_workspace(logs)
1151
+ shutil.copy2(repo_zip, Z)
1152
+ logs.append(f"πŸ“¦ Auto-staged repo output.zip β†’ runs/{W.name}/output.zip")
1153
+ last_zip = Z
1154
+ except Exception as e:
1155
+ logs.append(f"❌ Auto-stage failed: {e}")
1156
+ return "<div style='color:#b00'>No recent pipeline output.zip found and auto-stage failed.</div>"
1157
+ else:
1158
+ return "<div style='color:#b00'>No recent pipeline output.zip found under runs/.</div>"
1159
 
1160
  # Prepare workspace
1161
  run_id, WORK_DIR, LOG_PATH, _ = _prepare_workspace(logs)