~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mfrom: (0.9.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080622211713-fpo2zrq3s5dfecxg
Tags: 1.7.0-3
Simplify /etc/moin/wikilist format: "USER URL" (drop unneeded middle
CONFIG_DIR that was wrongly advertised as DATA_DIR).  Make
moin-mass-migrate handle both formats and warn about deprecation of
the old one.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
"""
4
4
    MoinMoin installer
5
5
 
6
 
    @copyright: 2001-2005 by J�rgen Hermann <jh@web.de>
 
6
    @copyright: 2001-2005 by J�rgen Hermann <jh@web.de>,
 
7
                2006-2007 by MoinMoin:ThomasWaldmann
7
8
    @license: GNU GPL, see COPYING for details.
8
9
"""
9
10
 
10
 
import glob, os, string, sys
 
11
import os, sys, glob
11
12
 
12
13
import distutils
13
14
from distutils.core import setup
15
16
 
16
17
from MoinMoin.version import release, revision
17
18
 
 
19
# we need this for distutils from python 2.3 compatibility, python 2.4 has the
 
20
# 'package_data' keyword to the 'setup' function to install data in packages
 
21
# see http://wiki.python.org/moin/DistutilsInstallDataScattered
 
22
from distutils.command.install_data import install_data
 
23
class smart_install_data(install_data):
 
24
    def run(self):
 
25
        i18n_data_files = [(target, files) for (target, files) in self.data_files if target.startswith('MoinMoin/i18n')]
 
26
        share_data_files = [(target, files) for (target, files) in self.data_files if target.startswith('share/moin')]
 
27
        # first install the share/moin stuff:
 
28
        self.data_files = share_data_files
 
29
        install_data.run(self)
 
30
        # now we need to install the *.po files to the package dir:
 
31
        # need to change self.install_dir to the library dir
 
32
        install_cmd = self.get_finalized_command('install')
 
33
        self.install_dir = getattr(install_cmd, 'install_lib')
 
34
        self.data_files = i18n_data_files
 
35
        return install_data.run(self)
18
36
 
19
37
#############################################################################
20
38
### Helpers
61
79
    dir = dir.rstrip('/')
62
80
    strip = len(dir) + 1
63
81
    found = []
64
 
    os.path.walk(dir, visit, (prefix, strip, found)) 
 
82
    os.path.walk(dir, visit, (prefix, strip, found))
65
83
    return found
66
84
 
67
85
def visit((prefix, strip, found), dirname, names):
86
104
            files.append(path)
87
105
    destination = os.path.join(prefix, dirname[strip:])
88
106
    found.append((destination, files))
89
 
    
 
107
 
90
108
 
91
109
#############################################################################
92
110
### Build script files
106
124
            <packagename>.script.<mangled_scriptname>
107
125
 
108
126
        The mangling of script names replaces '-' and '/' characters
109
 
        with '-' and '.', so that they are valid module paths. 
 
127
        with '-' and '.', so that they are valid module paths.
110
128
    """
111
129
    package_name = None
112
130
 
116
134
        if not self.package_name:
117
135
            raise Exception("You have to inherit build_scripts_create and"
118
136
                " provide a package name")
119
 
        
120
 
        to_module = string.maketrans('-/', '_.')
121
137
 
122
138
        self.mkpath(self.build_dir)
123
139
        for script in self.scripts:
132
148
                continue
133
149
 
134
150
            module = os.path.splitext(os.path.basename(script))[0]
135
 
            module = string.translate(module, to_module)
 
151
            module = module.replace('-', '_').replace('/', '.')
136
152
            script_vars = {
137
153
                'python': os.path.normpath(sys.executable),
138
154
                'package': self.package_name,
139
155
                'module': module,
 
156
                'package_location': '/usr/lib/python/site-packages', # FIXME: we need to know the correct path
140
157
            }
141
158
 
142
159
            self.announce("creating %s" % outfile)
149
166
                        'if     "%%_4ver%%" == "" %(python)s -c "from %(package)s.script.%(module)s import run; run()" %%*\n'
150
167
                        % script_vars)
151
168
                else:
152
 
                    file.write('#! %(python)s\n'
153
 
                        'from %(package)s.script.%(module)s import run\n'
154
 
                        'run()\n'
 
169
                    file.write("#! %(python)s\n"
 
170
                        "#Fix and uncomment those 2 lines if your moin command doesn't find the MoinMoin package:\n"
 
171
                        "#import sys\n"
 
172
                        "#sys.path.insert(0, '%(package_location)s')\n"
 
173
                        "from %(package)s.script.%(module)s import run\n"
 
174
                        "run()\n"
155
175
                        % script_vars)
156
176
            finally:
157
177
                file.close()
167
187
        module files.
168
188
    """
169
189
    script = os.path.splitext(os.path.basename(path))[0]
170
 
    script = string.replace(script, '_', '-')
 
190
    script = script.replace('_', '-')
171
191
    if sys.platform == "win32":
172
192
        script = script + ".bat"
173
193
    return script
174
194
 
175
195
# build list of scripts from their implementation modules
176
 
moin_scripts = map(scriptname, glob.glob('MoinMoin/script/[!_]*.py'))
 
196
moin_scripts = [scriptname(fn) for fn in glob.glob('MoinMoin/script/[!_]*.py')]
177
197
 
178
198
 
179
199
#############################################################################
183
203
setup_args = {
184
204
    'name': "moin",
185
205
    'version': release,
186
 
    'description': "MoinMoin %s.%s is a Python clone of WikiWiki" % (release, revision),
187
 
    'author': "J�rgen Hermann",
188
 
    'author_email': "jh@web.de",
189
 
    'url': "http://moinmoin.wikiwikiweb.de/",
 
206
    'description': "MoinMoin %s is an easy to use, full-featured and extensible wiki software package" % (release, ),
 
207
    'author': "Juergen Hermann et al.",
 
208
    'author_email': "moin-user@lists.sourceforge.net",
 
209
    # maintainer(_email) not active because distutils/register can't handle author and maintainer at once
 
210
    'download_url': 'http://static.moinmo.in/files/moin-%s.tar.gz' % (release, ),
 
211
    'url': "http://moinmo.in/",
190
212
    'license': "GNU GPL",
191
213
    'long_description': """
192
 
A WikiWikiWeb is a collaborative hypertext environment, with an
193
 
emphasis on easy access to and modification of information. MoinMoin
194
 
is a Python WikiClone that allows you to easily set up your own wiki,
195
 
only requiring a Python installation. 
196
 
""",
 
214
    MoinMoin is an easy to use, full-featured and extensible wiki software
 
215
    package written in Python. It can fulfill a wide range of roles, such as
 
216
    a personal notes organizer deployed on a laptop or home web server,
 
217
    a company knowledge base deployed on an intranet, or an Internet server
 
218
    open to individuals sharing the same interests, goals or projects.""",
 
219
    'classifiers': """Development Status :: 5 - Production/Stable
 
220
Environment :: No Input/Output (Daemon)
 
221
Environment :: Web Environment
 
222
Environment :: Win32 (MS Windows)
 
223
Intended Audience :: Customer Service
 
224
Intended Audience :: Developers
 
225
Intended Audience :: Education
 
226
Intended Audience :: End Users/Desktop
 
227
Intended Audience :: Financial and Insurance Industry
 
228
Intended Audience :: Healthcare Industry
 
229
Intended Audience :: Information Technology
 
230
Intended Audience :: Legal Industry
 
231
Intended Audience :: Manufacturing
 
232
Intended Audience :: Other Audience
 
233
Intended Audience :: Religion
 
234
Intended Audience :: Science/Research
 
235
Intended Audience :: System Administrators
 
236
Intended Audience :: Telecommunications Industry
 
237
License :: OSI Approved :: GNU General Public License (GPL)
 
238
Natural Language :: Chinese (Simplified)
 
239
Natural Language :: Chinese (Traditional)
 
240
Natural Language :: Danish
 
241
Natural Language :: Dutch
 
242
Natural Language :: English
 
243
Natural Language :: French
 
244
Natural Language :: German
 
245
Natural Language :: Hebrew
 
246
Natural Language :: Hungarian
 
247
Natural Language :: Italian
 
248
Natural Language :: Javanese
 
249
Natural Language :: Korean
 
250
Natural Language :: Norwegian
 
251
Natural Language :: Russian
 
252
Natural Language :: Serbian
 
253
Natural Language :: Spanish
 
254
Natural Language :: Vietnamese
 
255
Operating System :: MacOS :: MacOS X
 
256
Operating System :: Microsoft :: Windows
 
257
Operating System :: Microsoft :: Windows :: Windows 95/98/2000
 
258
Operating System :: Microsoft :: Windows :: Windows NT/2000
 
259
Operating System :: OS Independent
 
260
Operating System :: POSIX
 
261
Operating System :: POSIX :: BSD :: FreeBSD
 
262
Operating System :: POSIX :: Linux
 
263
Operating System :: Unix
 
264
Programming Language :: Python
 
265
Topic :: Communications :: Conferencing
 
266
Topic :: Internet :: WWW/HTTP :: Dynamic Content
 
267
Topic :: Office/Business :: Groupware
 
268
Topic :: Text Processing :: Markup""".splitlines(),
 
269
 
197
270
    'packages': [
 
271
        'jabberbot',
198
272
        'MoinMoin',
199
273
        'MoinMoin.action',
 
274
        'MoinMoin.auth',
 
275
        'MoinMoin.config',
200
276
        'MoinMoin.converter',
 
277
        'MoinMoin.events',
201
278
        'MoinMoin.filter',
202
279
        'MoinMoin.formatter',
203
280
        'MoinMoin.i18n',
 
281
        'MoinMoin.i18n.tools',
204
282
        'MoinMoin.logfile',
205
283
        'MoinMoin.macro',
 
284
        'MoinMoin.mail',
206
285
        'MoinMoin.parser',
207
 
        'MoinMoin.processor',
 
286
        'MoinMoin.request',
208
287
        'MoinMoin.script',
209
288
        'MoinMoin.script.account',
210
289
        'MoinMoin.script.cli',
211
290
        'MoinMoin.script.export',
212
291
        'MoinMoin.script.import',
 
292
        'MoinMoin.script.index',
213
293
        'MoinMoin.script.maint',
214
294
        'MoinMoin.script.migration',
215
 
        'MoinMoin.script.lupy',
216
295
        'MoinMoin.script.old',
217
296
        'MoinMoin.script.old.migration',
218
297
        'MoinMoin.script.old.xmlrpc-tools',
 
298
        'MoinMoin.script.server',
 
299
        'MoinMoin.script.xmlrpc',
 
300
        'MoinMoin.search',
 
301
        'MoinMoin.security',
219
302
        'MoinMoin.server',
220
303
        'MoinMoin.stats',
221
304
        'MoinMoin.support',
222
 
        'MoinMoin.support.lupy',
223
 
        'MoinMoin.support.lupy.index',
224
 
        'MoinMoin.support.lupy.search',
 
305
        'MoinMoin.support.xapwrap',
 
306
        'MoinMoin.support.parsedatetime',
225
307
        'MoinMoin.theme',
 
308
        'MoinMoin.userform',
 
309
        'MoinMoin.userprefs',
226
310
        'MoinMoin.util',
227
 
        'MoinMoin.webapi',
228
311
        'MoinMoin.widget',
229
312
        'MoinMoin.wikixml',
230
313
        'MoinMoin.xmlrpc',
231
314
 
232
 
        # if we get *massive* amounts of test, this should probably be left out
233
 
        'MoinMoin._tests',
 
315
        # all other _tests are missing here, either we have all or nothing:
 
316
        #'MoinMoin._tests',
234
317
    ],
235
318
 
 
319
    # We can use package_* instead of the smart_install_data hack when we
 
320
    # require Python 2.4.
 
321
    #'package_dir': { 'MoinMoin.i18n': 'MoinMoin/i18n', },
 
322
    #'package_data': { 'MoinMoin.i18n': ['README', 'Makefile', 'MoinMoin.pot', 'POTFILES.in',
 
323
    #                                    '*.po',
 
324
    #                                    'tools/*',], },
 
325
 
236
326
    # Override certain command classes with our own ones
237
327
    'cmdclass': {
238
328
        'build_scripts': build_scripts_moin,
 
329
        'install_data': smart_install_data, # hack needed for 2.3
239
330
    },
240
331
 
241
332
    'scripts': moin_scripts,
242
333
 
243
 
    # This copy the contents of wiki dir under sys.prefix/share/moin
 
334
    # This copies the contents of wiki dir under sys.prefix/share/moin
244
335
    # Do not put files that should not be installed in the wiki dir, or
245
336
    # clean the dir before you make the distribution tarball.
246
 
    'data_files': makeDataFiles('share/moin', 'wiki'),
 
337
    'data_files': makeDataFiles('share/moin', 'wiki') + makeDataFiles('MoinMoin/i18n', 'MoinMoin/i18n')
247
338
}
248
339
 
249
340
if hasattr(distutils.dist.DistributionMetadata, 'get_keywords'):
250
341
    setup_args['keywords'] = "wiki web"
251
342
 
252
343
if hasattr(distutils.dist.DistributionMetadata, 'get_platforms'):
253
 
    setup_args['platforms'] = "win32 posix"
 
344
    setup_args['platforms'] = "any"
254
345
 
255
346
 
256
347
try:
257
 
    apply(setup, (), setup_args)
 
348
    setup(**setup_args)
258
349
except distutils.errors.DistutilsPlatformError, ex:
259
350
    print
260
351
    print str(ex)
261
 
    
 
352
 
262
353
    print """
263
354
POSSIBLE CAUSE
264
355
 
265
356
"distutils" often needs developer support installed to work
266
 
correctly, which is usually located in a separate package 
 
357
correctly, which is usually located in a separate package
267
358
called "python%d.%d-dev(el)".
268
359
 
269
360
Please contact the system administrator to have it installed.