X-Git-Url: http://git.onelab.eu/?p=myslice.git;a=blobdiff_plain;f=setup.py;h=a63e0cc0b742f5003753e0b119a75887c9136f30;hp=e767a3db02a978823479400e6ff81f9b53b2e873;hb=89af8babd28a7da90ffe59be3ce7b7e812734cd0;hpb=4fbc399d29eb1a887a7cad3a560498b3435b53a8 diff --git a/setup.py b/setup.py index e767a3db..a63e0cc0 100644 --- a/setup.py +++ b/setup.py @@ -1,24 +1,59 @@ #!/usr/bin/python # -# Setup script for myslice +# Setup script for myslice+unfold # # Thierry Parmentelat # INRIA (c) 2013 import os.path +import shutil from glob import glob from distutils.core import setup -# we don't have a final list os let's keep it simple for now +# we don't have a final list so let's keep it simple for now packages= [ os.path.dirname(init) for init in (glob("*/__init__.py")+glob("*/*/__init__.py")) ] +# Avoid troubles : clean /usr/share/unfold/ +#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')) + setup(packages = packages, - scripts = [], + # xxx somehow this does not seem to show up in debian packaging + scripts = [ 'apache/unfold-init-ssl.sh' ], data_files = [ - ( 'all-static/js', glob ('all-static/js/*')), - ( 'all-static/css', glob ('all-static/css/*')), - ( 'all-static/img', glob ('all-static/img/*')), - ( 'all-templates', glob ('all-templates/*')), - ( 'all-static', ['apache/favicon.ico', ] ), - ( 'apache', [ 'apache/myslice.conf', 'apache/myslice.wsgi' ]), - ]) + ( '/usr/share/unfold/static/js', javascript('static/js')), + ( '/usr/share/unfold/static/css', stylesheets ('static/css')), + ( '/usr/share/unfold/static/img', images ('static/img')), +# for portal/ + ( '/usr/share/unfold/static/img/institutions', images ('static/img/institutions')), + ( '/usr/share/unfold/static/img/testbeds', images ('static/img/testbeds')), + ( '/usr/share/unfold/templates', glob ('templates/*')), + ( 'apache', [ 'apache/unfold.conf', 'apache/unfold-ssl.conf', 'apache/unfold.wsgi' ]), + ( '/etc/unfold/trusted_roots', []), + ( '/var/unfold', []), + ] + fonts_tuples )