[Python-checkins] r53319 - in sandbox/branches/setuptools-0.6: setuptools.txt setuptools/command/bdist_wininst.py

phillip.eby python-checkins at python.org
Tue Jan 9 20:28:06 CET 2007


Author: phillip.eby
Date: Tue Jan  9 20:28:05 2007
New Revision: 53319

Modified:
   sandbox/branches/setuptools-0.6/setuptools.txt
   sandbox/branches/setuptools-0.6/setuptools/command/bdist_wininst.py
Log:
Fix uploaded ``bdist_wininst`` packages being described as suitable for
"any" version by Python 2.5, even if a ``--target-version`` was 
specified.  (backport from trunk)


Modified: sandbox/branches/setuptools-0.6/setuptools.txt
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools.txt	(original)
+++ sandbox/branches/setuptools-0.6/setuptools.txt	Tue Jan  9 20:28:05 2007
@@ -2604,8 +2604,10 @@
  * Fix uploaded ``bdist_rpm`` packages being described as ``bdist_egg``
    packages under Python versions less than 2.5.
 
-0.6c4
+ * Fix uploaded ``bdist_wininst`` packages being described as suitable for
+   "any" version by Python 2.5, even if a ``--target-version`` was specified.
 
+0.6c4
  * Overhauled Windows script wrapping to support ``bdist_wininst`` better.
    Scripts installed with ``bdist_wininst`` will always use ``#!python.exe`` or
    ``#!pythonw.exe`` as the executable name (even when built on non-Windows

Modified: sandbox/branches/setuptools-0.6/setuptools/command/bdist_wininst.py
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools/command/bdist_wininst.py	(original)
+++ sandbox/branches/setuptools-0.6/setuptools/command/bdist_wininst.py	Tue Jan  9 20:28:05 2007
@@ -2,24 +2,27 @@
 import os, sys
 
 class bdist_wininst(_bdist_wininst):
-    if sys.version<'2.5':
-        def create_exe(self, arcname, fullname, bitmap=None):
 
-            _bdist_wininst.create_exe(self, arcname, fullname, bitmap)
+    def create_exe(self, arcname, fullname, bitmap=None):
+        _bdist_wininst.create_exe(self, arcname, fullname, bitmap)
+        dist_files = getattr(self.distribution, 'dist_files', [])
+
+        if self.target_version:
+            installer_name = os.path.join(self.dist_dir,
+                                          "%s.win32-py%s.exe" %
+                                           (fullname, self.target_version))
+            pyversion = self.target_version
+
+            # fix 2.5 bdist_wininst ignoring --target-version spec
+            bad = ('bdist_wininst','any',installer_name)
+            if bad in dist_files:
+                dist_files.remove(bad)
+        else:
+            installer_name = os.path.join(self.dist_dir,
+                                          "%s.win32.exe" % fullname)
+            pyversion = 'any'
 
-            if self.target_version:
-                installer_name = os.path.join(self.dist_dir,
-                                              "%s.win32-py%s.exe" %
-                                               (fullname, self.target_version))
-                pyversion = self.target_version
-            else:
-                installer_name = os.path.join(self.dist_dir,
-                                              "%s.win32.exe" % fullname)
-                pyversion = 'any'
-
-            getattr(self.distribution,'dist_files',[]).append(
-                ('bdist_wininst', pyversion, installer_name)
-            )
+        dist_files.append(('bdist_wininst', pyversion, installer_name))
 
     def reinitialize_command (self, command, reinit_subcommands=0):
         cmd = self.distribution.reinitialize_command(


More information about the Python-checkins mailing list