From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 6817213800E for ; Tue, 31 Jul 2012 20:39:11 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5526321C002; Tue, 31 Jul 2012 20:39:03 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 1F78E21C002 for ; Tue, 31 Jul 2012 20:39:03 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 59B991B401B for ; Tue, 31 Jul 2012 20:39:02 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 1A6F3E5437 for ; Tue, 31 Jul 2012 20:39:01 +0000 (UTC) From: "Mike Gilbert" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Gilbert" Message-ID: <1343766592.1be11c73e5a2c0d854957696dabc1566a13061af.floppym@gentoo> Subject: [gentoo-commits] proj/chromium-tools:master commit in: / X-VCS-Repository: proj/chromium-tools X-VCS-Files: extract-cves.py X-VCS-Directories: / X-VCS-Committer: floppym X-VCS-Committer-Name: Mike Gilbert X-VCS-Revision: 1be11c73e5a2c0d854957696dabc1566a13061af X-VCS-Branch: master Date: Tue, 31 Jul 2012 20:39:01 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 837a7726-e365-4866-8fe3-755ef29901e3 X-Archives-Hash: ba0cff395ecbbe4e0269cb6ab4e6f839 commit: 1be11c73e5a2c0d854957696dabc1566a13061af Author: Mike Gilbert gentoo org> AuthorDate: Tue Jul 31 20:29:52 2012 +0000 Commit: Mike Gilbert gentoo org> CommitDate: Tue Jul 31 20:29:52 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/chromium-tools.git;a=commit;h=1be11c73 Python 3 compatibility. --- 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