diff --git a/update_version.py b/update_version.py index 470e4251e689..cb5ab98429a1 100755 --- a/update_version.py +++ b/update_version.py @@ -13,25 +13,25 @@ from xml.dom import minidom if len(sys.argv) < 2 or len(sys.argv) > 3: - print """ + print(""" [ERROR] Please specify a version. ./update_version.py .. [] Example: ./update_version.py 3.7.1 2 -""" +""") exit(1) NEW_VERSION = sys.argv[1] NEW_VERSION_INFO = [int(x) for x in NEW_VERSION.split('.')] if len(NEW_VERSION_INFO) != 3: - print """ + print(""" [ERROR] Version must be in the format .. Example: ./update_version.py 3.7.3 -""" +""") exit(1) RC_VERSION = -1 @@ -71,9 +71,9 @@ def RewriteXml(filename, rewriter, add_xml_prefix=True): content = document.toxml().replace('', '') file_handle = open(filename, 'wb') if add_xml_prefix: - file_handle.write('\n') - file_handle.write(content) - file_handle.write('\n') + file_handle.write(b'\n') + file_handle.write(content.encode('utf-8')) + file_handle.write(b'\n') file_handle.close() @@ -83,7 +83,7 @@ def RewriteTextFile(filename, line_rewriter): for line in lines: updated_lines.append(line_rewriter(line)) if lines == updated_lines: - print '%s was not updated. Please double check.' % filename + print('%s was not updated. Please double check.' % filename) f = open(filename, 'w') f.write(''.join(updated_lines)) f.close() @@ -245,11 +245,11 @@ def UpdateMakefile(): protobuf_version_offset = 11 expected_major_version = 3 if NEW_VERSION_INFO[0] != expected_major_version: - print """[ERROR] Major protobuf version has changed. Please update + print("""[ERROR] Major protobuf version has changed. Please update update_version.py to readjust the protobuf_version_offset and expected_major_version such that the PROTOBUF_VERSION in src/Makefile.am is always increasing. - """ + """) exit(1) protobuf_version_info = '%d:%d:0' % (