]> git.saurik.com Git - wxWidgets.git/blob - wxPython/wxaddons/setup.py
optimized highlighting to reduce flicker
[wxWidgets.git] / wxPython / wxaddons / setup.py
1 import distutils.command.install_lib
2 import distutils.command.install_data
3 import distutils.command.install
4 import os, string
5 from distutils.core import setup
6 from user import home # this gives us the user's home dir on all platforms
7
8 class wxaddon_install_lib(distutils.command.install_lib.install_lib):
9 """need to change self.install_dir to the actual library dir"""
10 def run(self):
11 install_cmd = self.get_finalized_command('install')
12 self.install_dir = os.path.join(getattr(install_cmd, 'install_purelib'), "wxaddons")
13 return distutils.command.install_lib.install_lib.run(self)
14
15 class wxaddon_install_data(distutils.command.install_data.install_data):
16 def run(self):
17 self.install_dir = os.path.join(home, ".wxaddons_data", self.distribution.get_name())
18 if not os.path.exists(self.install_dir):
19 os.makedirs(self.install_dir)
20 return distutils.command.install_data.install_data.run(self)
21
22 class wxaddon_install(distutils.command.install.install):
23 def run(self):
24 result = distutils.command.install.install.run(self)
25
26 import wx
27 config = wx.Config("wxaddons-receipts")
28 config.SetPath(self.distribution.get_name())
29 config.Write("Version", str(self.distribution.get_version()))
30 config.Write("Summary", self.distribution.get_description())
31 config.Write("Home-page", self.distribution.get_url())
32
33 # NB: Although self.distribution has get_author() and get_author_email()
34 # methods, get_contact* returns either author or maintainer, and I think
35 # either is suitable for our purposes.
36 config.Write("Author", self.distribution.get_contact())
37 config.Write("Author-email", self.distribution.get_contact_email())
38 config.Write("License", self.distribution.get_license())
39
40 keywords = string.join( self.distribution.get_keywords(), ';')
41 if keywords:
42 config.Write('Keywords', keywords)
43
44 platforms = string.join( self.distribution.get_platforms(), ';')
45 if platforms:
46 config.Write('Platforms', platforms )
47
48 classifiers = string.join( self.distribution.get_classifiers(), ';')
49 if classifiers:
50 config.Write('Classifiers', classifiers )
51
52 return result
53
54 def wxaddon(**kwargs):
55 kwargs['cmdclass'] = {'install_lib' : wxaddon_install_lib,
56 'install' : wxaddon_install,
57 'install_data' : wxaddon_install_data }
58 setup(**kwargs)