2
# -*- coding: iso-8859-1 -*-
6
@copyright: 2001-2005 by J�rgen Hermann <jh@web.de>,
7
2006-2007 by MoinMoin:ThomasWaldmann
8
@license: GNU GPL, see COPYING for details.
14
from distutils.core import setup
15
from distutils.command.build_scripts import build_scripts
17
from MoinMoin.version import release, revision
20
#############################################################################
22
#############################################################################
25
""" Whether name should not be installed """
26
return (name.startswith('.') or
27
name.startswith('#') or
28
name.endswith('.pickle') or
32
""" Whether name should be installed """
33
return not isbad(name)
35
def makeDataFiles(prefix, dir):
36
""" Create distutils data_files structure from dir
38
distutil will copy all file rooted under dir into prefix, excluding
39
dir itself, just like 'ditto src dst' works, and unlike 'cp -r src
40
dst, which copy src into dst'.
43
# install the contents of 'wiki' under sys.prefix+'share/moin'
44
data_files = makeDataFiles('share/moin', 'wiki')
46
For this directory structure:
55
makeDataFiles('prefix', 'root') will create this distutil data_files structure:
56
[('prefix', ['file1', 'file2']),
57
('prefix/dir', ['file']),
58
('prefix/dir/subdir', ['file'])]
61
# Strip 'dir/' from of path before joining with prefix
65
os.path.walk(dir, visit, (prefix, strip, found))
68
def visit((prefix, strip, found), dirname, names):
69
""" Visit directory, create distutil tuple
71
Add distutil tuple for each directory using this format:
72
(destination, [dirname/file1, dirname/file2, ...])
74
distutil will copy later file1, file2, ... info destination.
77
# Iterate over a copy of names, modify names
79
path = os.path.join(dirname, name)
80
# Ignore directories - we will visit later
81
if os.path.isdir(path):
82
# Remove directories we don't want to visit later
88
destination = os.path.join(prefix, dirname[strip:])
89
found.append((destination, files))
91
def make_filelist(dir, strip_prefix=''):
92
""" package_data is pretty stupid: if the globs that can be given there
93
match a directory, then setup.py install will fall over that later,
94
because it expects only files.
95
Use make_filelist(dir, strip) to create a list of all FILES below dir,
96
stripping off the strip_prefix at the left side.
99
def _visit((found, strip), dirname, names):
102
path = os.path.join(dirname, name)
103
if os.path.isfile(path):
104
if path.startswith(strip):
105
path = path[len(strip):]
109
os.path.walk(dir, _visit, (found, strip_prefix))
112
#############################################################################
113
### Build script files
114
#############################################################################
116
class build_scripts_create(build_scripts):
117
""" Overload the build_scripts command and create the scripts
118
from scratch, depending on the target platform.
120
You have to define the name of your package in an inherited
121
class (due to the delayed instantiation of command classes
122
in distutils, this cannot be passed to __init__).
124
The scripts are created in an uniform scheme: they start the
125
run() function in the module
127
<packagename>.script.<mangled_scriptname>
129
The mangling of script names replaces '-' and '/' characters
130
with '-' and '.', so that they are valid module paths.
134
def copy_scripts(self):
135
""" Create each script listed in 'self.scripts'
137
if not self.package_name:
138
raise Exception("You have to inherit build_scripts_create and"
139
" provide a package name")
141
self.mkpath(self.build_dir)
142
for script in self.scripts:
143
outfile = os.path.join(self.build_dir, os.path.basename(script))
145
#if not self.force and not newer(script, outfile):
146
# self.announce("not copying %s (up-to-date)" % script)
150
self.announce("would create %s" % outfile)
153
module = os.path.splitext(os.path.basename(script))[0]
154
module = module.replace('-', '_').replace('/', '.')
156
'python': os.path.normpath(sys.executable),
157
'package': self.package_name,
159
'package_location': '/usr/lib/python/site-packages', # FIXME: we need to know the correct path
162
self.announce("creating %s" % outfile)
163
file = open(outfile, 'w')
166
if sys.platform == "win32":
167
file.write('@echo off\n'
168
'if NOT "%%_4ver%%" == "" %(python)s -c "from %(package)s.script.%(module)s import run; run()" %%$\n'
169
'if "%%_4ver%%" == "" %(python)s -c "from %(package)s.script.%(module)s import run; run()" %%*\n'
172
file.write("#! %(python)s\n"
174
"sys.path.insert(0, '/etc/moin')\n"
175
"from %(package)s.script.%(module)s import run\n"
180
os.chmod(outfile, 0755)
183
class build_scripts_moin(build_scripts_create):
184
package_name = 'MoinMoin'
187
def scriptname(path):
188
""" Helper for building a list of script names from a list of
191
script = os.path.splitext(os.path.basename(path))[0]
192
script = script.replace('_', '-')
193
if sys.platform == "win32":
194
script = script + ".bat"
197
# build list of scripts from their implementation modules
198
moin_scripts = [scriptname(fn) for fn in glob.glob('MoinMoin/script/[!_]*.py')]
201
#############################################################################
203
#############################################################################
208
'description': "MoinMoin %s is an easy to use, full-featured and extensible wiki software package" % (release, ),
209
'author': "Juergen Hermann et al.",
210
'author_email': "moin-user@lists.sourceforge.net",
211
# maintainer(_email) not active because distutils/register can't handle author and maintainer at once
212
'download_url': 'http://static.moinmo.in/files/moin-%s.tar.gz' % (release, ),
213
'url': "http://moinmo.in/",
214
'license': "GNU GPL",
215
'long_description': """
216
MoinMoin is an easy to use, full-featured and extensible wiki software
217
package written in Python. It can fulfill a wide range of roles, such as
218
a personal notes organizer deployed on a laptop or home web server,
219
a company knowledge base deployed on an intranet, or an Internet server
220
open to individuals sharing the same interests, goals or projects.""",
221
'classifiers': """Development Status :: 5 - Production/Stable
222
Environment :: No Input/Output (Daemon)
223
Environment :: Web Environment
224
Environment :: Win32 (MS Windows)
225
Intended Audience :: Customer Service
226
Intended Audience :: Developers
227
Intended Audience :: Education
228
Intended Audience :: End Users/Desktop
229
Intended Audience :: Financial and Insurance Industry
230
Intended Audience :: Healthcare Industry
231
Intended Audience :: Information Technology
232
Intended Audience :: Legal Industry
233
Intended Audience :: Manufacturing
234
Intended Audience :: Other Audience
235
Intended Audience :: Religion
236
Intended Audience :: Science/Research
237
Intended Audience :: System Administrators
238
Intended Audience :: Telecommunications Industry
239
License :: OSI Approved :: GNU General Public License (GPL)
240
Natural Language :: Chinese (Simplified)
241
Natural Language :: Chinese (Traditional)
242
Natural Language :: Danish
243
Natural Language :: Dutch
244
Natural Language :: English
245
Natural Language :: French
246
Natural Language :: German
247
Natural Language :: Hebrew
248
Natural Language :: Hungarian
249
Natural Language :: Italian
250
Natural Language :: Javanese
251
Natural Language :: Korean
252
Natural Language :: Norwegian
253
Natural Language :: Russian
254
Natural Language :: Serbian
255
Natural Language :: Spanish
256
Natural Language :: Vietnamese
257
Operating System :: MacOS :: MacOS X
258
Operating System :: Microsoft :: Windows
259
Operating System :: Microsoft :: Windows :: Windows 95/98/2000
260
Operating System :: Microsoft :: Windows :: Windows NT/2000
261
Operating System :: OS Independent
262
Operating System :: POSIX
263
Operating System :: POSIX :: BSD :: FreeBSD
264
Operating System :: POSIX :: Linux
265
Operating System :: Unix
266
Programming Language :: Python
267
Topic :: Communications :: Conferencing
268
Topic :: Internet :: WWW/HTTP :: Dynamic Content
269
Topic :: Office/Business :: Groupware
270
Topic :: Text Processing :: Markup""".splitlines(),
277
'MoinMoin.auth.openidrp_ext',
279
'MoinMoin.converter',
280
'MoinMoin.datastruct',
281
'MoinMoin.datastruct.backends',
284
'MoinMoin.formatter',
286
'MoinMoin.i18n.tools',
292
'MoinMoin.script.account',
293
'MoinMoin.script.cli',
294
'MoinMoin.script.export',
295
'MoinMoin.script.import',
296
'MoinMoin.script.index',
297
'MoinMoin.script.maint',
298
'MoinMoin.script.migration',
299
'MoinMoin.script.old',
300
'MoinMoin.script.old.migration',
301
'MoinMoin.script.old.xmlrpc-tools',
302
'MoinMoin.script.server',
303
'MoinMoin.script.xmlrpc',
305
'MoinMoin.search.Xapian',
306
'MoinMoin.search.queryparser',
310
## In Debian, below libraries are packaged separately
311
#'MoinMoin.support.flup',
312
#'MoinMoin.support.flup.client',
313
#'MoinMoin.support.flup.server',
314
#'MoinMoin.support.pygments',
315
#'MoinMoin.support.pygments.filters',
316
#'MoinMoin.support.pygments.formatters',
317
#'MoinMoin.support.pygments.lexers',
318
#'MoinMoin.support.pygments.styles',
319
#'MoinMoin.support.werkzeug',
320
#'MoinMoin.support.werkzeug.contrib',
321
#'MoinMoin.support.werkzeug.debug',
322
#'MoinMoin.support.xappy',
323
#'MoinMoin.support.parsedatetime',
326
'MoinMoin.userprefs',
329
'MoinMoin.web.static',
334
# all other _tests are missing here, either we have all or nothing:
338
'package_dir': {'MoinMoin.i18n': 'MoinMoin/i18n',
339
'MoinMoin.web.static': 'MoinMoin/web/static',
341
'package_data': {'MoinMoin.i18n': ['README', 'Makefile', 'MoinMoin.pot', 'POTFILES.in',
346
'MoinMoin.web.static': make_filelist('MoinMoin/web/static/htdocs',
347
strip_prefix='MoinMoin/web/static/'),
350
# Override certain command classes with our own ones
352
'build_scripts': build_scripts_moin,
355
'scripts': moin_scripts,
357
# This copies the contents of wiki dir under sys.prefix/share/moin
358
# Do not put files that should not be installed in the wiki dir, or
359
# clean the dir before you make the distribution tarball.
360
'data_files': makeDataFiles('share/moin', 'wiki')
363
if hasattr(distutils.dist.DistributionMetadata, 'get_keywords'):
364
setup_args['keywords'] = "wiki web"
366
if hasattr(distutils.dist.DistributionMetadata, 'get_platforms'):
367
setup_args['platforms'] = "any"
370
if __name__ == '__main__':
373
except distutils.errors.DistutilsPlatformError, ex:
380
"distutils" often needs developer support installed to work
381
correctly, which is usually located in a separate package
382
called "python%d.%d-dev(el)".
384
Please contact the system administrator to have it installed.
385
""" % sys.version_info[:2]