Commit 7b7c594c authored by Jason R. Coombs's avatar Jason R. Coombs

Delint bdist_wininst

parent acad569c
import os
from distutils.command.bdist_wininst import bdist_wininst as _bdist_wininst from distutils.command.bdist_wininst import bdist_wininst as _bdist_wininst
import os, sys
class bdist_wininst(_bdist_wininst): class bdist_wininst(_bdist_wininst):
_good_upload = _bad_upload = None _good_upload = _bad_upload = None
def create_exe(self, arcname, fullname, bitmap=None): def create_exe(self, arcname, fullname, bitmap=None):
_bdist_wininst.create_exe(self, arcname, fullname, bitmap) _bdist_wininst.create_exe(self, arcname, fullname, bitmap)
installer_name = self.get_installer_filename(fullname) installer_name = self.get_installer_filename(fullname)
if self.target_version: if self.target_version:
pyversion = self.target_version pyversion = self.target_version
# fix 2.5+ bdist_wininst ignoring --target-version spec # fix 2.5+ bdist_wininst ignoring --target-version spec
...@@ -14,7 +14,7 @@ class bdist_wininst(_bdist_wininst): ...@@ -14,7 +14,7 @@ class bdist_wininst(_bdist_wininst):
else: else:
pyversion = 'any' pyversion = 'any'
self._good_upload = ('bdist_wininst', pyversion, installer_name) self._good_upload = ('bdist_wininst', pyversion, installer_name)
def _fix_upload_names(self): def _fix_upload_names(self):
good, bad = self._good_upload, self._bad_upload good, bad = self._good_upload, self._bad_upload
dist_files = getattr(self.distribution, 'dist_files', []) dist_files = getattr(self.distribution, 'dist_files', [])
...@@ -23,7 +23,7 @@ class bdist_wininst(_bdist_wininst): ...@@ -23,7 +23,7 @@ class bdist_wininst(_bdist_wininst):
if good not in dist_files: if good not in dist_files:
dist_files.append(good) dist_files.append(good)
def reinitialize_command (self, command, reinit_subcommands=0): def reinitialize_command(self, command, reinit_subcommands=0):
cmd = self.distribution.reinitialize_command( cmd = self.distribution.reinitialize_command(
command, reinit_subcommands) command, reinit_subcommands)
if command in ('install', 'install_lib'): if command in ('install', 'install_lib'):
...@@ -38,7 +38,6 @@ class bdist_wininst(_bdist_wininst): ...@@ -38,7 +38,6 @@ class bdist_wininst(_bdist_wininst):
finally: finally:
self._is_running = False self._is_running = False
if not hasattr(_bdist_wininst, 'get_installer_filename'): if not hasattr(_bdist_wininst, 'get_installer_filename'):
def get_installer_filename(self, fullname): def get_installer_filename(self, fullname):
# Factored out to allow overriding in subclasses # Factored out to allow overriding in subclasses
...@@ -47,36 +46,9 @@ class bdist_wininst(_bdist_wininst): ...@@ -47,36 +46,9 @@ class bdist_wininst(_bdist_wininst):
# it's better to include this in the name # it's better to include this in the name
installer_name = os.path.join(self.dist_dir, installer_name = os.path.join(self.dist_dir,
"%s.win32-py%s.exe" % "%s.win32-py%s.exe" %
(fullname, self.target_version)) (fullname, self.target_version))
else: else:
installer_name = os.path.join(self.dist_dir, installer_name = os.path.join(self.dist_dir,
"%s.win32.exe" % fullname) "%s.win32.exe" % fullname)
return installer_name return installer_name
# get_installer_filename() # get_installer_filename()
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