--- /dev/null
+"""Dia2Png SCons Builder: Build a PNG file given a DIA file.
+
+Support the specification of a scalefactor in the DIA2PNGDPI Environment variable.
+
+"""
+
+import os
+import SCons.Builder
+
+def dia_getSize(env,source):
+ size = None
+ for line in popen(env['DIACOM']+" -e /proc/self/fd/1 -t eps "+source[0],"r"):
+ if line.startswith("%%BoundingBox:"):
+ size=map(int,line.split()[4:])
+ return size
+
+def dia2png_generator(source, target, env, for_signature):
+ if for_signature:
+ return "$DIACOM -t png -s $DIA2PNGDPI $TARGET $SOURCE"
+ size = dia_getSize(env,source)
+ if not size: return None;
+ size[0] = size[0]*72/int(env['DIA2PNGDPI'])
+ size[1] = size[1]*72/int(env['$DIA2PNGDPI'])
+ return env.Action("$DIACOM -t png -s %dx%d $TARGET $SOURCE" % size)
+
+Dia2Png = SCons.Builder.Builder(suffix = ".png",
+ src_suffix = ".dia",
+ generator = dia2png_generator,
+ single_source = 1)
+
+def generate(env):
+ env['BUILDERS']['Dia2Png'] = Dia2Png
+ env['DIACOM'] = "dia"
+ env['DIA2PNGDPI'] = 115
+
+def exists(env):
+ return 1
for img in image ] +
[ env.Command(stamp, source,
[ 'cd $TARGET.dir && $DOXYGENCOM',
- # 'cd $TARGET.dir/doc/html && (sed -ne \'1,/<table>/p\' <annotated.html && grep -F \'<tr>\' <annotated.html | sort -ft\'>\' -k4 && sed -ne \'/<\\/table>/,$$p\' <annotated.html) >annotated.html.new && mv annotated.html.new annotated.html',
"touch $TARGET" ],
source_scanner = SCons.Defaults.ObjSourceScan) ])
env.Clean(stamp, dir)
return objects
-def Doxygen(env, sources, testSources = None, image = []):
+def Doxygen(env, sources, testSources = None, target='doc', image = []):
if type(sources) == type(()):
testSources = sources[1]
sources = sources[0]
doc = env.Doxygen(
- target = 'doc',
+ target = target,
source = sources,
image = image)