summaryrefslogtreecommitdiff
path: root/release.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2013-06-19 11:45:38 +0100
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2013-06-19 11:45:38 +0100
commit8d016844c5934fe8f7ee4c559ab5a1f2133fa6dc (patch)
tree199a8e4792f87c951fcf82197061c35e5805d100 /release.py
parent744a61f18bbfcbf7dfaa08886185b4595d8b7bcb (diff)
parent5d9d3930f400a754f38be2a4de21a7f9ed00f5f4 (diff)
downloadpython-setuptools-git-8d016844c5934fe8f7ee4c559ab5a1f2133fa6dc.tar.gz
Merged upstream changes.
--HG-- branch : single-codebase
Diffstat (limited to 'release.py')
-rw-r--r--release.py31
1 files changed, 17 insertions, 14 deletions
diff --git a/release.py b/release.py
index 2e35feb1..937fadfc 100644
--- a/release.py
+++ b/release.py
@@ -11,32 +11,32 @@ import subprocess
import shutil
import os
import sys
-import urllib2
import getpass
import collections
import itertools
import re
try:
- from urllib2 import urlopen, Request, HTTPError
- from itertools import izip_longest
+ import urllib.request as urllib_request
except ImportError:
- from urllib.request import urlopen, Request
- from urllib.error import HTTPError
- raw_input = input
- from itertools import zip_longest as izip_longest
+ import urllib2 as urllib_request
+
+try:
+ input = raw_input
+except NameError:
+ pass
try:
import keyring
except Exception:
pass
-VERSION = '0.7.3'
+VERSION = '0.8'
PACKAGE_INDEX = 'https://pypi.python.org/pypi'
def set_versions():
global VERSION
- version = raw_input("Release as version [%s]> " % VERSION) or VERSION
+ version = input("Release as version [%s]> " % VERSION) or VERSION
if version != VERSION:
VERSION = bump_versions(version)
@@ -108,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 = Request(url = url, headers = headers,
+ req = urllib_request.Request(url = url, headers = headers,
data='name='+version)
try:
- urlopen(req)
- except HTTPError as e:
+ urllib_request.urlopen(req)
+ except urllib_request.HTTPError as e:
print(e.fp.read())
def bump_versions(target_ver):
@@ -125,7 +125,10 @@ def bump_versions(target_ver):
def bump_version(filename, target_ver):
with open(filename, 'rb') as f:
- lines = [line.replace(VERSION, target_ver) for line in f]
+ lines = [
+ line.replace(VERSION.encode('ascii'), target_ver.encode('ascii'))
+ for line in f
+ ]
with open(filename, 'wb') as f:
f.writelines(lines)
@@ -234,7 +237,7 @@ def _linkified_text(rst_content):
anchors = []
linkified_parts = [_linkified_part(part, anchors)
for part in plain_text_parts]
- pairs = izip_longest(
+ pairs = itertools.izip_longest(
linkified_parts,
HREF_pattern.findall(rst_content),
fillvalue='',