2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-11 12:49:06 +01:00
waf/docs/book/semd_wrapper.py

36 lines
765 B
Python
Raw Normal View History

2015-04-26 20:36:48 +02:00
#! /usr/bin/env python
# encoding: utf-8
#
# SEMANTIK_D="/home/user/waf/docs/book/semd_wrapper.py --gen" waf configure
import sys, os, shutil, subprocess
realgen = ''
width = ''
lst = sys.argv[1:]
while lst:
arg = lst.pop(0)
if arg.startswith('--width'):
width = arg
elif arg == '--gen':
realgen = True
elif arg.startswith('-o'):
outfile = lst.pop(0)
else:
infile = arg
obase, of = os.path.split(outfile)
base, f = os.path.split(infile)
intermediate = os.path.join(base, 'semd_cache', width.replace('--', '').replace('=', '') + '_' + of)
if realgen:
cmd = ['semantik-d'] + sys.argv[1:]
cmd.remove('--gen')
ret = subprocess.Popen(cmd).wait()
if ret:
sys.exit(ret)
shutil.copy(outfile, intermediate)
else:
shutil.copy(intermediate, outfile)