encode_packet_trace.py (9706:fbb19814adbc) encode_packet_trace.py (10065:58bf21ca88de)
1#!/usr/bin/env python
2
1#!/usr/bin/env python
2
3# Copyright (c) 2013 ARM Limited
3# Copyright (c) 2013-2014 ARM Limited
4# All rights reserved
5#
6# The license below extends only to copyright in the software and shall
7# not be construed as granting a license to any other intellectual
8# property including but not limited to intellectual property relating
9# to a hardware implementation of the functionality of the software
10# licensed hereunder. You may use the software subject to the license
11# terms below provided that you ensure that this notice is replicated

--- 80 unchanged lines hidden (view full) ---

92try:
93 import packet_pb2
94except:
95 print "Did not find packet proto definitions, attempting to generate"
96 from subprocess import call
97 error = call(['protoc', '--python_out=util', '--proto_path=src/proto',
98 'src/proto/packet.proto'])
99 if not error:
4# All rights reserved
5#
6# The license below extends only to copyright in the software and shall
7# not be construed as granting a license to any other intellectual
8# property including but not limited to intellectual property relating
9# to a hardware implementation of the functionality of the software
10# licensed hereunder. You may use the software subject to the license
11# terms below provided that you ensure that this notice is replicated

--- 80 unchanged lines hidden (view full) ---

92try:
93 import packet_pb2
94except:
95 print "Did not find packet proto definitions, attempting to generate"
96 from subprocess import call
97 error = call(['protoc', '--python_out=util', '--proto_path=src/proto',
98 'src/proto/packet.proto'])
99 if not error:
100 import packet_pb2
101 print "Generated packet proto definitions"
100 print "Generated packet proto definitions"
101
102 try:
103 import google.protobuf
104 except:
105 print "Please install the Python protobuf module"
106 exit(-1)
107
108 import packet_pb2
102 else:
103 print "Failed to import packet proto definitions"
104 exit(-1)
105
106def EncodeVarint(out_file, value):
107 """
108 The encoding of the Varint32 is copied from
109 google.protobuf.internal.encoder and is only repeated here to

--- 64 unchanged lines hidden ---
109 else:
110 print "Failed to import packet proto definitions"
111 exit(-1)
112
113def EncodeVarint(out_file, value):
114 """
115 The encoding of the Varint32 is copied from
116 google.protobuf.internal.encoder and is only repeated here to

--- 64 unchanged lines hidden ---