Commit 93518e1e authored by Greg Ward's avatar Greg Ward

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.
parent 8efd9f49
...@@ -28,6 +28,8 @@ class bdist_wininst (Command): ...@@ -28,6 +28,8 @@ class bdist_wininst (Command):
('target-version=', 'v', ('target-version=', 'v',
"require a specific python version" + "require a specific python version" +
" on the target system (1.5 or 1.6/2.0)"), " 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): def initialize_options (self):
...@@ -36,6 +38,7 @@ class bdist_wininst (Command): ...@@ -36,6 +38,7 @@ class bdist_wininst (Command):
self.target_compile = 0 self.target_compile = 0
self.target_optimize = 0 self.target_optimize = 0
self.target_version = None self.target_version = None
self.dist_dir = None
# initialize_options() # initialize_options()
...@@ -57,6 +60,8 @@ class bdist_wininst (Command): ...@@ -57,6 +60,8 @@ class bdist_wininst (Command):
short_version) short_version)
self.target_version = short_version self.target_version = short_version
self.set_undefined_options('bdist', ('dist_dir', 'dist_dir'))
# finalize_options() # finalize_options()
...@@ -92,7 +97,10 @@ class bdist_wininst (Command): ...@@ -92,7 +97,10 @@ class bdist_wininst (Command):
# And make an archive relative to the root of the # And make an archive relative to the root of the
# pseudo-installation tree. # 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 hack! Our archive MUST be relative to sys.prefix
# XXX What about .install_data, .install_scripts, ...? # XXX What about .install_data, .install_scripts, ...?
# [Perhaps require that all installation dirs be under sys.prefix # [Perhaps require that all installation dirs be under sys.prefix
...@@ -103,7 +111,7 @@ class bdist_wininst (Command): ...@@ -103,7 +111,7 @@ class bdist_wininst (Command):
root_dir = install.install_lib root_dir = install.install_lib
arcname = self.make_archive (archive_basename, "zip", arcname = self.make_archive (archive_basename, "zip",
root_dir=root_dir) root_dir=root_dir)
self.create_exe (arcname) self.create_exe (arcname, fullname)
if not self.keep_tree: if not self.keep_tree:
remove_tree (self.bdist_dir, self.verbose, self.dry_run) remove_tree (self.bdist_dir, self.verbose, self.dry_run)
...@@ -156,7 +164,7 @@ class bdist_wininst (Command): ...@@ -156,7 +164,7 @@ class bdist_wininst (Command):
# create_inifile() # create_inifile()
def create_exe (self, arcname): def create_exe (self, arcname, fullname):
import struct, zlib import struct, zlib
cfgdata = open (self.create_inifile()).read() cfgdata = open (self.create_inifile()).read()
...@@ -165,7 +173,8 @@ class bdist_wininst (Command): ...@@ -165,7 +173,8 @@ class bdist_wininst (Command):
co = zlib.compressobj (zlib.Z_DEFAULT_COMPRESSION, comp_method, -15) co = zlib.compressobj (zlib.Z_DEFAULT_COMPRESSION, comp_method, -15)
zcfgdata = co.compress (cfgdata) + co.flush() 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) self.announce ("creating %s" % installer_name)
file = open (installer_name, "wb") file = open (installer_name, "wb")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment