Use codecs.open in textfile_open() for Py2.7 so it can work more like open() in Py3, auto-converting to/from utf-8 and unicode. Use textfile_open in parts of the sphinx command that were having encoding errors and also in writeIfChanged().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71564 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2012-05-25 20:43:48 +00:00
parent b41df0b779
commit 2011586fa0
4 changed files with 34 additions and 35 deletions

View File

@@ -20,7 +20,7 @@ import subprocess
# Phoenix-specific imports
import templates
from buildtools.config import copyIfNewer, writeIfChanged, newer, getSvnRev
from buildtools.config import copyIfNewer, writeIfChanged, newer, getSvnRev, textfile_open
from utilities import Wx2Sphinx
from constants import HTML_REPLACE, TODAY, SPHINXROOT, SECTIONS_EXCLUDE
@@ -112,7 +112,7 @@ def BuildEnumsAndMethods(sphinxDir):
for input in textfiles:
fid = open(input, 'rt')
fid = textfile_open(input, 'rt')
orig_text = text = fid.read()
fid.close()
@@ -166,7 +166,7 @@ def BuildEnumsAndMethods(sphinxDir):
text = TooltipsOnInheritance(text, class_summary)
if text != orig_text:
fid = open(input, 'wt')
fid = textfile_open(input, 'wt')
fid.write(text)
fid.close()
@@ -185,7 +185,7 @@ def BuildEnumsAndMethods(sphinxDir):
keys = unreferenced_classes.keys()
keys.sort()
fid = open(os.path.join(SPHINXROOT, 'unreferenced_classes.inc'), 'wt')
fid = textfile_open(os.path.join(SPHINXROOT, 'unreferenced_classes.inc'), 'wt')
fid.write('\n')
fid.write('='*50 + ' ' + '='*50 + '\n')
fid.write('%-50s %-50s\n'%('Reference', 'File Name(s)'))