summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Orion Hodson <oth@google.com> 2022-04-04 13:22:38 +0100
committer Orion Hodson <oth@google.com> 2022-04-04 13:22:38 +0100
commite421668192eb334503b916d65d9e7543fafee275 (patch)
tree0ea23a18e1610c6c8d0443eec7fa18dcbea05b7a
parent5e0edffa3cff4d1adc35b1a3f4f07ece1944c608 (diff)
Update checkowners.py to support python3
Update generated with 2to3. Bug: N/A Test: manually check OWNERS files Change-Id: Idccc7ba36351854fe2b7a669a99c97f3f3a03d0e
-rwxr-xr-xtools/checkowners.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/checkowners.py b/tools/checkowners.py
index d6853d8e87..f037321059 100755
--- a/tools/checkowners.py
+++ b/tools/checkowners.py
@@ -5,8 +5,8 @@
import argparse
import re
import sys
-import urllib
-import urllib2
+import urllib.request, urllib.parse, urllib.error
+import urllib.request, urllib.error, urllib.parse
parser = argparse.ArgumentParser(description='Check OWNERS file syntax')
parser.add_argument('-v', '--verbose', dest='verbose',
@@ -25,15 +25,15 @@ checked_addresses = {}
def echo(msg):
if args.verbose:
- print msg
+ print(msg)
def find_address(address):
if address not in checked_addresses:
request = (gerrit_server + '/accounts/?n=1&q=email:'
- + urllib.quote(address))
+ + urllib.parse.quote(address))
echo('Checking email address: ' + address)
- result = urllib2.urlopen(request).read()
+ result = urllib.request.urlopen(request).read()
checked_addresses[address] = result.find('"_account_id":') >= 0
if checked_addresses[address]:
echo('Found email address: ' + address)
@@ -43,7 +43,7 @@ def find_address(address):
def check_address(fname, num, address):
if find_address(address):
return 0
- print '%s:%d: ERROR: unknown email address: %s' % (fname, num, address)
+ print('%s:%d: ERROR: unknown email address: %s' % (fname, num, address))
return 1
@@ -72,7 +72,7 @@ def main():
stripped_line = re.sub('#.*$', '', line).strip()
if not patterns.match(stripped_line):
error += 1
- print '%s:%d: ERROR: unknown line [%s]' % (fname, num, line.strip())
+ print('%s:%d: ERROR: unknown line [%s]' % (fname, num, line.strip()))
elif args.check_address:
if perfile_pattern.match(stripped_line):
for addr in perfile_pattern.match(stripped_line).group(1).split(','):