]> git.rkrishnan.org Git - tahoe-lafs/zfec.git/blob - zfec/setuptools-0.6c16dev3.egg/setuptools/command/bdist_wininst.py
e8521f834ca559de72e9e0b44880919c64e156ec
[tahoe-lafs/zfec.git] / zfec / setuptools-0.6c16dev3.egg / setuptools / command / bdist_wininst.py
1 from distutils.command.bdist_wininst import bdist_wininst as _bdist_wininst
2 import os, sys
3
4 class bdist_wininst(_bdist_wininst):
5     _good_upload = _bad_upload = None
6
7     def create_exe(self, arcname, fullname, bitmap=None):
8         _bdist_wininst.create_exe(self, arcname, fullname, bitmap)
9         installer_name = self.get_installer_filename(fullname) 
10         if self.target_version:
11             pyversion = self.target_version
12             # fix 2.5+ bdist_wininst ignoring --target-version spec
13             self._bad_upload = ('bdist_wininst', 'any', installer_name)
14         else:
15             pyversion = 'any'
16         self._good_upload = ('bdist_wininst', pyversion, installer_name)
17         
18     def _fix_upload_names(self):
19         good, bad = self._good_upload, self._bad_upload
20         dist_files = getattr(self.distribution, 'dist_files', [])
21         if bad in dist_files:
22             dist_files.remove(bad)
23         if good not in dist_files:
24             dist_files.append(good)
25
26     def reinitialize_command (self, command, reinit_subcommands=0):
27         cmd = self.distribution.reinitialize_command(
28             command, reinit_subcommands)
29         if command in ('install', 'install_lib'):
30             cmd.install_lib = None  # work around distutils bug
31         return cmd
32
33     def run(self):
34         self._is_running = True
35         try:
36             _bdist_wininst.run(self)
37             self._fix_upload_names()
38         finally:
39             self._is_running = False
40
41
42     if not hasattr(_bdist_wininst, 'get_installer_filename'):
43         def get_installer_filename(self, fullname):
44             # Factored out to allow overriding in subclasses
45             if self.target_version:
46                 # if we create an installer for a specific python version,
47                 # it's better to include this in the name
48                 installer_name = os.path.join(self.dist_dir,
49                                               "%s.win32-py%s.exe" %
50                                                (fullname, self.target_version))
51             else:
52                 installer_name = os.path.join(self.dist_dir,
53                                               "%s.win32.exe" % fullname)
54             return installer_name
55     # get_installer_filename()
56     
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82