[tools] Update check-header-guards to python3
Change-Id: I052be19f67ce8cbffe0104fa2201d84d96fe410c
Reviewed-on: https://fuchsia-review.googlesource.com/c/cobalt/+/554163
Fuchsia-Auto-Submit: Zach Bush <zmbush@google.com>
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
Reviewed-by: Steve Fung <stevefung@google.com>
diff --git a/tools/style/check-header-guards.py b/tools/style/check-header-guards.py
index 644e0f2..1196660 100755
--- a/tools/style/check-header-guards.py
+++ b/tools/style/check-header-guards.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.7
+#!/usr/bin/env python3
# Copyright 2016 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -34,13 +34,13 @@
'ZIRCON_SYSTEM_PUBLIC',
'ZIRCON_THIRD_PARTY_ULIB_MUSL_INCLUDE',
]
-sysroot_prefix = re.compile('^(' + string.join(SYSROOT_PREFIXES, '|') + ')_')
+sysroot_prefix = re.compile('^(' + '|'.join(SYSROOT_PREFIXES) + ')_')
PUBLIC_PREFIXES = [
'ZIRCON_SYSTEM_ULIB_.*_INCLUDE', 'GARNET_PUBLIC', 'PERIDOT_PUBLIC',
'TOPAZ_PUBLIC', 'SDK'
]
-public_prefix = re.compile('^(' + string.join(PUBLIC_PREFIXES, '|') + ')_')
+public_prefix = re.compile('^(' + '|'.join(PUBLIC_PREFIXES) + ')_')
all_header_guards = collections.defaultdict(list)
@@ -232,7 +232,7 @@
def check_collisions():
collisions = 0
- for header_guard, paths in all_header_guards.iteritems():
+ for header_guard, paths in iter(all_header_guards.items()):
if len(paths) == 1:
continue
collisions += 1