diff options
author | Thomas Heller <theller@ctypes.org> | 2000-09-19 11:10:23 (GMT) |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2000-09-19 11:10:23 (GMT) |
commit | 543f2438ba8fb67dc779a3cc10d61e27aea00818 (patch) | |
tree | 7fa64861ab9f91aa609f5a3458dd1ab865a2a186 /Lib/distutils/command/bdist_wininst.py | |
parent | a05fa1d9d42cc1fcefa38ad893320d4d9e82bf61 (diff) | |
download | cpython-543f2438ba8fb67dc779a3cc10d61e27aea00818.zip cpython-543f2438ba8fb67dc779a3cc10d61e27aea00818.tar.gz cpython-543f2438ba8fb67dc779a3cc10d61e27aea00818.tar.bz2 |
Set the 'nt' installation scheme for the install command even if run
on other systems, so that data, headers, scripts are included in
the installer.
Diffstat (limited to 'Lib/distutils/command/bdist_wininst.py')
-rw-r--r-- | Lib/distutils/command/bdist_wininst.py | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/Lib/distutils/command/bdist_wininst.py b/Lib/distutils/command/bdist_wininst.py index 5030ef9..4637d45 100644 --- a/Lib/distutils/command/bdist_wininst.py +++ b/Lib/distutils/command/bdist_wininst.py @@ -74,6 +74,17 @@ class bdist_wininst (Command): install = self.reinitialize_command('install') install.root = self.bdist_dir + if os.name != 'nt': + # must force install to use the 'nt' scheme + install.select_scheme ('nt') + # change the backslash to the current pathname separator + for key in ('purelib', 'platlib', 'headers', 'scripts', + 'data'): + attrname = 'install_' + key + attr = getattr (install, attrname) + if attr: + attr = string.replace (attr, '\\', os.sep) + setattr (install, attrname, attr) install_lib = self.reinitialize_command('install_lib') # we do not want to include pyc or pyo files @@ -99,14 +110,20 @@ class bdist_wininst (Command): 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 - # on Windows? this will be acceptable until we start dealing - # with Python applications, at which point we should zip up - # the application directory -- and again everything can be - # under one dir --GPW] - root_dir = install.install_lib + # Our archive MUST be relative to sys.prefix, which is the + # same as install_lib in the 'nt' scheme. + root_dir = os.path.normpath (install.install_lib) + + # Sanity check: Make sure everything is included + for key in ('purelib', 'platlib', 'headers', 'scripts', 'data'): + attrname = 'install_' + key + install_x = getattr (install, attrname) + # (Use normpath so that we can string.find to look for + # subdirectories) + install_x = os.path.normpath (install_x) + if string.find (install_x, root_dir) != 0: + raise DistutilsInternalError \ + ("'%s' not included in install_lib" % key) arcname = self.make_archive (archive_basename, "zip", root_dir=root_dir) self.create_exe (arcname, fullname) |