@@ -56,8 +56,8 @@ def finalize_options (self):
5656 if self .distribution .has_ext_modules ():
5757 short_version = sys .version [:3 ]
5858 if self .target_version and self .target_version != short_version :
59- raise DistutilsOptionError ( "target version can only be" +
60- short_version )
59+ raise DistutilsOptionError , \
60+ "target version can only be" + short_version
6161 self .target_version = short_version
6262
6363 self .set_undefined_options ('bdist' , ('dist_dir' , 'dist_dir' ))
@@ -73,7 +73,7 @@ def run (self):
7373 ("distribution contains extensions and/or C libraries; "
7474 "must be compiled on a Windows 32 platform" )
7575
76- self .run_command ('build' )
76+ self .run_command ('build' )
7777
7878 install = self .reinitialize_command ('install' )
7979 install .root = self .bdist_dir
@@ -91,7 +91,7 @@ def run (self):
9191
9292 install_lib .ensure_finalized ()
9393
94- self .announce ("installing to %s" % self .bdist_dir )
94+ self .announce ("installing to %s" % self .bdist_dir )
9595 install .ensure_finalized ()
9696 install .run ()
9797
@@ -103,24 +103,24 @@ def run (self):
103103
104104 # Our archive MUST be relative to sys.prefix, which is the
105105 # same as install_purelib in the 'nt' scheme.
106- root_dir = os .path .normpath (install .install_purelib )
106+ root_dir = os .path .normpath (install .install_purelib )
107107
108108 # Sanity check: Make sure everything is included
109109 for key in ('purelib' , 'platlib' , 'headers' , 'scripts' , 'data' ):
110110 attrname = 'install_' + key
111- install_x = getattr (install , attrname )
111+ install_x = getattr (install , attrname )
112112 # (Use normpath so that we can string.find to look for
113113 # subdirectories)
114- install_x = os .path .normpath (install_x )
115- if string .find (install_x , root_dir ) != 0 :
114+ install_x = os .path .normpath (install_x )
115+ if string .find (install_x , root_dir ) != 0 :
116116 raise DistutilsInternalError \
117117 ("'%s' not included in install_lib" % key )
118- arcname = self .make_archive (archive_basename , "zip" ,
119- root_dir = root_dir )
120- self .create_exe (arcname , fullname )
118+ arcname = self .make_archive (archive_basename , "zip" ,
119+ root_dir = root_dir )
120+ self .create_exe (arcname , fullname )
121121
122122 if not self .keep_temp :
123- remove_tree (self .bdist_dir , self .verbose , self .dry_run )
123+ remove_tree (self .bdist_dir , self .verbose , self .dry_run )
124124
125125 # run()
126126
@@ -133,37 +133,37 @@ def get_inidata (self):
133133 # Write the [metadata] section. Values are written with
134134 # repr()[1:-1], so they do not contain unprintable characters, and
135135 # are not surrounded by quote chars.
136- lines .append ("[metadata]" )
136+ lines .append ("[metadata]" )
137137
138138 # 'info' will be displayed in the installer's dialog box,
139139 # describing the items to be installed.
140140 info = (metadata .long_description or '' ) + '\n '
141141
142- for name in dir (metadata ):
142+ for name in dir (metadata ):
143143 if (name != 'long_description' ):
144- data = getattr (metadata , name )
144+ data = getattr (metadata , name )
145145 if data :
146146 info = info + ("\n %s: %s" % \
147- (string .capitalize (name ), data ))
148- lines .append ("%s=%s" % (name , repr (data )[1 :- 1 ]))
147+ (string .capitalize (name ), data ))
148+ lines .append ("%s=%s" % (name , repr (data )[1 :- 1 ]))
149149
150150 # The [setup] section contains entries controlling
151151 # the installer runtime.
152- lines .append ("\n [Setup]" )
153- lines .append ("info=%s" % repr (info )[1 :- 1 ])
154- lines .append ("target_compile=%d" % (not self .no_target_compile ))
155- lines .append ("target_optimize=%d" % (not self .no_target_optimize ))
152+ lines .append ("\n [Setup]" )
153+ lines .append ("info=%s" % repr (info )[1 :- 1 ])
154+ lines .append ("target_compile=%d" % (not self .no_target_compile ))
155+ lines .append ("target_optimize=%d" % (not self .no_target_optimize ))
156156 if self .target_version :
157- lines .append ("target_version=%s" % self .target_version )
157+ lines .append ("target_version=%s" % self .target_version )
158158
159159 title = self .distribution .get_fullname ()
160- lines .append ("title=%s" % repr (title )[1 :- 1 ])
160+ lines .append ("title=%s" % repr (title )[1 :- 1 ])
161161 import time
162162 import distutils
163163 build_info = "Build %s with distutils-%s" % \
164- (time .ctime (time .time ()), distutils .__version__ )
165- lines .append ("build_info=%s" % build_info )
166- return string .join (lines , "\n " )
164+ (time .ctime (time .time ()), distutils .__version__ )
165+ lines .append ("build_info=%s" % build_info )
166+ return string .join (lines , "\n " )
167167
168168 # get_inidata()
169169
@@ -183,36 +183,36 @@ def create_exe (self, arcname, fullname):
183183 else :
184184 installer_name = os .path .join (self .dist_dir ,
185185 "%s.win32.exe" % fullname )
186- self .announce ("creating %s" % installer_name )
186+ self .announce ("creating %s" % installer_name )
187187
188- file = open (installer_name , "wb" )
189- file .write (self .get_exe_bytes ())
190- file .write (cfgdata )
191- header = struct .pack ("<ii" ,
192- 0x12345679 , # tag
193- len (cfgdata )) # length
194- file .write (header )
195- file .write (open (arcname , "rb" ).read ())
188+ file = open (installer_name , "wb" )
189+ file .write (self .get_exe_bytes ())
190+ file .write (cfgdata )
191+ header = struct .pack ("<ii" ,
192+ 0x12345679 , # tag
193+ len (cfgdata )) # length
194+ file .write (header )
195+ file .write (open (arcname , "rb" ).read ())
196196
197197 # create_exe()
198198
199199 def get_exe_bytes (self ):
200200 import base64
201- return base64 .decodestring (EXEDATA )
201+ return base64 .decodestring (EXEDATA )
202202
203203# class bdist_wininst
204204
205205if __name__ == '__main__' :
206206 # recreate EXEDATA from wininst.exe by rewriting this file
207207 import re , base64
208- moddata = open ("bdist_wininst.py" , "r" ).read ()
209- exedata = open ("../../misc/wininst.exe" , "rb" ).read ()
210- print "wininst.exe length is %d bytes" % len (exedata )
211- print "wininst.exe encoded length is %d bytes" % len (base64 .encodestring (exedata ))
212- exp = re .compile ('EXE' + 'DATA = """\\ \\ (\n .*)*\n """' , re .M )
213- data = exp .sub ('EXE' + 'DATA = """\\ \\ \n %s"""' %
214- base64 .encodestring (exedata ), moddata )
215- open ("bdist_wininst.py" , "w" ).write (data )
208+ moddata = open ("bdist_wininst.py" , "r" ).read ()
209+ exedata = open ("../../misc/wininst.exe" , "rb" ).read ()
210+ print "wininst.exe length is %d bytes" % len (exedata )
211+ print "wininst.exe encoded length is %d bytes" % len (base64 .encodestring (exedata ))
212+ exp = re .compile ('EXE' + 'DATA = """\\ \\ (\n .*)*\n """' , re .M )
213+ data = exp .sub ('EXE' + 'DATA = """\\ \\ \n %s"""' %
214+ base64 .encodestring (exedata ), moddata )
215+ open ("bdist_wininst.py" , "w" ).write (data )
216216 print "bdist_wininst.py recreated"
217217
218218EXEDATA = """\
0 commit comments