util: Add a README file for the m5 utility.
[gem5.git] / util / protolib.py
index 4f3f2c7e3d031898b867db54f8c7717c38d5587a..ea0ff097f5b718f1b0ee98b7be259b691f1eff8c 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
 
 # Copyright (c) 2013 ARM Limited
 # All rights reserved
@@ -63,9 +63,6 @@
 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Authors: Andreas Hansson
-#          Radhika Jagtap
 
 # This file is a library of commonly used functions used when interfacing
 # with protobuf python messages. For eg, the decode scripts for different
@@ -94,7 +91,7 @@ def openFileRd(in_file):
         except IOError:
             proto_in = open(in_file, 'rb')
     except IOError:
-        print "Failed to open ", in_file, " for reading"
+        print("Failed to open ", in_file, " for reading")
         exit(-1)
     return proto_in
 
@@ -152,7 +149,7 @@ def _EncodeVarint32(out_file, value):
   bits = value & 0x7f
   value >>= 7
   while value:
-    out_file.write(struct.pack('<B', 0x80|bits))
+    out_file.write(struct.pack('<B', 0x80 | bits))
     bits = value & 0x7f
     value >>= 7
   out_file.write(struct.pack('<B', bits))