2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-12-25 02:35:04 +01:00
waf/docs/book/semd_wrapper.py
2015-04-26 20:36:48 +02:00

36 lines
765 B
Python
Executable File

#! /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)