-import sys, os
def findsenf(sysdirs = ('/usr/local/lib/senf','/usr/lib/senf'),
subdirs = ('', 'senf', 'Senf', 'SENF')):
- from os.path import join, sep, exists, normpath
- from itertools import starmap, product, chain
+ import os, itertools
+
+ def ancestors(d):
+ p = d.split(os.path.sep)
+ return (os.path.join(p[0]+os.path.sep,*p[1:i]) for i in range(len(p),0,-1))
- def joinpaths(*p): return starmap(join, product(*p))
- def existing(l): return (e for e in l if exists(e))
- def ancestors(d): p = d.split(sep); return (join(p[0]+sep,*p[1:i]) for i in range(len(p),0,-1))
- def butfirst(l):
- i = iter(l); i.next()
- for e in i : yield e
+ for d in itertools.chain(ancestors(os.getcwd()),sysdirs):
+ for s in subdirs:
+ py = os.path.join(d,s,'site_scons/senfutil.py')
+ if os.path.exists(py) and not os.path.samefile(py,__file__): return py
- try: return normpath(existing(butfirst(joinpaths(
- chain(ancestors(os.getcwd()),sysdirs),
- subdirs,('site_scons/senfutil.py',)))).next())
- except StopIteration: raise ImportError, 'senfutil not found'
+ raise ImportError, 'senfutil not found'
-__file__ = findsenf(); del findsenf
+# replace module with real senfutil
+import sys, os
+__file__ = findsenf()
sys.path.append(os.path.dirname(__file__))
+del sys, os, findsenf
execfile(__file__, locals(), globals())
#!/usr/bin/perl -i -n
# Reduce fontsize and change font
-s/fontsize=10/fontsize=8/g;
+s/fontsize=10/fontsize=8/g;
s/fontname="FreeSans.ttf"/fontname="Verdana"/g;
# Wrap long labels (templates and pathnames)
-if (/label=\"([^"]{48,})\"/) { #"])){ # To make emacs happy ...
- $pre=$`;
+if (/label=\"([^"]{24,})\"/) { #"])){ # To make emacs happy ...
+ $pre=$`;
$post=$'; #'; # To make emacs happy ...
$label=$1;
# Break at each komma or /
- $label=~s{[,/]}{$&\\r\\ \\ \\ \\ \\ \\ \\ \\ }g;
+ $label=~s{[,/]}{$&\\r\\ \\ \\ \\ \\ \\ \\ \\ }g;
# If more than one '<' is in the label, break after each '<'
- if (($label=~tr/</</)>1) {
+ if (($label=~tr/</</)>1) {
$label=~s/</<\\r\\ \\ \\ \\ \\ \\ \\ \\ /g;
}
$label.="\\r";
}
print "${pre}label=\"${label}\"${post}";
-} else {
+} else {
print;
}
#!/bin/sh -e
+print="-print"
cond=""
-if [ "$1" = "-c" ]; then
- shift
- cond='( -name *.h -o -name *.hh -o -name *.ih -o -name *.c -o -name *.cc -o -name *.cci -o -name *.ct -o -name *.cti -o -name *.mpp -o -name *.dox )'
-fi
+while true ; do
+ case "$1" in
+ -n) print=""; shift ;;
+ -c) cond='( -name *.h -o -name *.hh -o -name *.ih -o -name *.c -o -name *.cc -o -name *.cci -o -name *.ct -o -name *.cti -o -name *.mpp -o -name *.dox )'; shift ;;
+ *) break ;;
+ esac
+done
set -f
-name ".sconsign*" -o \
-name "semantic.cache" -o \
-name "all_includes.hh" -o \
- -type f $cond \( "$@" -print \)
+ -type f $cond \( "$@" $print \)