#!/usr/bin/env python import os import os.path import sys from glob import glob from distutils.core import setup from distutils.command.install import install import trac PACKAGE = 'Trac' VERSION = str(trac.__version__) URL = trac.__url__ LICENSE = trac.__license__ def _p(unix_path): return os.path.normpath(unix_path) class my_install (install): def run (self): self.siteconfig() def siteconfig(self): templates_dir = os.path.join(self.prefix, 'share','trac','templates') htdocs_dir = os.path.join(self.prefix, 'share','trac','htdocs') wiki_dir = os.path.join(self.prefix, 'share','trac','wiki-default') f = open(_p('trac/siteconfig.py'),'w') f.write(""" # PLEASE DO NOT EDIT THIS FILE! # This file was autogenerated when installing %(trac)s %(ver)s. # __default_templates_dir__ = '%(templates)s' __default_htdocs_dir__ = '%(htdocs)s' __default_wiki_dir__ = '%(wiki)s' """ % {'trac':PACKAGE, 'ver':VERSION, 'templates':_p(templates_dir), 'htdocs':_p(htdocs_dir), 'wiki':_p(wiki_dir)}) f.close() # Run actual install install.run(self) print print "Thank you for choosing Trac %s. Enjoy your stay!" % VERSION print trac.__credits__ setup(name="trac", description="Trac - Wiki-based issue tracker and project environment", version=VERSION, author="Edgewall Software", author_email="info@edgewall.com", license=LICENSE, url=URL, packages=['trac'], data_files=[(_p('share/trac/templates'), glob('templates/*')), (_p('share/trac/htdocs'), glob(_p('htdocs/*.*')) + [_p('htdocs/README')]), (_p('share/trac/htdocs/css'), glob(_p('htdocs/css/*'))), (_p('share/trac/wiki-default'), glob(_p('wiki-default/*')))], scripts=[_p('scripts/trac-admin')], cmdclass = {'install': my_install})