]>
Commit | Line | Data |
---|---|---|
0f475e8a RD |
1 | import distutils.command.install_lib |
2 | import distutils.command.install | |
30bb87ad | 3 | import os, string |
0f475e8a RD |
4 | from distutils.core import setup |
5 | ||
6 | class wxaddon_install_lib(distutils.command.install_lib.install_lib): | |
7 | """need to change self.install_dir to the actual library dir""" | |
8 | def run(self): | |
9 | install_cmd = self.get_finalized_command('install') | |
10 | self.install_dir = os.path.join(getattr(install_cmd, 'install_purelib'), "wxaddons") | |
11 | return distutils.command.install_lib.install_lib.run(self) | |
12 | ||
13 | class wxaddon_install(distutils.command.install.install): | |
14 | def run(self): | |
15 | result = distutils.command.install.install.run(self) | |
16 | ||
30bb87ad VZ |
17 | import wx |
18 | config = wx.Config("wxaddons-receipts") | |
19 | config.SetPath(self.distribution.get_name()) | |
20 | config.Write("Version", str(self.distribution.get_version())) | |
21 | config.Write("Summary", self.distribution.get_description()) | |
22 | config.Write("Home-page", self.distribution.get_url()) | |
23 | ||
24 | # NB: Although self.distribution has get_author() and get_author_email() | |
25 | # methods, get_contact* returns either author or maintainer, and I think | |
26 | # either is suitable for our purposes. | |
27 | config.Write("Author", self.distribution.get_contact()) | |
28 | config.Write("Author-email", self.distribution.get_contact_email()) | |
29 | config.Write("License", self.distribution.get_license()) | |
30 | ||
31 | keywords = string.join( self.distribution.get_keywords(), ';') | |
32 | if keywords: | |
33 | config.Write('Keywords', keywords) | |
34 | ||
35 | platforms = string.join( self.distribution.get_platforms(), ';') | |
36 | if platforms: | |
37 | config.Write('Platforms', platforms ) | |
38 | ||
39 | classifiers = string.join( self.distribution.get_classifiers(), ';') | |
40 | if classifiers: | |
41 | config.Write('Classifiers', classifiers ) | |
42 | ||
0f475e8a RD |
43 | return result |
44 | ||
45 | def wxaddon(**kwargs): | |
46 | kwargs['cmdclass'] = {'install_lib' : wxaddon_install_lib, | |
47 | 'install' : wxaddon_install } | |
48 | setup(**kwargs) |