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.
This commit is contained in:
Greg Ward 2000-07-05 03:08:55 +00:00
parent c4eb84accb
commit fd9f168bcf
1 changed files with 13 additions and 4 deletions

View File

@ -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")