Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/chromium-tools:master commit in: /
Date: Tue, 31 Jul 2012 20:39:11
Message-Id: 1343766592.1be11c73e5a2c0d854957696dabc1566a13061af.floppym@gentoo
1 commit: 1be11c73e5a2c0d854957696dabc1566a13061af
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jul 31 20:29:52 2012 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Tue Jul 31 20:29:52 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/chromium-tools.git;a=commit;h=1be11c73
7
8 Python 3 compatibility.
9
10 ---
11 extract-cves.py | 14 +++++++++-----
12 1 files changed, 9 insertions(+), 5 deletions(-)
13
14 diff --git a/extract-cves.py b/extract-cves.py
15 index 8769511..4ccfbf7 100755
16 --- a/extract-cves.py
17 +++ b/extract-cves.py
18 @@ -1,16 +1,20 @@
19 #!/usr/bin/env python
20
21 +from __future__ import print_function
22 +
23 import re
24 import sys
25 -import urllib2
26 -
27 +try:
28 + from urllib.request import urlopen
29 +except ImportError:
30 + from urllib2 import urlopen
31
32 CVE_PATTERN = re.compile('CVE-(\d{4})-(\d+)')
33
34
35 def main(argv):
36 - response = urllib2.urlopen(argv[0])
37 - cves = CVE_PATTERN.findall(response.read())
38 + response = urlopen(argv[0])
39 + cves = CVE_PATTERN.findall(str(response.read()))
40 years = {}
41 for year, no in cves:
42 if year not in years:
43 @@ -23,7 +27,7 @@ def main(argv):
44 result.append('CVE-%s-%s' % (year, nos[0]))
45 else:
46 result.append('CVE-%s-{%s}' % (year, ','.join(sorted(nos))))
47 - print ' '.join(result)
48 + print(' '.join(result))
49 return 0