comparison setup.py @ 4584:0dbfbe73371d

remove setup.py hacks for py2.3 compatibility, 2.4 can solve it cleaner
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 15 Feb 2009 04:36:08 +0100
parents 436048b821a5
children e7f1cf9eeb96
comparison
equal deleted inserted replaced
4583:124c1919133d 4584:0dbfbe73371d
14 from distutils.core import setup 14 from distutils.core import setup
15 from distutils.command.build_scripts import build_scripts 15 from distutils.command.build_scripts import build_scripts
16 16
17 from MoinMoin.version import release, revision 17 from MoinMoin.version import release, revision
18 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)
36 19
37 ############################################################################# 20 #############################################################################
38 ### Helpers 21 ### Helpers
39 ############################################################################# 22 #############################################################################
40 23
325 308
326 # all other _tests are missing here, either we have all or nothing: 309 # all other _tests are missing here, either we have all or nothing:
327 #'MoinMoin._tests', 310 #'MoinMoin._tests',
328 ], 311 ],
329 312
330 # We can use package_* instead of the smart_install_data hack when we 313 'package_dir': {'MoinMoin.i18n': 'MoinMoin/i18n', },
331 # require Python 2.4. 314 'package_data': {'MoinMoin.i18n': ['README', 'Makefile', 'MoinMoin.pot', 'POTFILES.in',
332 #'package_dir': { 'MoinMoin.i18n': 'MoinMoin/i18n', }, 315 '*.po',
333 #'package_data': { 'MoinMoin.i18n': ['README', 'Makefile', 'MoinMoin.pot', 'POTFILES.in', 316 'tools/*',
334 # '*.po', 317 'jabberbot/*',
335 # 'tools/*',], }, 318 ], },
336 319
337 # Override certain command classes with our own ones 320 # Override certain command classes with our own ones
338 'cmdclass': { 321 'cmdclass': {
339 'build_scripts': build_scripts_moin, 322 'build_scripts': build_scripts_moin,
340 'install_data': smart_install_data, # hack needed for 2.3
341 }, 323 },
342 324
343 'scripts': moin_scripts, 325 'scripts': moin_scripts,
344 326
345 # This copies the contents of wiki dir under sys.prefix/share/moin 327 # This copies the contents of wiki dir under sys.prefix/share/moin
346 # Do not put files that should not be installed in the wiki dir, or 328 # Do not put files that should not be installed in the wiki dir, or
347 # clean the dir before you make the distribution tarball. 329 # clean the dir before you make the distribution tarball.
348 'data_files': makeDataFiles('share/moin', 'wiki') + makeDataFiles('MoinMoin/i18n', 'MoinMoin/i18n') 330 'data_files': makeDataFiles('share/moin', 'wiki')
349 } 331 }
350 332
351 if hasattr(distutils.dist.DistributionMetadata, 'get_keywords'): 333 if hasattr(distutils.dist.DistributionMetadata, 'get_keywords'):
352 setup_args['keywords'] = "wiki web" 334 setup_args['keywords'] = "wiki web"
353 335