diff options
author | Xiaoyi Zhang <zhangxy@google.com> | 2019-11-05 22:08:36 (GMT) |
---|---|---|
committer | Xiaoyi Zhang <zhangxy@google.com> | 2019-11-05 22:08:36 (GMT) |
commit | e08a4602778b3cbea36dbd53724db0f18840e274 (patch) | |
tree | 838b8334c1fd7901d25589ffc68b30f8d1ee3464 /googlemock/scripts | |
parent | 8aedd597af6b38ddb7cd72f0101799cec9bf04e4 (diff) | |
parent | 442f45b376f54112d6991bdf259d1c8b5daf9ebf (diff) | |
download | googletest-e08a4602778b3cbea36dbd53724db0f18840e274.zip googletest-e08a4602778b3cbea36dbd53724db0f18840e274.tar.gz googletest-e08a4602778b3cbea36dbd53724db0f18840e274.tar.bz2 |
Merge pull request #2549 from kuzkry:pump-support-for-python-3
PiperOrigin-RevId: 278702666
Diffstat (limited to 'googlemock/scripts')
-rwxr-xr-x | googlemock/scripts/pump.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/googlemock/scripts/pump.py b/googlemock/scripts/pump.py index 66e3217..5523a19 100755 --- a/googlemock/scripts/pump.py +++ b/googlemock/scripts/pump.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python # # Copyright 2008, Google Inc. # All rights reserved. @@ -64,6 +64,7 @@ GRAMMAR: from __future__ import print_function +import io import os import re import sys @@ -834,7 +835,7 @@ def main(argv): sys.exit(1) file_path = argv[-1] - output_str = ConvertFromPumpSource(file(file_path, 'r').read()) + output_str = ConvertFromPumpSource(io.open(file_path, 'r').read()) if file_path.endswith('.pump'): output_file_path = file_path[:-5] else: @@ -842,11 +843,11 @@ def main(argv): if output_file_path == '-': print(output_str,) else: - output_file = file(output_file_path, 'w') - output_file.write('// This file was GENERATED by command:\n') - output_file.write('// %s %s\n' % + output_file = io.open(output_file_path, 'w') + output_file.write(u'// This file was GENERATED by command:\n') + output_file.write(u'// %s %s\n' % (os.path.basename(__file__), os.path.basename(file_path))) - output_file.write('// DO NOT EDIT BY HAND!!!\n\n') + output_file.write(u'// DO NOT EDIT BY HAND!!!\n\n') output_file.write(output_str) output_file.close() |