diff options
author | 2012-07-31 16:29:52 -0400 | |
---|---|---|
committer | 2012-07-31 16:29:52 -0400 | |
commit | 1be11c73e5a2c0d854957696dabc1566a13061af (patch) | |
tree | a7d906038b39894dc10699b409638fe3bf0fd3da | |
parent | Add sqlite-vacuum script, bug #413295. (diff) | |
download | chromium-tools-1be11c73e5a2c0d854957696dabc1566a13061af.tar.gz chromium-tools-1be11c73e5a2c0d854957696dabc1566a13061af.tar.bz2 chromium-tools-1be11c73e5a2c0d854957696dabc1566a13061af.zip |
Python 3 compatibility.
-rwxr-xr-x | extract-cves.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/extract-cves.py b/extract-cves.py index 8769511..4ccfbf7 100755 --- a/extract-cves.py +++ b/extract-cves.py @@ -1,16 +1,20 @@ #!/usr/bin/env python +from __future__ import print_function + import re import sys -import urllib2 - +try: + from urllib.request import urlopen +except ImportError: + from urllib2 import urlopen CVE_PATTERN = re.compile('CVE-(\d{4})-(\d+)') def main(argv): - response = urllib2.urlopen(argv[0]) - cves = CVE_PATTERN.findall(response.read()) + response = urlopen(argv[0]) + cves = CVE_PATTERN.findall(str(response.read())) years = {} for year, no in cves: if year not in years: @@ -23,7 +27,7 @@ def main(argv): result.append('CVE-%s-%s' % (year, nos[0])) else: result.append('CVE-%s-{%s}' % (year, ','.join(sorted(nos)))) - print ' '.join(result) + print(' '.join(result)) return 0 |