Always write binary files in mode wb
This commit is contained in:
@@ -111,7 +111,7 @@ def main(argv):
|
|||||||
context['getUniforms'] = [uniforms[u] for u in sorted(uniforms.keys())]
|
context['getUniforms'] = [uniforms[u] for u in sorted(uniforms.keys())]
|
||||||
|
|
||||||
if options.output and options.output != '-':
|
if options.output and options.output != '-':
|
||||||
output = open(options.output, 'w')
|
output = open(options.output, 'wb')
|
||||||
else:
|
else:
|
||||||
output = sys.stdout
|
output = sys.stdout
|
||||||
output.write(pystache.render(open(options.template, 'rb').read(), context))
|
output.write(pystache.render(open(options.template, 'rb').read(), context))
|
||||||
|
|||||||
8
build.py
8
build.py
@@ -255,7 +255,7 @@ def _build_require_list(dependencies, output_file_name):
|
|||||||
match = re.match(r'goog\.provide\(\'(.*)\'\);', line)
|
match = re.match(r'goog\.provide\(\'(.*)\'\);', line)
|
||||||
if match:
|
if match:
|
||||||
requires.add(match.group(1))
|
requires.add(match.group(1))
|
||||||
with open(output_file_name, 'w') as f:
|
with open(output_file_name, 'wb') as f:
|
||||||
for require in sorted(requires):
|
for require in sorted(requires):
|
||||||
f.write('goog.require(\'%s\');\n' % (require,))
|
f.write('goog.require(\'%s\');\n' % (require,))
|
||||||
|
|
||||||
@@ -334,7 +334,7 @@ def examples_star_json(name, match):
|
|||||||
'../externs/vbarray.js',
|
'../externs/vbarray.js',
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
with open(t.name, 'w') as f:
|
with open(t.name, 'wb') as f:
|
||||||
f.write(content)
|
f.write(content)
|
||||||
dependencies = [__file__, 'buildcfg/base.json']
|
dependencies = [__file__, 'buildcfg/base.json']
|
||||||
return Target(name, action=action, dependencies=dependencies)
|
return Target(name, action=action, dependencies=dependencies)
|
||||||
@@ -651,11 +651,11 @@ def split_example_file(example, dst_dir):
|
|||||||
target_lines.append(line)
|
target_lines.append(line)
|
||||||
|
|
||||||
target = open(
|
target = open(
|
||||||
os.path.join(dst_dir, os.path.basename(example)), 'w')
|
os.path.join(dst_dir, os.path.basename(example)), 'wb')
|
||||||
target_require = open(
|
target_require = open(
|
||||||
os.path.join(dst_dir, os.path.basename(example)
|
os.path.join(dst_dir, os.path.basename(example)
|
||||||
.replace('.js', '-require.js')),
|
.replace('.js', '-require.js')),
|
||||||
'w')
|
'wb')
|
||||||
|
|
||||||
target.writelines(target_lines)
|
target.writelines(target_lines)
|
||||||
target.close()
|
target.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user