From 018cbb15c04aa544708430bb5b91aebe3e808923 Mon Sep 17 00:00:00 2001 From: Greg Ward Date: Sat, 26 Aug 2000 02:40:10 +0000 Subject: New release of the Windows installer from Thomas Heller. The known bug (bogus error message when an empty file is extracted) is fixed. Other changes: - The target-compile and target-optimize flags of bdist_wininst are gone. It is no longer possible to compile the python files during installation. - The zlib module is no longer required or used by bdist_wininst. - I moved the decompression/extraction code into a separate file (extract.c). - The installer stub is now compressed by UPX (see http://upx.tsx.org/). This reduces the size of the exe (and thus the overhead of the final installer program) from 40 kB to 16 kB. - The installer displays a more uptodate user wizard-like user interface, also containing a graphic: Just's Python Powered logo. (I could not convince myself to use one of the BeOpen logos). - The installation progress bar now moves correctly. --- Lib/distutils/command/bdist_wininst.py | 579 +++++++++++++++++---------------- 1 file changed, 296 insertions(+), 283 deletions(-) diff --git a/Lib/distutils/command/bdist_wininst.py b/Lib/distutils/command/bdist_wininst.py index 38e973b..9b600a9 100644 --- a/Lib/distutils/command/bdist_wininst.py +++ b/Lib/distutils/command/bdist_wininst.py @@ -22,13 +22,9 @@ class bdist_wininst (Command): ('keep-tree', 'k', "keep the pseudo-installation tree around after " + "creating the distribution archive"), - ('target-compile', 'c', - "compile to .pyc on the target system"), - ('target-optimize', 'o', - "compile to .pyo on the target system"), ('target-version=', 'v', "require a specific python version" + - " on the target system (1.5 or 1.6/2.0)"), + " on the target system"), ('dist-dir=', 'd', "directory to put final built distributions in"), ] @@ -74,22 +70,10 @@ class bdist_wininst (Command): install.root = self.bdist_dir install_lib = self.reinitialize_command('install_lib') + # we do not want to include pyc or pyo files install_lib.compile = 0 install_lib.optimize = 0 - # The packager can choose if .pyc and .pyo files should be created - # on the TARGET system instead at the SOURCE system. - -## # The compilation can only be done on the SOURCE system for one -## # python version (assuming 1.6/2.0 and 1.5 have incompatible -## # byte-codes). -## short_version = sys.version[:3] -## if self.target_version == short_version: -## if not self.target_compile: -## install_lib.compile = 1 -## if not self.target_optimize: -## install_lib.optimize = 1 - install_lib.ensure_finalized() self.announce ("installing to %s" % self.bdist_dir) @@ -137,7 +121,7 @@ class bdist_wininst (Command): # 'info' will be displayed in the installer's dialog box, # describing the items to be installed. - info = metadata.long_description + '\n' + info = metadata.long_description or '' + '\n' for name in dir (metadata): if (name != 'long_description'): @@ -152,11 +136,8 @@ class bdist_wininst (Command): inifile.write ("\n[Setup]\n") inifile.write ("info=%s\n" % repr (info)[1:-1]) inifile.write ("pthname=%s.%s\n" % (metadata.name, metadata.version)) - inifile.write ("pyc_compile=%d\n" % self.target_compile) - inifile.write ("pyo_compile=%d\n" % self.target_optimize) if self.target_version: - vers_minor = string.split (self.target_version, '.')[1] - inifile.write ("vers_minor=%s\n" % vers_minor) + inifile.write ("target_version=%s\n" % self.target_version) title = self.distribution.get_fullname() inifile.write ("title=%s\n" % repr (title)[1:-1]) @@ -166,285 +147,317 @@ class bdist_wininst (Command): # create_inifile() def create_exe (self, arcname, fullname): - import struct, zlib + import struct#, zlib cfgdata = open (self.create_inifile()).read() - comp_method = zlib.DEFLATED - co = zlib.compressobj (zlib.Z_DEFAULT_COMPRESSION, comp_method, -15) - zcfgdata = co.compress (cfgdata) + co.flush() - installer_name = os.path.join(self.dist_dir, "%s.win32.exe" % fullname) self.announce ("creating %s" % installer_name) file = open (installer_name, "wb") file.write (self.get_exe_bytes ()) - file.write (zcfgdata) - crc32 = zlib.crc32 (cfgdata) - header = struct.pack ("