25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

build.py 532 B

123456789101112131415161718192021
  1. from path import Path
  2. import sys
  3. import subprocess
  4. def main():
  5. template = Path("build.in.ninja").text()
  6. to_write = template
  7. for md_file in Path(".").files("*.md"):
  8. to_write += f"build {md_file.with_suffix('.pdf')}: pandoc ../{md_file}\n"
  9. build_path = Path("build")
  10. build_path.mkdir_p()
  11. out = build_path / "build.ninja"
  12. out.write_text(to_write)
  13. process = subprocess.run(["ninja", "-C", build_path])
  14. if process.returncode != 0:
  15. sys.exit(1)
  16. if __name__ == "__main__":
  17. main()