From e09f63949dc67cc8d9d40bebc278a55ef6ac777c Mon Sep 17 00:00:00 2001 From: Thomas Heller Date: Mon, 19 Feb 2001 09:20:30 +0000 Subject: Enhancements to the bdist_wininst command: --bitmap command line option allows to use a different bitmap file instead of the build-in python powered logo. --title lets you specify the text to display on the background. The editbox in the first screen now longer is selected (highlighted), it had the WS_TABSTOP flag. This is the patch http://sourceforge.net/patch/?func=detailpatch&patch_id=103687&group_id=5470 with two changes: 1. No messagebox displayed when the compilation to .pyc or .pyo files failes, this will only confuse the user (and it will fail under certain cases, where sys.path contains garbage). 2. A debugging print statement was removed from bdist_wininst.py. --- Lib/distutils/command/bdist_wininst.py | 547 +++++++++++++++++---------------- 1 file changed, 282 insertions(+), 265 deletions(-) diff --git a/Lib/distutils/command/bdist_wininst.py b/Lib/distutils/command/bdist_wininst.py index b45089b..e3964b6 100644 --- a/Lib/distutils/command/bdist_wininst.py +++ b/Lib/distutils/command/bdist_wininst.py @@ -32,6 +32,10 @@ class bdist_wininst (Command): "on the target system"), ('dist-dir=', 'd', "directory to put final built distributions in"), + ('bitmap=', 'b', + "bitmap to use for the installer instead of python-powered logo"), + ('title=', 't', + "title to display on the installer background instead of default"), ] boolean_options = ['keep-temp'] @@ -43,6 +47,8 @@ class bdist_wininst (Command): self.no_target_optimize = 0 self.target_version = None self.dist_dir = None + self.bitmap = None + self.title = None # initialize_options() @@ -117,7 +123,7 @@ class bdist_wininst (Command): ("'%s' not included in install_lib" % key) arcname = self.make_archive(archive_basename, "zip", root_dir=root_dir) - self.create_exe(arcname, fullname) + self.create_exe(arcname, fullname, self.bitmap) if not self.keep_temp: remove_tree(self.bdist_dir, self.verbose, self.dry_run) @@ -156,7 +162,7 @@ class bdist_wininst (Command): if self.target_version: lines.append("target_version=%s" % self.target_version) - title = self.distribution.get_fullname() + title = self.title or self.distribution.get_fullname() lines.append("title=%s" % repr(title)[1:-1]) import time import distutils @@ -167,7 +173,7 @@ class bdist_wininst (Command): # get_inidata() - def create_exe (self, arcname, fullname): + def create_exe (self, arcname, fullname, bitmap=None): import struct self.mkpath(self.dist_dir) @@ -185,12 +191,23 @@ class bdist_wininst (Command): "%s.win32.exe" % fullname) self.announce("creating %s" % installer_name) + if bitmap: + bitmapdata = open(bitmap, "rb").read() + bitmaplen = len(bitmapdata) + else: + bitmaplen = 0 + file = open(installer_name, "wb") file.write(self.get_exe_bytes()) + if bitmap: + file.write(bitmapdata) + file.write(cfgdata) - header = struct.pack("