+#shutil.rmtree('/usr/share/unfold/')
+
+def images (dir):
+ return glob( dir+"/*.png") + glob ( dir+"/*.gif")
+def javascript (dir):
+ return glob( dir+"/*.js")
+def stylesheets (dir):
+ return glob( dir+"/*.css")
+
+# looks like data_files requires actual files and cannot cope with
+# a whole subdir like we have for fonts
+# returns a list of tuples suitable to add to data_files
+from operator import add
+
+def scan_fonts (install_topdir, topdir, extensions):
+ def subdir_tuples (subdir, extensions):
+ return [ (install_topdir+subdir, glob (subdir+"/*.%s"%extension), )
+ for extension in extensions
+ if glob(subdir+"/*.%s"%extension)
+ ]
+ def subdirs (topdir):
+ return [x[0] for x in os.walk(topdir)]
+ return reduce (add, [ subdir_tuples (subdir, extensions) for subdir in subdirs(topdir) ] )
+
+fonts_tuples = scan_fonts ('/usr/share/unfold/static/fonts',
+ 'static/fonts',
+ ('otf','eot','svg','ttf','woff'))