Skip to content

Commit

Permalink
Update release script for python3, main branch switch
Browse files Browse the repository at this point in the history
  • Loading branch information
dhleong committed Sep 17, 2020
1 parent 8fd90fd commit 5ab0c6b
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions release.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Release script for Judo
#
Expand All @@ -11,19 +11,19 @@
try:
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 sha256(filePath, blockSize=65536):
# borrowed from: https://gist.github.com/rji/b38c7238128edf53a181
Expand Down Expand Up @@ -81,15 +81,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']:
notesContents += "\n**{title}**:\n{content}".format(**labeledIssueInfo)

Expand Down Expand Up @@ -140,22 +140,22 @@ def buildDefaultNotes(_):
# Upload to github
#

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

verify(versionTag).create()
verify(versionTag).push("origin")

gitRelease = github.Release(version)
verify(gitRelease).create(body=releaseNotes)

print "Uploading", jarFile.path
print("Uploading", jarFile.path)
verify(gitRelease).uploadFile(jarFile.path, 'application/octet-stream')

#
# Update homebrew repo
#

print "Updating homebrew..."
print("Updating homebrew...")

jarUrl = 'https://github.com/dhleong/judo/releases/download/%s/judo-%s.jar' % (version, version)
jarSha = sha256(jarFile.path)
Expand All @@ -168,8 +168,8 @@ def buildDefaultNotes(_):
newContents = re.sub('url "[^"]+"', 'url "%s"' % jarUrl, newContents)
newContents = re.sub('sha256 "[^"]+"', 'sha256 "%s"' % jarSha, newContents)

print " url <-", jarUrl
print " sha256 <-", jarSha
print(" url <-", jarUrl)
print(" sha256 <-", jarSha)
commit = 'Update for v%s' % version
verify(formulaFile).write(newContents, commitMessage=commit)

Expand All @@ -179,6 +179,6 @@ def buildDefaultNotes(_):

notes.delete()

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

# flake8: noqa

0 comments on commit 5ab0c6b

Please sign in to comment.