Commit 56822ec4 authored by Raul Tambre's avatar Raul Tambre Committed by Commit Bot

Support Python 3 in //buildtools/ensure_gn_version.py

The scripts still work with Python 2.
There are no intended behaviour changes.

Bug: 941669
Change-Id: I7e29b1736295957df30f82b5943b58f5ce843029
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1536184Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Raul Tambre <raul@tambre.ee>
Cr-Commit-Position: refs/heads/master@{#644870}
parent f28b4304
...@@ -24,7 +24,12 @@ import re ...@@ -24,7 +24,12 @@ import re
import stat import stat
import subprocess import subprocess
import sys import sys
import urllib2
try:
import urllib2 as urllib
except ImportError:
import urllib.request as urllib
import zipfile import zipfile
...@@ -78,8 +83,8 @@ def main(): ...@@ -78,8 +83,8 @@ def main():
url = 'https://chrome-infra-packages.appspot.com/dl/gn/gn/%s/+/%s' % ( url = 'https://chrome-infra-packages.appspot.com/dl/gn/gn/%s/+/%s' % (
platform, args.version) platform, args.version)
try: try:
zipdata = urllib2.urlopen(url).read() zipdata = urllib.urlopen(url).read()
except urllib2.HTTPError as e: except urllib.HTTPError as e:
print('Failed to download the package from %s: %d %s' % ( print('Failed to download the package from %s: %d %s' % (
url, e.code, e.reason)) url, e.code, e.reason))
return 1 return 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment