Code

3426b80d1671d0098c609a58e5c4fb5091e3741a
[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"""
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     # template munching
56     packages = [
57         'roundup',
58         'roundup.anypy',
59         'roundup.cgi',
60         'roundup.cgi.PageTemplates',
61         'roundup.cgi.TAL',
62         'roundup.cgi.ZTUtils',
63         'roundup.backends',
64         'roundup.scripts',
65     ]
66     py_modules = ['roundup.demo',]
68     # build list of scripts from their implementation modules
69     scripts = [scriptname(f) for f in glob('roundup/scripts/[!_]*.py')]
71     data_files = [
72         ('share/roundup/cgi-bin', ['frontends/roundup.cgi']),
73     ]
74     # install man pages on POSIX platforms
75     if os.name == 'posix':
76         data_files.append(include('share/man/man1', '*'))
78     # add the templates to the data files lists
79     from roundup.init import listTemplates
80     templates = [t['path']
81                  for t in listTemplates('share/roundup/templates').values()]
82     for tdir in templates:
83         for idir in '. detectors extensions html'.split():
84             data_files.append(include(os.path.join(tdir, idir), '*'))
86     # add message files
87     for (_dist_file, _mo_file) in list_message_files():
88         data_files.append((os.path.dirname(_mo_file),
89                            [os.path.join("build", _mo_file)]))
91     # add docs
92     data_files.append(include('share/doc/roundup/html', '*'))
94     # perform the setup action
95     from roundup import __version__
97     long_description=open('doc/announcement.txt').read().decode('utf8')
98     try:
99         long_description.encode('ascii')
100     except UnicodeEncodeError, cause:
101         print >> sys.stderr, "doc/announcement.txt contains non-ascii: %s" \
102             % cause
103         sys.exit(42)
105     setup(name='roundup',
106           version=__version__,
107           author="Richard Jones",
108           author_email="richard@users.sourceforge.net",
109           description="A simple-to-use and -install issue-tracking system"
110             " with command-line, web and e-mail interfaces. Highly"
111             " customisable.",
112           long_description=long_description,
113           url='http://www.roundup-tracker.org',
114           download_url='http://pypi.python.org/pypi/roundup',
115           classifiers=['Development Status :: 5 - Production/Stable',
116                        'Environment :: Console',
117                        'Environment :: Web Environment',
118                        'Intended Audience :: End Users/Desktop',
119                        'Intended Audience :: Developers',
120                        'Intended Audience :: System Administrators',
121                        'License :: OSI Approved :: Python Software Foundation License',
122                        'Operating System :: MacOS :: MacOS X',
123                        'Operating System :: Microsoft :: Windows',
124                        'Operating System :: POSIX',
125                        'Programming Language :: Python',
126                        'Topic :: Communications :: Email',
127                        'Topic :: Office/Business',
128                        'Topic :: Software Development :: Bug Tracking',
129                        ],
131           # Override certain command classes with our own ones
132           cmdclass= {'build_doc': build_doc,
133                      'build_scripts': build_scripts,
134                      'build_py': build_py,
135                      'build': build,
136                      'bdist_rpm': bdist_rpm,
137                      },
138           packages=packages,
139           py_modules=py_modules,
140           scripts=scripts,
141           data_files=data_files)
143 if __name__ == '__main__':
144     main()
146 # vim: set filetype=python sts=4 sw=4 et si :