Push Bot commited on
Commit
c4be7c2
Β·
1 Parent(s): 935382c

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
@@ -1840,6 +1840,24 @@ def debug_compile_uploaded_zip(zip_file):
1840
 
1841
  def debug_compile_output_zip():
1842
  """Compile the repo-root output.zip (a real LaTeX project) and preview the resulting PDF."""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1843
  logs = [f"🐞 Debug(real) at {_now_str()}"]
1844
  zip_path = ROOT / "output.zip"
1845
  if not zip_path.exists():
@@ -1951,7 +1969,18 @@ def debug_compile_last_pipeline_zip():
1951
  logs = [f"🐞 Debug(last-pipeline-zip) at {_now_str()}"]
1952
  last_zip = _find_last_pipeline_zip()
1953
  if not last_zip:
1954
- return "<div style='color:#b00'>No recent pipeline output.zip found under runs/.</div>"
 
 
 
 
 
 
 
 
 
 
 
1955
 
1956
  # Prepare workspace
1957
  run_id, WORK_DIR, LOG_PATH, _ = _prepare_workspace(logs)
 
1840
 
1841
  def debug_compile_output_zip():
1842
  """Compile the repo-root output.zip (a real LaTeX project) and preview the resulting PDF."""
1843
+ # Stage repo output.zip to runs/<id>/output.zip to follow pipeline layout, then delegate
1844
+ zip_path = ROOT / "output.zip"
1845
+ if not zip_path.exists():
1846
+ return (
1847
+ "<div style='color:#b00'><b>output.zip not found at repo root.</b></div>"
1848
+ + f"<div>Expected at: {zip_path}</div>"
1849
+ )
1850
+ logs = [f"🐞 Stage(repo zip) at {_now_str()}"]
1851
+ _, WORK_DIR, LOG_PATH, ZIP_PATH = _prepare_workspace(logs)
1852
+ try:
1853
+ shutil.copy2(zip_path, ZIP_PATH)
1854
+ logs.append(f"πŸ“¦ Staged repo output.zip β†’ runs/{WORK_DIR.name}/output.zip")
1855
+ _write_logs(LOG_PATH, logs)
1856
+ except Exception as e:
1857
+ logs.append(f"❌ Failed staging output.zip: {e}")
1858
+ _write_logs(LOG_PATH, logs)
1859
+ return "<div style='color:#b00'>Failed to stage output.zip</div>"
1860
+ return debug_compile_last_pipeline_zip()
1861
  logs = [f"🐞 Debug(real) at {_now_str()}"]
1862
  zip_path = ROOT / "output.zip"
1863
  if not zip_path.exists():
 
1969
  logs = [f"🐞 Debug(last-pipeline-zip) at {_now_str()}"]
1970
  last_zip = _find_last_pipeline_zip()
1971
  if not last_zip:
1972
+ repo_zip = ROOT / "output.zip"
1973
+ if repo_zip.exists():
1974
+ try:
1975
+ _, W, L, Z = _prepare_workspace(logs)
1976
+ shutil.copy2(repo_zip, Z)
1977
+ logs.append(f"πŸ“¦ Auto-staged repo output.zip β†’ runs/{W.name}/output.zip")
1978
+ last_zip = Z
1979
+ except Exception as e:
1980
+ logs.append(f"❌ Auto-stage failed: {e}")
1981
+ return "<div style='color:#b00'>No recent pipeline output.zip found and auto-stage failed.</div>"
1982
+ else:
1983
+ return "<div style='color:#b00'>No recent pipeline output.zip found under runs/.</div>"
1984
 
1985
  # Prepare workspace
1986
  run_id, WORK_DIR, LOG_PATH, _ = _prepare_workspace(logs)