This commit is contained in:
ndparker 2014-11-02 00:14:32 +01:00
parent 3f9612409b
commit 37cf398b9d
6 changed files with 15 additions and 15 deletions

View File

@ -41,7 +41,7 @@ def _cleanup_epydoc(target):
"""
search = _re.compile(r'<table[^<>]+width="100%%"').search
for filename in _shell.files(target, '*.html'):
fp = open(filename, 'r')
fp = open(filename, 'r', encoding='latin-1')
try:
html = fp.read()
finally:
@ -53,7 +53,7 @@ def _cleanup_epydoc(target):
if end >= 0:
end += len('</table>') + 1
html = html[:start] + html[end:]
fp = open(filename, 'w')
fp = open(filename, 'w', encoding='latin-1')
try:
fp.write(html)
finally:

View File

@ -179,7 +179,7 @@ class ConfTest(object):
"""
self._tempdir = tempdir = _tempfile.mkdtemp()
src = _os.path.join(tempdir, 'conftest.c')
fp = open(src, 'w')
fp = open(src, 'w', encoding='utf-8')
try:
fp.write(source)
finally:

View File

@ -63,7 +63,7 @@ class MakefileTarget(_make.Target):
names.append(name)
names.sort()
fp = open(_shell.native('Makefile'), 'w')
fp = open(_shell.native('Makefile'), 'w', encoding='utf-8')
print(decorate("Generated Makefile, DO NOT EDIT"), file=fp)
print(decorate("python %s %s" % (
_os.path.basename(script), self.NAME

View File

@ -187,7 +187,7 @@ class Distribution(_make.Target):
return sig.hexdigest()
param = {'sig': sig.hexdigest(), 'file': _os.path.basename(filename)}
fp = open("%s.%s" % (filename, name), "w")
fp = open("%s.%s" % (filename, name), "w", encoding='utf-8')
fp.write("%(sig)s *%(file)s\n" % param)
fp.close()
@ -265,9 +265,9 @@ class Distribution(_make.Target):
sig.seek(0, 0)
if detach:
open("%s.asc" % filename, "w").write(sig.read())
open("%s.asc" % filename, "w", encoding='utf-8').write(sig.read())
else:
open(filename, "w").write(sig.read())
open(filename, "w", encoding='utf-8').write(sig.read())
return True
@ -309,7 +309,7 @@ class Manifest(_make.Target):
def run(self):
_term.green("Creating %(name)s...", name=self.NAME)
dest = _shell.native(self.NAME)
dest = open(dest, 'w')
dest = open(dest, 'w', encoding='utf-8')
for name in self.manifest_names():
dest.write("%s\n" % name)
dest.close()

View File

@ -88,7 +88,7 @@ def find_description(docs):
summary = None
filename = docs.get('meta.summary', 'SUMMARY').strip()
if filename and _os.path.isfile(filename):
fp = open(filename)
fp = open(filename, encoding='utf-8')
try:
try:
summary = fp.read().strip().splitlines()[0].rstrip()
@ -100,7 +100,7 @@ def find_description(docs):
description = None
filename = docs.get('meta.description', 'DESCRIPTION').strip()
if filename and _os.path.isfile(filename):
fp = open(filename)
fp = open(filename, encoding='utf-8')
try:
description = fp.read().rstrip()
finally:
@ -126,7 +126,7 @@ def find_classifiers(docs):
"""
filename = docs.get('meta.classifiers', 'CLASSIFIERS').strip()
if filename and _os.path.isfile(filename):
fp = open(filename)
fp = open(filename, encoding='utf-8')
try:
content = fp.read()
finally:
@ -145,7 +145,7 @@ def find_provides(docs):
"""
filename = docs.get('meta.provides', 'PROVIDES').strip()
if filename and _os.path.isfile(filename):
fp = open(filename)
fp = open(filename, encoding='utf-8')
try:
content = fp.read()
finally:
@ -164,7 +164,7 @@ def find_license(docs):
"""
filename = docs.get('meta.license', 'LICENSE').strip()
if filename and _os.path.isfile(filename):
fp = open(filename)
fp = open(filename, encoding='utf-8')
try:
return fp.read().rstrip()
finally:
@ -339,7 +339,7 @@ def run(config=('package.cfg',), ext=None, script_args=None, manifest_only=0):
ext = []
cfg = _util.SafeConfigParser()
cfg.read(config)
cfg.read(config, encoding='utf-8')
pkg = dict(cfg.items('package'))
python_min = pkg.get('python.min') or None
python_max = pkg.get('python.max') or None

View File

@ -204,7 +204,7 @@ sys.exit(result & 7)
'outfile': repr(_pickle.dumps(_os.path.abspath(outfile))),
'argv': repr(_pickle.dumps(argv)),
'env': repr(_pickle.dumps(env)),
}))
}).encode('utf-8'))
fd, _ = None, _os.close(fd)
if _sys.platform == 'win32':
argv = []