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