From ebb33a291a19851476eef648017ed70e76844fc8 2014-04-02 21:15:05 From: Thomas Kluyver Date: 2014-04-02 21:15:05 Subject: [PATCH] Start making backport_pr work on Python 3 --- diff --git a/tools/backport_pr.py b/tools/backport_pr.py index 303c8f5..5680a91 100755 --- a/tools/backport_pr.py +++ b/tools/backport_pr.py @@ -26,7 +26,10 @@ import re import sys from subprocess import Popen, PIPE, check_call, check_output -from urllib import urlopen +try: + from urllib.request import urlopen +except: + from urllib import urlopen from gh_api import ( get_issues_list, @@ -45,8 +48,8 @@ def find_rejects(root='.'): def get_current_branch(): branches = check_output(['git', 'branch']) for branch in branches.splitlines(): - if branch.startswith('*'): - return branch[1:].strip() + if branch.startswith(b'*'): + return branch[1:].strip().decode('utf-8') def backport_pr(branch, num, project='ipython/ipython'): current_branch = get_current_branch()