From 744a61f18bbfcbf7dfaa08886185b4595d8b7bcb Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Mon, 17 Jun 2013 19:23:33 +0100 Subject: Misc. updates following 2to3 checks. --HG-- branch : single-codebase --- release.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'release.py') diff --git a/release.py b/release.py index 632bf4cb..2e35feb1 100644 --- a/release.py +++ b/release.py @@ -17,6 +17,15 @@ import collections import itertools import re +try: + from urllib2 import urlopen, Request, HTTPError + from itertools import izip_longest +except ImportError: + from urllib.request import urlopen, Request + from urllib.error import HTTPError + raw_input = input + from itertools import zip_longest as izip_longest + try: import keyring except Exception: @@ -99,11 +108,11 @@ def add_milestone_and_version(version): for type in 'milestones', 'versions': url = (base + '/1.0/repositories/{repo}/issues/{type}' .format(repo = get_repo_name(), type=type)) - req = urllib2.Request(url = url, headers = headers, + req = Request(url = url, headers = headers, data='name='+version) try: - urllib2.urlopen(req) - except urllib2.HTTPError as e: + urlopen(req) + except HTTPError as e: print(e.fp.read()) def bump_versions(target_ver): @@ -225,7 +234,7 @@ def _linkified_text(rst_content): anchors = [] linkified_parts = [_linkified_part(part, anchors) for part in plain_text_parts] - pairs = itertools.izip_longest( + pairs = izip_longest( linkified_parts, HREF_pattern.findall(rst_content), fillvalue='', -- cgit v1.2.3