[Distutils] bdist_wininst: data and scripts
Thomas Heller
thomas.heller@ion-tof.com
Tue Sep 19 07:16:01 2000
I just check in the following patch for bdist_wininst:
(This should fix Bastian's complaints about not including
data and scripts into the windows installer)
Modified Files:
bdist_wininst.py
Log Message:
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.
Index: bdist_wininst.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/command/bdist_wininst.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** bdist_wininst.py 2000/09/16 15:56:32 1.12
--- bdist_wininst.py 2000/09/19 11:10:23 1.13
***************
*** 75,78 ****
--- 75,89 ----
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')
***************
*** 100,111 ****
"%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
arcname = self.make_archive (archive_basename, "zip",
root_dir=root_dir)
--- 111,128 ----
"%s.win32" % fullname)
! # 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)
Thomas