Push Bot commited on
Commit
54b9a68
Β·
1 Parent(s): d3f4e5f

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
@@ -2850,6 +2850,24 @@ def debug_compile_uploaded_zip(zip_file):
2850
 
2851
  def debug_compile_output_zip():
2852
  """Compile the repo-root output.zip (a real LaTeX project) and preview the resulting PDF."""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2853
  logs = [f"🐞 Debug(real) at {_now_str()}"]
2854
  zip_path = ROOT / "output.zip"
2855
  if not zip_path.exists():
@@ -2961,7 +2979,18 @@ def debug_compile_last_pipeline_zip():
2961
  logs = [f"🐞 Debug(last-pipeline-zip) at {_now_str()}"]
2962
  last_zip = _find_last_pipeline_zip()
2963
  if not last_zip:
2964
- return "<div style='color:#b00'>No recent pipeline output.zip found under runs/.</div>"
 
 
 
 
 
 
 
 
 
 
 
2965
 
2966
  # Prepare workspace
2967
  run_id, WORK_DIR, LOG_PATH, _ = _prepare_workspace(logs)
 
2850
 
2851
  def debug_compile_output_zip():
2852
  """Compile the repo-root output.zip (a real LaTeX project) and preview the resulting PDF."""
2853
+ # Stage repo output.zip to runs/<id>/output.zip to follow pipeline layout, then delegate
2854
+ zip_path = ROOT / "output.zip"
2855
+ if not zip_path.exists():
2856
+ return (
2857
+ "<div style='color:#b00'><b>output.zip not found at repo root.</b></div>"
2858
+ + f"<div>Expected at: {zip_path}</div>"
2859
+ )
2860
+ logs = [f"🐞 Stage(repo zip) at {_now_str()}"]
2861
+ _, WORK_DIR, LOG_PATH, ZIP_PATH = _prepare_workspace(logs)
2862
+ try:
2863
+ shutil.copy2(zip_path, ZIP_PATH)
2864
+ logs.append(f"πŸ“¦ Staged repo output.zip β†’ runs/{WORK_DIR.name}/output.zip")
2865
+ _write_logs(LOG_PATH, logs)
2866
+ except Exception as e:
2867
+ logs.append(f"❌ Failed staging output.zip: {e}")
2868
+ _write_logs(LOG_PATH, logs)
2869
+ return "<div style='color:#b00'>Failed to stage output.zip</div>"
2870
+ return debug_compile_last_pipeline_zip()
2871
  logs = [f"🐞 Debug(real) at {_now_str()}"]
2872
  zip_path = ROOT / "output.zip"
2873
  if not zip_path.exists():
 
2979
  logs = [f"🐞 Debug(last-pipeline-zip) at {_now_str()}"]
2980
  last_zip = _find_last_pipeline_zip()
2981
  if not last_zip:
2982
+ repo_zip = ROOT / "output.zip"
2983
+ if repo_zip.exists():
2984
+ try:
2985
+ _, W, L, Z = _prepare_workspace(logs)
2986
+ shutil.copy2(repo_zip, Z)
2987
+ logs.append(f"πŸ“¦ Auto-staged repo output.zip β†’ runs/{W.name}/output.zip")
2988
+ last_zip = Z
2989
+ except Exception as e:
2990
+ logs.append(f"❌ Auto-stage failed: {e}")
2991
+ return "<div style='color:#b00'>No recent pipeline output.zip found and auto-stage failed.</div>"
2992
+ else:
2993
+ return "<div style='color:#b00'>No recent pipeline output.zip found under runs/.</div>"
2994
 
2995
  # Prepare workspace
2996
  run_id, WORK_DIR, LOG_PATH, _ = _prepare_workspace(logs)