Siyuan Hu commited on
Commit
c41b46e
Β·
1 Parent(s): 4babf88

build(debug): ensure TEXINPUTS points to project; copy template *.sty into zip project; use local fonts via overrides; should resolve Raleway fontspec error

Browse files
Files changed (1) hide show
  1. app.py +17 -2
app.py CHANGED
@@ -453,7 +453,11 @@ def _compile_poster_pdf(OUTPUT_DIR: Path, logs):
453
  logs.append("⚠️ No TeX engine found (tectonic/lualatex/xelatex/latexmk) and 'tectonic' module missing. Skipping PDF compile.")
454
  return None
455
 
456
- proc = _sp.run(cmd, cwd=str(proj_dir), stdout=_sp.PIPE, stderr=_sp.STDOUT, text=True)
 
 
 
 
457
  if proc.stdout:
458
  logs.append(proc.stdout[-4000:])
459
  if proc.returncode != 0:
@@ -515,7 +519,10 @@ def _compile_tex_to_pdf(tex_path: Path, logs):
515
  except Exception:
516
  logs.append("⚠️ No TeX engine found.")
517
  return None
518
- proc = _sp.run(cmd, cwd=str(proj_dir), stdout=_sp.PIPE, stderr=_sp.STDOUT, text=True)
 
 
 
519
  if proc.stdout:
520
  logs.append(proc.stdout[-4000:])
521
  if proc.returncode != 0:
@@ -682,6 +689,14 @@ def debug_compile_output_zip():
682
  if fn.lower().endswith((".ttf", ".otf")):
683
  shutil.copy2(Path(root_dir)/fn, out_dir/fn)
684
  logs.append("πŸ“ Copied local fonts β†’ zip_proj/fonts/")
 
 
 
 
 
 
 
 
685
  # Append overrides into theme file(s)
686
  for sty in work_zip_dir.rglob("beamerthemegemini.sty"):
687
  with open(sty, "a", encoding="utf-8") as fh:
 
453
  logs.append("⚠️ No TeX engine found (tectonic/lualatex/xelatex/latexmk) and 'tectonic' module missing. Skipping PDF compile.")
454
  return None
455
 
456
+ import os as _os
457
+ _env = _os.environ.copy()
458
+ # Ensure TeX can find local theme/fonts in the project tree first
459
+ _env["TEXINPUTS"] = str(proj_dir) + _os.pathsep + _env.get("TEXINPUTS", "")
460
+ proc = _sp.run(cmd, cwd=str(proj_dir), stdout=_sp.PIPE, stderr=_sp.STDOUT, text=True, env=_env)
461
  if proc.stdout:
462
  logs.append(proc.stdout[-4000:])
463
  if proc.returncode != 0:
 
519
  except Exception:
520
  logs.append("⚠️ No TeX engine found.")
521
  return None
522
+ import os as _os
523
+ _env = _os.environ.copy()
524
+ _env["TEXINPUTS"] = str(proj_dir) + _os.pathsep + _env.get("TEXINPUTS", "")
525
+ proc = _sp.run(cmd, cwd=str(proj_dir), stdout=_sp.PIPE, stderr=_sp.STDOUT, text=True, env=_env)
526
  if proc.stdout:
527
  logs.append(proc.stdout[-4000:])
528
  if proc.returncode != 0:
 
689
  if fn.lower().endswith((".ttf", ".otf")):
690
  shutil.copy2(Path(root_dir)/fn, out_dir/fn)
691
  logs.append("πŸ“ Copied local fonts β†’ zip_proj/fonts/")
692
+ # Copy repository theme .sty files into project root so they take precedence
693
+ try:
694
+ tmpl_dir = ROOT / "template"
695
+ for sty in tmpl_dir.glob("*.sty"):
696
+ shutil.copy2(sty, work_zip_dir / sty.name)
697
+ logs.append("πŸ“„ Copied template/*.sty β†’ zip_proj/")
698
+ except Exception as e:
699
+ logs.append(f"⚠️ Copy sty failed: {e}")
700
  # Append overrides into theme file(s)
701
  for sty in work_zip_dir.rglob("beamerthemegemini.sty"):
702
  with open(sty, "a", encoding="utf-8") as fh: