diff options
author | Greg Ward <gward@python.net> | 2000-07-05 03:08:55 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 2000-07-05 03:08:55 (GMT) |
commit | fd9f168bcfea84b39f6bea55f7b57c1a62c162fe (patch) | |
tree | 4eab9c5077a6a2846afd8d69d79b0aa482a86aed | |
parent | c4eb84accb1ac1e09ea78bc3af81acdbe9499fb8 (diff) | |
download | cpython-fd9f168bcfea84b39f6bea55f7b57c1a62c162fe.zip cpython-fd9f168bcfea84b39f6bea55f7b57c1a62c162fe.tar.gz cpython-fd9f168bcfea84b39f6bea55f7b57c1a62c162fe.tar.bz2 |
Fixed so the ZIP file (which is bundled into an executable) goes in the
temporary directory ('bdist_base').
Added --dist-dir option to control where the executable is put.
-rw-r--r-- | Lib/distutils/command/bdist_wininst.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Lib/distutils/command/bdist_wininst.py b/Lib/distutils/command/bdist_wininst.py index b81c4d4..0c53bf9 100644 --- a/Lib/distutils/command/bdist_wininst.py +++ b/Lib/distutils/command/bdist_wininst.py @@ -28,6 +28,8 @@ class bdist_wininst (Command): ('target-version=', 'v', "require a specific python version" + " on the target system (1.5 or 1.6/2.0)"), + ('dist-dir=', 'd', + "directory to put final built distributions in"), ] def initialize_options (self): @@ -36,6 +38,7 @@ class bdist_wininst (Command): self.target_compile = 0 self.target_optimize = 0 self.target_version = None + self.dist_dir = None # initialize_options() @@ -57,6 +60,8 @@ class bdist_wininst (Command): short_version) self.target_version = short_version + self.set_undefined_options('bdist', ('dist_dir', 'dist_dir')) + # finalize_options() @@ -92,7 +97,10 @@ class bdist_wininst (Command): # And make an archive relative to the root of the # pseudo-installation tree. - archive_basename = "%s.win32" % self.distribution.get_fullname() + fullname = self.distribution.get_fullname() + archive_basename = os.path.join(self.bdist_dir, + "%s.win32" % fullname) + # XXX hack! Our archive MUST be relative to sys.prefix # XXX What about .install_data, .install_scripts, ...? # [Perhaps require that all installation dirs be under sys.prefix @@ -103,7 +111,7 @@ class bdist_wininst (Command): root_dir = install.install_lib arcname = self.make_archive (archive_basename, "zip", root_dir=root_dir) - self.create_exe (arcname) + self.create_exe (arcname, fullname) if not self.keep_tree: remove_tree (self.bdist_dir, self.verbose, self.dry_run) @@ -156,7 +164,7 @@ class bdist_wininst (Command): # create_inifile() - def create_exe (self, arcname): + def create_exe (self, arcname, fullname): import struct, zlib cfgdata = open (self.create_inifile()).read() @@ -165,7 +173,8 @@ class bdist_wininst (Command): co = zlib.compressobj (zlib.Z_DEFAULT_COMPRESSION, comp_method, -15) zcfgdata = co.compress (cfgdata) + co.flush() - installer_name = "%s.win32.exe" % self.distribution.get_fullname() + installer_name = os.path.join(self.dist_dir, + "%s.win32.exe" % fullname) self.announce ("creating %s" % installer_name) file = open (installer_name, "wb") |