Skip to content

Commit

Permalink
try fixing the issue presented in ndparker/rjsmin#2
Browse files Browse the repository at this point in the history
  • Loading branch information
ndparker committed Nov 2, 2014
1 parent 3f96124 commit 37cf398
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions py3/dev/apidoc.py
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion py3/ext.py
Expand Up @@ -179,7 +179,7 @@ def __init__(self, build, source):
"""
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:
Expand Down
2 changes: 1 addition & 1 deletion py3/make/default_targets.py
Expand Up @@ -63,7 +63,7 @@ def decorate(line, prefix='# ', width=78, char='~', padding=' '):
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
Expand Down
8 changes: 4 additions & 4 deletions py3/make/targets.py
Expand Up @@ -187,7 +187,7 @@ def do_digest(self, hashfunc, name, filename):
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()

Expand Down Expand Up @@ -265,9 +265,9 @@ def sign(self, filename, detach=True):

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

Expand Down Expand Up @@ -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()
Expand Down
12 changes: 6 additions & 6 deletions py3/setup.py
Expand Up @@ -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()
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion py3/shell.py
Expand Up @@ -204,7 +204,7 @@ def _filepipespawn(infile, outfile, argv, env):
'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 = []
Expand Down

0 comments on commit 37cf398

Please sign in to comment.