]> git.saurik.com Git - wxWidgets.git/blame - wxPython/wxaddons/setup.py
declare GetGDKWindow() in wxDC to fix compilation of wxRendererNative
[wxWidgets.git] / wxPython / wxaddons / setup.py
CommitLineData
0f475e8a 1import distutils.command.install_lib
be52597c 2import distutils.command.install_data
0f475e8a 3import distutils.command.install
30bb87ad 4import os, string
0f475e8a 5from distutils.core import setup
be52597c 6from user import home # this gives us the user's home dir on all platforms
0f475e8a
RD
7
8class 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
be52597c
WS
15class 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
0f475e8a
RD
22class wxaddon_install(distutils.command.install.install):
23 def run(self):
24 result = distutils.command.install.install.run(self)
25
30bb87ad
VZ
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
0f475e8a
RD
52 return result
53
54def wxaddon(**kwargs):
55 kwargs['cmdclass'] = {'install_lib' : wxaddon_install_lib,
be52597c
WS
56 'install' : wxaddon_install,
57 'install_data' : wxaddon_install_data }
0f475e8a 58 setup(**kwargs)