[pywin32-checkins] pywin32/com/win32com/client makepy.py, 1.23, 1.24
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2008-07-01 00:10:34
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23166/client Modified Files: makepy.py Log Message: * Use a file wrapper from the codecs package to ensure correct unicode handling. * Generate to a .temp file so an error doesn't leave a 1/2 generated file. Index: makepy.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/makepy.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** makepy.py 28 Mar 2007 12:34:51 -0000 1.23 --- makepy.py 1 Jul 2008 00:10:42 -0000 1.24 *************** *** 68,71 **** --- 68,72 ---- import genpy, string, sys, os, types, pythoncom + import codecs import selecttlb import gencache *************** *** 266,270 **** else: outputName = full_name + ".py" ! fileUse = open(outputName, "wt") progress.LogBeginGenerate(outputName) else: --- 267,275 ---- else: outputName = full_name + ".py" ! # generate to a temp file (so errors don't leave a 1/2 ! # generated file) and one which can handle unicode! ! encoding = 'mbcs' # could make this a param. ! fileUse = codecs.open(outputName + ".temp", "wt", ! encoding) progress.LogBeginGenerate(outputName) else: *************** *** 277,280 **** --- 282,286 ---- if file is None: fileUse.close() + os.rename(outputName + ".temp", outputName) if bToGenDir: |