]> git.saurik.com Git - wxWidgets.git/blob - wxPython/wxaddons/setup.py
Don't decref if the interpreter is not initialized, (eg. it's in its
[wxWidgets.git] / wxPython / wxaddons / setup.py
1 import distutils.command.install_lib
2 import distutils.command.install
3 import os
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
17 metadata_file = 'addon.info'
18 if os.path.exists(metadata_file):
19 import wx
20 import email
21 fields = email.message_from_string(open(metadata_file).read())
22 config = wx.Config("wxaddons-receipts")
23 config.SetPath(fields['name'])
24 for field in fields._headers:
25 config.Write(field[0], field[1])
26 return result
27
28 def wxaddon(**kwargs):
29 kwargs['cmdclass'] = {'install_lib' : wxaddon_install_lib,
30 'install' : wxaddon_install }
31 setup(**kwargs)