From 661e008f1d0bda5f9c0de18a46fe018286c8ae79 Mon Sep 17 00:00:00 2001 From: Martin Cech Date: Mon, 16 May 2016 15:54:34 -0400 Subject: [PATCH 1/2] fix problems in bootstrap_history probably due to refactoring should work out of the box now, also minor rewording --- scripts/bootstrap_history.py | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/scripts/bootstrap_history.py b/scripts/bootstrap_history.py index ced79348166..b5a228b0d76 100644 --- a/scripts/bootstrap_history.py +++ b/scripts/bootstrap_history.py @@ -76,6 +76,7 @@ Fixes .. github_links + """ ANNOUNCE_TEMPLATE = string.Template(""" @@ -180,10 +181,10 @@ RELEASE_ISSUE_TEMPLATE = string.Template(""" - [ ] **Create Release Notes** - - [ ] Review merged PRs and ensure they all milestones attached. [Link](https://github.com/galaxyproject/galaxy/pulls?q=is%3Apr+is%3Amerged+no%3Amilestone) + - [ ] Review merged PRs and ensure they all have a milestones attached. [Link](https://github.com/galaxyproject/galaxy/pulls?q=is%3Apr+is%3Amerged+no%3Amilestone) - [ ] Checkout release branch - git checkout $version -b ${version}_release_notes + git checkout release_${version} -b ${version}_release_notes - [ ] Check for obvious missing metadata in release PRs make release-check-metadata RELEASE_CURR=${version} @@ -287,7 +288,7 @@ def do_release(argv): open(next_release_file, "w").write(next_announce.encode("utf-8")) releases_index = _release_file("index.rst") releases_index_contents = open(releases_index, "r").read() - releases_index_contents = releases_index_contents.replace(".. annoucements\n", ".. annoucements\n" + next_version + "_announce\n" ) + releases_index_contents = releases_index_contents.replace(".. annoucements\n", ".. annoucements\n " + next_version + "_announce\n" ) with open(releases_index, "w") as f: f.write(releases_index_contents) @@ -337,10 +338,14 @@ def check_blocking_issues(argv): def _pr_to_str(pr): + if isinstance(pr, basestring): + return pr return "PR #%s (%s) %s" % (pr.number, pr.title, pr.html_url) def _issue_to_str(pr): + if isinstance(pr, basestring): + return pr return "Issue #%s (%s) %s" % (pr.number, pr.title, pr.html_url) @@ -390,6 +395,7 @@ def _get_prs(release_name, state="closed"): def main(argv): + # print argv if requests is None: raise Exception("Requests library not found, please pip install requests") github = _github_client() @@ -479,7 +485,7 @@ def main(argv): ) to_doc += "\n`Pull Request {0}`_".format(pull_request) if github: - _text_target(github, pull_request) + text_target = _text_target(github, pull_request) elif ident.startswith("issue"): issue = ident[len("issue"):] text = ".. _Issue {0}: {1}/issues/{0}".format(issue, PROJECT_URL) @@ -492,17 +498,28 @@ def main(argv): to_doc += "{0}_".format(short_rev) to_doc = wrap(to_doc) - history = extend(".. %s\n" % text_target, to_doc) + # print history + history = extend(".. %s\n" % text_target, to_doc, history) + # print history open(history_path, "w").write(history.encode("utf-8")) def _text_target(github, pull_request): labels = [] + pr_number = None + if isinstance(pull_request, basestring): + pr_number = pull_request + else: + pr_number = pull_request.number + try: - labels = github.issues.labels.list_by_issue(int(pull_request.number), user=PROJECT_OWNER, repo=PROJECT_NAME) + labels = github.issues.labels.list_by_issue(int(pr_number), user=PROJECT_OWNER, repo=PROJECT_NAME) except Exception as e: print e is_bug = is_enhancement = is_feature = is_minor = is_major = is_merge = is_small_enhancement = False + if len(labels) == 0: + print 'No labels found for %s' % pr_number + return None for label in labels: label_name = label.name.lower() if label_name == "minor": @@ -542,7 +559,7 @@ def _text_target(github, pull_request): elif is_bug: text_target = "bug" else: - print "Logic problem, cannot determine section for %s" % pull_request + print "Logic problem, cannot determine section for %s" % _pr_to_str(pull_request) text_target = None return text_target From 70c65f6bd26207de001d01f7827255d5368ca18d Mon Sep 17 00:00:00 2001 From: Martin Cech Date: Mon, 16 May 2016 15:58:21 -0400 Subject: [PATCH 2/2] remove prints --- scripts/bootstrap_history.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/bootstrap_history.py b/scripts/bootstrap_history.py index b5a228b0d76..77e924b9a94 100644 --- a/scripts/bootstrap_history.py +++ b/scripts/bootstrap_history.py @@ -395,7 +395,6 @@ def _get_prs(release_name, state="closed"): def main(argv): - # print argv if requests is None: raise Exception("Requests library not found, please pip install requests") github = _github_client() @@ -498,9 +497,7 @@ def main(argv): to_doc += "{0}_".format(short_rev) to_doc = wrap(to_doc) - # print history history = extend(".. %s\n" % text_target, to_doc, history) - # print history open(history_path, "w").write(history.encode("utf-8"))