From: Kefu Chai Date: Fri, 29 Sep 2017 04:03:15 +0000 (+0800) Subject: script/build-integration-branch: python3 compatible and pep8 clean X-Git-Tag: v13.0.1~740^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F18035%2Fhead;p=ceph.git script/build-integration-branch: python3 compatible and pep8 clean Signed-off-by: Kefu Chai --- diff --git a/src/script/build-integration-branch b/src/script/build-integration-branch index 416d38e8b86f..263506cb43c5 100755 --- a/src/script/build-integration-branch +++ b/src/script/build-integration-branch @@ -1,11 +1,17 @@ #!/usr/bin/env python +from __future__ import print_function + import json import os import requests from subprocess import call import sys import time +try: + from urllib.parse import urljoin +except: + from urlparse import urljoin label = sys.argv[1] repo = "ceph/ceph" @@ -14,7 +20,8 @@ with open(os.environ['HOME'] + '/.github_token', 'r') as myfile: token = myfile.readline().strip() # get prs -baseurl = 'https://api.github.com/repos/{repo}/issues?labels={label}&access_token={token}' +baseurl = urljoin('https://api.github.com', + 'repos/{repo}/issues?labels={label}&access_token={token}') url = baseurl.format( label=label, repo=repo, @@ -38,7 +45,7 @@ print("--- queried %s prs" % len(prs)) # name branch TIME_FORMAT = '%Y-%m-%d-%H%M' branch = label + "-" + time.strftime(TIME_FORMAT, time.localtime()) -print "branch %s" % branch +print("branch %s" % branch) # assemble print('--- creating branch %s' % branch) @@ -50,9 +57,8 @@ for pr in prs: pr['head']['repo']['clone_url'], pr['head']['ref'])) r = call(['git', 'pull', '--no-edit', - pr['head']['repo']['clone_url'], - pr['head']['ref'] - ]) + pr['head']['repo']['clone_url'], + pr['head']['ref']]) assert not r print('--- done. these PRs were included:') print('\n'.join(prtext))