mirror of
https://git.suyu.dev/suyu/breakpad
synced 2024-11-21 14:29:09 -07:00
Update scripts to Python 3
Python 2 is deprecated and have now been removed from CI builders. Change-Id: Ic838714502e16136bd8ed345a47a00b71ff889aa Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4754416 Reviewed-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
parent
8f6b252722
commit
922d49bdfe
4 changed files with 13 additions and 16 deletions
2
DEPS
2
DEPS
|
@ -52,7 +52,7 @@ deps = {
|
||||||
hooks = [
|
hooks = [
|
||||||
{
|
{
|
||||||
# Keep the manifest up to date.
|
# Keep the manifest up to date.
|
||||||
"action": ["python", "src/src/tools/python/deps-to-manifest.py",
|
"action": ["src/src/tools/python/deps-to-manifest.py",
|
||||||
"src/DEPS", "src/default.xml"],
|
"src/DEPS", "src/default.xml"],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/env python3
|
||||||
# Copyright 2016 Google LLC
|
# Copyright 2016 Google LLC
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -29,8 +29,6 @@
|
||||||
|
|
||||||
"""Convert gclient's DEPS file to repo's manifest xml file."""
|
"""Convert gclient's DEPS file to repo's manifest xml file."""
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -76,7 +74,8 @@ def ConvertDepsToManifest(deps, manifest):
|
||||||
"""Convert the |deps| file to the |manifest|."""
|
"""Convert the |deps| file to the |manifest|."""
|
||||||
# Load the DEPS file data.
|
# Load the DEPS file data.
|
||||||
ctx = {}
|
ctx = {}
|
||||||
execfile(deps, ctx)
|
with open(deps, 'rb') as file:
|
||||||
|
exec(compile(file.read(), deps, 'exec'), ctx)
|
||||||
|
|
||||||
new_contents = ''
|
new_contents = ''
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# Copyright 2012 Google LLC
|
# Copyright 2012 Google LLC
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -38,7 +38,6 @@ DWARF files and normalize and de-duplicate the FILE records found within,
|
||||||
updating any references to the FILE records in the other record types.
|
updating any references to the FILE records in the other record types.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import macpath
|
|
||||||
import ntpath
|
import ntpath
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
import os
|
||||||
|
@ -132,8 +131,8 @@ class SymbolFileParser(object):
|
||||||
Returns:
|
Returns:
|
||||||
The actual path to use when writing the FILE record.
|
The actual path to use when writing the FILE record.
|
||||||
"""
|
"""
|
||||||
return path[len(filter(path.startswith,
|
return path[len(next(filter(path.startswith,
|
||||||
self.ignored_prefixes + [''])[0]):]
|
self.ignored_prefixes + ['']))):]
|
||||||
|
|
||||||
def _ParseFileRecord(self, file_record):
|
def _ParseFileRecord(self, file_record):
|
||||||
"""Parses and corrects a FILE record."""
|
"""Parses and corrects a FILE record."""
|
||||||
|
@ -193,7 +192,7 @@ def main():
|
||||||
symbol_parser = SymbolFileParser(sys.stdin, sys.stdout, options.prefixes,
|
symbol_parser = SymbolFileParser(sys.stdin, sys.stdout, options.prefixes,
|
||||||
path_handler)
|
path_handler)
|
||||||
symbol_parser.Process()
|
symbol_parser.Process()
|
||||||
except BreakpadParseError, e:
|
except BreakpadParseError as e:
|
||||||
print >> sys.stderr, 'Got an error while processing symbol file'
|
print >> sys.stderr, 'Got an error while processing symbol file'
|
||||||
print >> sys.stderr, str(e)
|
print >> sys.stderr, str(e)
|
||||||
return 1
|
return 1
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# Copyright 2012 Google LLC
|
# Copyright 2012 Google LLC
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -29,10 +29,9 @@
|
||||||
|
|
||||||
"""Unit tests for filter_syms.py"""
|
"""Unit tests for filter_syms.py"""
|
||||||
|
|
||||||
import cStringIO
|
import io
|
||||||
import ntpath
|
import ntpath
|
||||||
import os
|
import os
|
||||||
import StringIO
|
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
@ -44,8 +43,8 @@ import filter_syms
|
||||||
|
|
||||||
class FilterSysmsTest(unittest.TestCase):
|
class FilterSysmsTest(unittest.TestCase):
|
||||||
def assertParsed(self, input_data, ignored_prefixes, expected):
|
def assertParsed(self, input_data, ignored_prefixes, expected):
|
||||||
input_io = cStringIO.StringIO(input_data)
|
input_io = io.StringIO(input_data)
|
||||||
output_io = cStringIO.StringIO()
|
output_io = io.StringIO()
|
||||||
parser = filter_syms.SymbolFileParser(input_io, output_io,
|
parser = filter_syms.SymbolFileParser(input_io, output_io,
|
||||||
ignored_prefixes, ntpath)
|
ignored_prefixes, ntpath)
|
||||||
parser.Process()
|
parser.Process()
|
||||||
|
@ -134,4 +133,4 @@ FUNC 1000 c 0 Function1_1
|
||||||
self.assertParsed(INPUT, IGNORED_PREFIXES, EXPECTED_OUTPUT)
|
self.assertParsed(INPUT, IGNORED_PREFIXES, EXPECTED_OUTPUT)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Reference in a new issue