Skip to content

Commit

Permalink
Update release script to python3
Browse files Browse the repository at this point in the history
  • Loading branch information
dhleong committed Mar 20, 2021
1 parent b7783e9 commit e27ce9a
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions release.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Release script for spade
#

from collections import OrderedDict

# pylint: disable=unused-wildcard-import,wildcard-import
try:
from hostage import * #pylint: disable=unused-wildcard-import,wildcard-import
from hostage import *
except ImportError:
print "!! Release library unavailable."
print "!! Use `pip install hostage` to fix."
print "!! You will also need an API token in .github.token,"
print "!! a .hubrrc config, or `brew install hub` configured."
print "!! A $GITHUB_TOKEN env variable will also work."
print("!! Release library unavailable.")
print("!! Use `pip install hostage` to fix.")
print("!! You will also need an API token in .github.token,")
print("!! a .hubrrc config, or `brew install hub` configured.")
print("!! A $GITHUB_TOKEN env variable will also work.")
exit(1)

#
# Globals
#

notes = File(".last-release-notes")
latestTag = git.Tag.latest()
latestTag = git.Tag.latest(branch = "main")

def formatIssue(issue):
return "- {title} (#{number})\n".format(
Expand Down Expand Up @@ -69,15 +70,15 @@ def buildDefaultNotes(_):
if closedIssues:
for issue in closedIssues:
found = False
for label in labeled.iterkeys():
for label in labeled.keys():
if label in issue.labels:
labeled[label]['content'] += formatIssue(issue)
found = True
break
if not found:
labeled['_default']['content'] += formatIssue(issue)

for labeledIssueInfo in labeled.itervalues():
for labeledIssueInfo in labeled.values():
if labeledIssueInfo['content']:
contents += "\n**{title}**:\n{content}".format(**labeledIssueInfo)

Expand All @@ -92,10 +93,10 @@ def buildDefaultNotes(_):
.filtersTo(RegexFilter('defproject net.dhleong/spade "(.*)"'))
).valueElse(echoAndDie("No version!?"))
if version.endswith("SNAPSHOT"):
print "May not release SNAPSHOT versions (got %s)" % version
print("May not release SNAPSHOT versions (got %s)" % version)
sys.exit(1)
else:
print "Testing version", version
print("Testing version", version)

versionTag = git.Tag(version)

Expand Down Expand Up @@ -130,7 +131,7 @@ def buildDefaultNotes(_):
# Upload to github
#

print "Uploading to Github..."
print("Uploading to Github...")

verify(versionTag).create()
verify(versionTag).push("origin")
Expand All @@ -144,6 +145,6 @@ def buildDefaultNotes(_):

notes.delete()

print "Done! Published %s" % version
print("Done! Published %s" % version)

# flake8: noqa

0 comments on commit e27ce9a

Please sign in to comment.