Code

- fix mailgw list of methods -- use getattr so that a derived class will
[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 roundup.dist.command.install_lib import install_lib
27 from distutils.core import setup
29 import sys, os
30 from glob import glob
32 # patch distutils if it can't cope with the "classifiers" keyword
33 from distutils.dist import DistributionMetadata
34 if not hasattr(DistributionMetadata, 'classifiers'):
35     DistributionMetadata.classifiers = None
36     DistributionMetadata.download_url = None
38 def include(d, e):
39     """Generate a pair of (directory, file-list) for installation.
41     'd' -- A directory
43     'e' -- A glob pattern"""
45     return (d, [f for f in glob('%s/%s'%(d, e)) if os.path.isfile(f)])
47 def scriptname(path):
48     """ Helper for building a list of script names from a list of
49         module files.
50     """
51     script = os.path.splitext(os.path.basename(path))[0]
52     script = script.replace('_', '-')
53     return script
55 def main():
56     # template munching
57     packages = [
58         'roundup',
59         'roundup.anypy',
60         'roundup.cgi',
61         'roundup.cgi.PageTemplates',
62         'roundup.cgi.TAL',
63         'roundup.cgi.ZTUtils',
64         'roundup.backends',
65         'roundup.scripts',
66     ]
67     py_modules = ['roundup.demo',]
69     # build list of scripts from their implementation modules
70     scripts = [scriptname(f) for f in glob('roundup/scripts/[!_]*.py')]
72     data_files = [
73         ('share/roundup/cgi-bin', ['frontends/roundup.cgi']),
74     ]
75     # install man pages on POSIX platforms
76     if os.name == 'posix':
77         data_files.append(include('share/man/man1', '*'))
79     # add the templates to the data files lists
80     from roundup.init import listTemplates
81     templates = [t['path']
82                  for t in listTemplates('share/roundup/templates').values()]
83     for tdir in templates:
84         for idir in '. detectors extensions html'.split():
85             data_files.append(include(os.path.join(tdir, idir), '*'))
87     # add message files
88     for (_dist_file, _mo_file) in list_message_files():
89         data_files.append((os.path.dirname(_mo_file),
90                            [os.path.join("build", _mo_file)]))
92     # add docs
93     data_files.append(include('share/doc/roundup/html', '*'))
95     # perform the setup action
96     from roundup import __version__
98     # long_description may not contain non-ascii characters. Distutils
99     # will produce an non-installable installer on linux *and* we can't
100     # run the bdist_wininst on Linux if there are non-ascii characters
101     # because the distutils installer will try to use the mbcs codec
102     # which isn't available on non-windows platforms. See also
103     # http://bugs.python.org/issue10945
104     long_description=open('doc/announcement.txt').read().decode('utf8')
105     try:
106         long_description = long_description.encode('ascii')
107     except UnicodeEncodeError, cause:
108         print >> sys.stderr, "doc/announcement.txt contains non-ascii: %s" \
109             % cause
110         sys.exit(42)
112     setup(name='roundup',
113           version=__version__,
114           author="Richard Jones",
115           author_email="richard@users.sourceforge.net",
116           description="A simple-to-use and -install issue-tracking system"
117             " with command-line, web and e-mail interfaces. Highly"
118             " customisable.",
119           long_description=long_description,
120           url='http://www.roundup-tracker.org',
121           download_url='http://pypi.python.org/pypi/roundup',
122           classifiers=['Development Status :: 5 - Production/Stable',
123                        'Environment :: Console',
124                        'Environment :: Web Environment',
125                        'Intended Audience :: End Users/Desktop',
126                        'Intended Audience :: Developers',
127                        'Intended Audience :: System Administrators',
128                        'License :: OSI Approved :: Python Software Foundation License',
129                        'Operating System :: MacOS :: MacOS X',
130                        'Operating System :: Microsoft :: Windows',
131                        'Operating System :: POSIX',
132                        'Programming Language :: Python',
133                        'Topic :: Communications :: Email',
134                        'Topic :: Office/Business',
135                        'Topic :: Software Development :: Bug Tracking',
136                        ],
138           # Override certain command classes with our own ones
139           cmdclass= {'build_doc': build_doc,
140                      'build_scripts': build_scripts,
141                      'build_py': build_py,
142                      'build': build,
143                      'bdist_rpm': bdist_rpm,
144                      'install_lib': install_lib,
145                      },
146           packages=packages,
147           py_modules=py_modules,
148           scripts=scripts,
149           data_files=data_files)
151 if __name__ == '__main__':
152     main()
154 # vim: set filetype=python sts=4 sw=4 et si :