Loading tools/adbs +2 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. from __future__ import print_function import os import os.path import re Loading tools/check_radio_versions.py +13 −9 Original line number Diff line number Diff line Loading @@ -14,8 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. from __future__ import print_function import sys import os try: from hashlib import sha1 Loading Loading @@ -52,8 +53,9 @@ for item in sys.argv[2:]: try: f = open(fn + ".sha1") except IOError: if not bad: print print "*** Error opening \"%s.sha1\"; can't verify %s" % (fn, key) if not bad: print() print("*** Error opening \"%s.sha1\"; can't verify %s" % (fn, key)) bad = True continue for line in f: Loading @@ -63,17 +65,19 @@ for item in sys.argv[2:]: versions[h] = v if digest not in versions: if not bad: print print "*** SHA-1 hash of \"%s\" doesn't appear in \"%s.sha1\"" % (fn, fn) if not bad: print() print("*** SHA-1 hash of \"%s\" doesn't appear in \"%s.sha1\"" % (fn, fn)) bad = True continue if versions[digest] not in values: if not bad: print print "*** \"%s\" is version %s; not any %s allowed by \"%s\"." % ( fn, versions[digest], key, sys.argv[1]) if not bad: print() print("*** \"%s\" is version %s; not any %s allowed by \"%s\"." % ( fn, versions[digest], key, sys.argv[1])) bad = True if bad: print print() sys.exit(1) tools/compare_fileslist.py +3 −3 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ from __future__ import print_function import cgi, os, string, sys import cgi, os, sys def iteritems(obj): Loading @@ -42,10 +42,10 @@ def main(argv): data = {} index = 0 for input in inputs: f = file(input, "r") f = open(input) lines = f.readlines() f.close() lines = map(string.split, lines) lines = [l.strip() for l in lines] lines = [(x_y[1],int(x_y[0])) for x_y in lines] for fn,sz in lines: if fn not in data: Loading tools/diff_package_overlays.py +4 −2 Original line number Diff line number Diff line Loading @@ -34,11 +34,13 @@ Format of current_overlays.txt and previous_overlays.txt: ... """ from __future__ import print_function import sys def main(argv): if len(argv) != 4: print >> sys.stderr, __doc__ print(sys.stderr, __doc__) sys.exit(1) f = open(argv[1]) Loading Loading @@ -85,7 +87,7 @@ def main(argv): # Print out the package names that have overlay change. for r in result: print r print(r) if __name__ == "__main__": main(sys.argv) tools/event_log_tags.py +6 −4 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ """A module for reading and parsing event-log-tags files.""" from __future__ import print_function import re import sys Loading Loading @@ -55,7 +57,7 @@ class TagFile(object): if file_object is None: try: file_object = open(filename, "rb") except (IOError, OSError), e: except (IOError, OSError) as e: self.AddError(str(e)) return Loading Loading @@ -100,7 +102,7 @@ class TagFile(object): self.tags.append(Tag(tag, tagname, description, self.filename, self.linenum)) except (IOError, OSError), e: except (IOError, OSError) as e: self.AddError(str(e)) Loading Loading @@ -130,6 +132,6 @@ def WriteOutput(output_file, data): out = open(output_file, "wb") out.write(data) out.close() except (IOError, OSError), e: print >> sys.stderr, "failed to write %s: %s" % (output_file, e) except (IOError, OSError) as e: print("failed to write %s: %s" % (output_file, e), file=sys.stderr) sys.exit(1) Loading
tools/adbs +2 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. from __future__ import print_function import os import os.path import re Loading
tools/check_radio_versions.py +13 −9 Original line number Diff line number Diff line Loading @@ -14,8 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. from __future__ import print_function import sys import os try: from hashlib import sha1 Loading Loading @@ -52,8 +53,9 @@ for item in sys.argv[2:]: try: f = open(fn + ".sha1") except IOError: if not bad: print print "*** Error opening \"%s.sha1\"; can't verify %s" % (fn, key) if not bad: print() print("*** Error opening \"%s.sha1\"; can't verify %s" % (fn, key)) bad = True continue for line in f: Loading @@ -63,17 +65,19 @@ for item in sys.argv[2:]: versions[h] = v if digest not in versions: if not bad: print print "*** SHA-1 hash of \"%s\" doesn't appear in \"%s.sha1\"" % (fn, fn) if not bad: print() print("*** SHA-1 hash of \"%s\" doesn't appear in \"%s.sha1\"" % (fn, fn)) bad = True continue if versions[digest] not in values: if not bad: print print "*** \"%s\" is version %s; not any %s allowed by \"%s\"." % ( fn, versions[digest], key, sys.argv[1]) if not bad: print() print("*** \"%s\" is version %s; not any %s allowed by \"%s\"." % ( fn, versions[digest], key, sys.argv[1])) bad = True if bad: print print() sys.exit(1)
tools/compare_fileslist.py +3 −3 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ from __future__ import print_function import cgi, os, string, sys import cgi, os, sys def iteritems(obj): Loading @@ -42,10 +42,10 @@ def main(argv): data = {} index = 0 for input in inputs: f = file(input, "r") f = open(input) lines = f.readlines() f.close() lines = map(string.split, lines) lines = [l.strip() for l in lines] lines = [(x_y[1],int(x_y[0])) for x_y in lines] for fn,sz in lines: if fn not in data: Loading
tools/diff_package_overlays.py +4 −2 Original line number Diff line number Diff line Loading @@ -34,11 +34,13 @@ Format of current_overlays.txt and previous_overlays.txt: ... """ from __future__ import print_function import sys def main(argv): if len(argv) != 4: print >> sys.stderr, __doc__ print(sys.stderr, __doc__) sys.exit(1) f = open(argv[1]) Loading Loading @@ -85,7 +87,7 @@ def main(argv): # Print out the package names that have overlay change. for r in result: print r print(r) if __name__ == "__main__": main(sys.argv)
tools/event_log_tags.py +6 −4 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ """A module for reading and parsing event-log-tags files.""" from __future__ import print_function import re import sys Loading Loading @@ -55,7 +57,7 @@ class TagFile(object): if file_object is None: try: file_object = open(filename, "rb") except (IOError, OSError), e: except (IOError, OSError) as e: self.AddError(str(e)) return Loading Loading @@ -100,7 +102,7 @@ class TagFile(object): self.tags.append(Tag(tag, tagname, description, self.filename, self.linenum)) except (IOError, OSError), e: except (IOError, OSError) as e: self.AddError(str(e)) Loading Loading @@ -130,6 +132,6 @@ def WriteOutput(output_file, data): out = open(output_file, "wb") out.write(data) out.close() except (IOError, OSError), e: print >> sys.stderr, "failed to write %s: %s" % (output_file, e) except (IOError, OSError) as e: print("failed to write %s: %s" % (output_file, e), file=sys.stderr) sys.exit(1)