2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-22 01:46:15 +01:00
This commit is contained in:
Thomas Nagy 2014-11-16 13:23:58 +01:00
parent c18f457215
commit 81cedd8774
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64

View File

@ -46,7 +46,10 @@ def ascii_doc_scan(self):
import re
def scansize(self):
name = 'image::%s\\{PIC\\}\\[.*,(width|height)=(\\d+)' % self.inputs[0].name[:-4]
base, _, ext = self.inputs[0].name.partition('.')
name = 'image::%s\\{PIC\\}\\[.*,(width|height)=(\\d+)' % base
re_src = re.compile(name)
lst = self.inputs[0].parent.get_src().ant_glob('*.txt')
for x in lst:
@ -60,7 +63,6 @@ def scansize(self):
w = "800"
h = val
ext = self.inputs[0].name[-3:]
if ext == 'eps':
code = '-geometry %sx%s' % (w, h)
elif ext == 'dia':
@ -69,6 +71,11 @@ def scansize(self):
else:
w = ''
code = '--size %sx%s' % (w, h)
elif ext == 'semd':
if m.group(1) == 'width':
code = '--width=%s' % w
else:
code = '--height=%s' % h
else:
code = '-Gsize="%s,%s"' % (w, h)
break
@ -87,6 +94,7 @@ def configure(conf):
conf.find_program('convert', var='CONVERT')
conf.find_program('source-highlight', var='SOURCE_HIGHLIGHT')
conf.find_program('dot')
conf.find_program('semantik-d')
def build(bld):
@ -101,10 +109,15 @@ def build(bld):
tg = bld(rule='${DOT} -Tpng -o${TGT} ${SRC}', source=x, target=x.change_ext('.png'), scan=scansize)
#tg = bld(rule='${CONVERT} ${bld.raw_deps[tsk.uid()]} ${SRC} ${TGT}', source=x.change_ext('.eps'), target=x.change_ext('.png'), scan=scansize)
for x in bld.path.ant_glob('*.dia'):
tg = bld(rule='${DIA} -t eps ${SRC} -e ${TGT}', source=x, target=x.change_ext('.eps'))
tg = bld(rule='${DIA} -t png ${SRC} -e ${TGT}', source=x, target=x.change_ext('.png'), scan=scansize)
#bld(rule='${CONVERT} ${bld.raw_deps[tsk.uid()]} ${SRC} ${TGT}', source=tg.target, target=tg.target.change_ext('.png'), scan=scansize)
#for x in bld.path.ant_glob('*.dia'):
# tg = bld(rule='${DIA} -t eps ${SRC} -e ${TGT}', source=x, target=x.change_ext('.eps'))
# tg = bld(rule='${DIA} -t png ${SRC} -e ${TGT}', source=x, target=x.change_ext('.png'), scan=scansize)
# #bld(rule='${CONVERT} ${bld.raw_deps[tsk.uid()]} ${SRC} ${TGT}', source=tg.target, target=tg.target.change_ext('.png'), scan=scansize)
for x in bld.path.ant_glob('*.semd'):
bld(rule='${SEMANTIK_D} ${SRC[0].abspath()} -o ${TGT[0].abspath()}', source=x, target=x.change_ext('.svg'))
bld(rule='${SEMANTIK_D} ${SRC[0].abspath()} -o ${TGT[0].abspath()}', source=x, target=x.change_ext('.pdf'))
bld(rule='${SEMANTIK_D} ${bld.raw_deps[tsk.uid()]} ${SRC[0].abspath()} -o ${TGT[0].abspath()}', source=x, target=x.change_ext('.png'), scan=scansize)
for x in bld.path.ant_glob('pics/*.png'):
bld(features='subst', source=x, target=x.name, is_copy=True)