tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

gen-ragel-artifacts.py (700B)


      1 #!/usr/bin/env python3
      2 
      3 "This tool is intended to be used from meson"
      4 
      5 import os, os.path, sys, subprocess, shutil
      6 
      7 ragel = sys.argv[1]
      8 if not ragel:
      9 sys.exit ('You have to install ragel if you are going to develop HarfBuzz itself')
     10 
     11 if len (sys.argv) < 4:
     12 sys.exit (__doc__)
     13 
     14 OUTPUT = sys.argv[2]
     15 CURRENT_SOURCE_DIR = sys.argv[3]
     16 INPUT = sys.argv[4]
     17 
     18 outdir = os.path.dirname (OUTPUT)
     19 shutil.copy (INPUT, outdir)
     20 rl = os.path.basename (INPUT)
     21 hh = rl.replace ('.rl', '.hh')
     22 ret = subprocess.Popen (ragel.split() + ['-e', '-F1', '-o', hh, rl], cwd=outdir).wait ()
     23 if ret:
     24    sys.exit (ret)
     25 
     26 # copy it also to src/
     27 shutil.copyfile (os.path.join (outdir, hh), os.path.join (CURRENT_SOURCE_DIR, hh))