Code

fix missed hole in the CSV editing - could still view items in the generic index...
[roundup.git] / setup.py
1 #! /usr/bin/env python
2 #
3 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
4 # This module is free software, and you may redistribute it and/or modify
5 # under the same terms as Python, so long as this copyright message and
6 # disclaimer are retained in their original form.
7 #
8 # IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
9 # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
10 # OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
11 # POSSIBILITY OF SUCH DAMAGE.
12 #
13 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
15 # FOR A PARTICULAR PURPOSE.  THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
18 #
21 from roundup.dist.command.build_doc import build_doc
22 from roundup.dist.command.build_scripts import build_scripts
23 from roundup.dist.command.build_py import build_py
24 from roundup.dist.command.build import build, list_message_files
25 from roundup.dist.command.bdist_rpm import bdist_rpm
26 from distutils.core import setup
28 import sys, os
29 from glob import glob
31 # patch distutils if it can't cope with the "classifiers" keyword
32 from distutils.dist import DistributionMetadata
33 if not hasattr(DistributionMetadata, 'classifiers'):
34     DistributionMetadata.classifiers = None
35     DistributionMetadata.download_url = None
37 def include(d, e):
38     """Generate a pair of (directory, file-list) for installation.
40     'd' -- A directory
42     'e' -- A glob pattern"""
43     
44     return (d, [f for f in glob('%s/%s'%(d, e)) if os.path.isfile(f)])
46 def scriptname(path):
47     """ Helper for building a list of script names from a list of
48         module files.
49     """
50     script = os.path.splitext(os.path.basename(path))[0]
51     script = script.replace('_', '-')
52     return script
54 def main():
55     # build list of scripts from their implementation modules
56     roundup_scripts = map(scriptname, glob('roundup/scripts/[!_]*.py'))
58     # template munching
59     packagelist = [
60         'roundup',
61         'roundup.anypy',
62         'roundup.cgi',
63         'roundup.cgi.PageTemplates',
64         'roundup.cgi.TAL',
65         'roundup.cgi.ZTUtils',
66         'roundup.backends',
67         'roundup.scripts',
68     ]
69     installdatafiles = [
70         ('share/roundup/cgi-bin', ['frontends/roundup.cgi']),
71     ]
72     py_modules = ['roundup.demo',]
74     # install man pages on POSIX platforms
75     if os.name == 'posix':
76         installdatafiles.append(('man/man1', ['doc/roundup-admin.1',
77             'doc/roundup-mailgw.1', 'doc/roundup-server.1',
78             'doc/roundup-demo.1']))
80     # add the templates to the data files lists
81     from roundup.init import listTemplates
82     templates = [t['path'] for t in listTemplates(os.path.join('share','roundup','templates')).values()]
83     for tdir in templates:
84         # scan for data files
85         for idir in '. detectors extensions html'.split():
86             idir = os.path.join(tdir, idir)
87             if not os.path.isdir(idir):
88                 continue
89             tfiles = []
90             for f in os.listdir(idir):
91                 if f.startswith('.'):
92                     continue
93                 ifile = os.path.join(idir, f)
94                 if os.path.isfile(ifile):
95                     tfiles.append(ifile)
96             installdatafiles.append(
97                 (os.path.join('share', 'roundup', idir), tfiles)
98             )
100     # add message files
101     for (_dist_file, _mo_file) in list_message_files():
102         installdatafiles.append((os.path.dirname(_mo_file),
103             [os.path.join("build", _mo_file)]))
105     # add docs
106     installdatafiles.append(include(os.path.join('share', 'doc', 'roundup', 'html'), '*'))
108     # perform the setup action
109     from roundup import __version__
110     
111     setup(name='roundup',
112           version=__version__,
113           author="Richard Jones",
114           author_email="richard@users.sourceforge.net",
115           description='Issue-tracking System.',
116           long_description="""Roundup is a simple-to-use and -install issue-tracking system
117 with command-line, web and e-mail interfaces. Highly customisable.""",
118           url='http://www.roundup-tracker.org',
119           download_url='http://pypi.python.org/pypi/roundup',
120           classifiers=['Development Status :: 5 - Production/Stable',
121                        'Environment :: Console',
122                        'Environment :: Web Environment',
123                        'Intended Audience :: End Users/Desktop',
124                        'Intended Audience :: Developers',
125                        'Intended Audience :: System Administrators',
126                        'License :: OSI Approved :: Python Software Foundation License',
127                        'Operating System :: MacOS :: MacOS X',
128                        'Operating System :: Microsoft :: Windows',
129                        'Operating System :: POSIX',
130                        'Programming Language :: Python',
131                        'Topic :: Communications :: Email',
132                        'Topic :: Office/Business',
133                        'Topic :: Software Development :: Bug Tracking',
134                        ],
136           # Override certain command classes with our own ones
137           cmdclass= {'build_doc': build_doc,
138                      'build_scripts': build_scripts,
139                      'build_py': build_py,
140                      'build': build,
141                      'bdist_rpm': bdist_rpm,
142                      },
143           packages=packagelist,
144           py_modules=py_modules,
145           scripts=roundup_scripts,
146           data_files=installdatafiles)
148 if __name__ == '__main__':
149     main()
151 # vim: set filetype=python sts=4 sw=4 et si :