pymake

A build system based on Build Systems à la Carte
git clone https://git.grace.moe/pymake
Log | Files | Refs | README

tar2.py (703B)


      1 import asyncio
      2 import sys
      3 
      4 sys.path.append("..")
      5 from make3 import cache_conditionally, file_hash, open, rerun_if_changed, Rerunner
      6 import subprocess
      7 
      8 
      9 @cache_conditionally()
     10 async def tar(manifest=b"manifest", output=b"archive.tar.gz"):
     11     with open(manifest, "rb") as manifest_f:
     12         manifest_lines = manifest_f.read().splitlines()
     13         rerun_if_changed()(await file_hash(manifest_f))
     14         for fname in manifest_lines:
     15             rerun_if_changed()(await file_hash(fname))
     16 
     17         print("tar", "cvzf", output, *manifest_lines)
     18         subprocess.run([b"tar", b"cvzf", output, *manifest_lines])
     19         rerun_if_changed()(await file_hash(output))
     20 
     21 
     22 with Rerunner():
     23     asyncio.run(tar())