Skip to content

Commit

Permalink
Merge branch 'release-2.0-nightly' into release-2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidZemon committed Mar 30, 2014
2 parents cb5fef2 + 17ef464 commit d997e35
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 21 deletions.
53 changes: 36 additions & 17 deletions util/createBinaryDistr.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#/usr/bin/python
#!/usr/bin/python
# @file createBinaryDistr.py
# @author David Zemon
# @project PropWare
Expand All @@ -17,6 +17,7 @@
import subprocess
from time import sleep
from shutil import copy2
import argparse

from propwareImporter import importAll
import propwareUtils
Expand All @@ -29,13 +30,12 @@ class CreateBinaryDistr:
"jpg", "lang", "pdf", "png"]
BLACKLISTED_DIRECTORIES = ["docs", ".idea", ".settings", ".git", propwareUtils.DOWNLOADS_DIRECTORY]
BRANCHES = ["master", "development", "release-2.0", "release-2.0-nightly"]
TAGS = ["v1.1", "v1.2", "v2.0-beta1"]
CURRENT_SUGGESTION = "release-2.0"

def __init__(self):
CreateBinaryDistr.BRANCHES.sort()
self.successes = []

def run(self):
propwareUtils.checkProperWorkingDirectory()

# Import all extra libraries
Expand All @@ -45,22 +45,29 @@ def run(self):
os.chdir("..")
CreateBinaryDistr.cleanOldArchives()

def run(self, branches, areTags=False):
assert (isinstance(branches, list))
assert (isinstance(areTags, bool))

branches.sort()
self.successes = []

try:
for branch in CreateBinaryDistr.BRANCHES:
self.runInBranch(branch)
for branch in branches:
self.runInBranch(branch, areTags)
except Exception as e:
print(e, file=sys.stderr)
finally:
CreateBinaryDistr.attemptCleanExit()

self.printSummary()
self.printSummary(branches)

def runInBranch(self, branch):
def runInBranch(self, branch, isTag):
# Clean any leftover crud
CreateBinaryDistr.clean()

# Attempt to checkout the next branch
if 0 == CreateBinaryDistr.checkout(branch):
if 0 == CreateBinaryDistr.checkout(branch, isTag):
# Compile the static libraries and example projects
CreateBinaryDistr.compile()

Expand Down Expand Up @@ -111,18 +118,21 @@ def clean():
raise e

@staticmethod
def checkout(branch):
def checkout(branch, isTag=False):
assert (isinstance(isTag, bool))

try:
subprocess.check_output(["git", "checkout", branch])
except subprocess.CalledProcessError:
print("Failed to checkout " + branch, file=sys.stderr)
return 1

try:
subprocess.check_output(["git", "pull"])
except subprocess.CalledProcessError:
print("Failed to pull latest sources", file=sys.stderr)
return 1
if not isTag:
try:
subprocess.check_output(["git", "pull"])
except subprocess.CalledProcessError:
print("Failed to pull latest sources", file=sys.stderr)
return 1

return 0

Expand Down Expand Up @@ -154,15 +164,15 @@ def attemptCleanExit():
print("Caused by: " + str(e), file=sys.stderr)
print(e.output.decode(), file=sys.stderr)

def printSummary(self):
def printSummary(self, branches):
# Let the stdout and stderr buffers catch up
sleep(1)

print("\n\nSummary:")
self.successes.sort()
for branch in self.successes:
print("\tPASS: " + branch)
for branch in CreateBinaryDistr.BRANCHES:
for branch in branches:
if branch not in self.successes:
print("\tFAIL: " + branch)

Expand All @@ -176,5 +186,14 @@ def __str__(self):


if "__main__" == __name__:
parser = argparse.ArgumentParser(description="Create binary distributions of all branches (and optionally tags too)"
" of PropWare")
parser.add_argument("--tags", action="store_true",
help="Create binary distributions for all tagged commits as well")
args = parser.parse_args()

runMe = CreateBinaryDistr()
runMe.run()
runMe.run(CreateBinaryDistr.BRANCHES)

if args.tags:
runMe.run(CreateBinaryDistr.TAGS, True)
2 changes: 1 addition & 1 deletion util/importLibpropeller.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#/usr/bin/python
#!/usr/bin/python
# @file importLibpropeller.py
# @author David Zemon
# @project PropWare
Expand Down
2 changes: 1 addition & 1 deletion util/propgcc-map-sizes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#/usr/bin/python
#!/usr/bin/python
# File: ${file}
# Author: David Zemon
# Project: PropWare
Expand Down
2 changes: 1 addition & 1 deletion util/propwareImporter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#/usr/bin/python
#!/usr/bin/python
# File: ${file}
# Author: David Zemon
# Project: PropWare
Expand Down
2 changes: 1 addition & 1 deletion util/propwareUtils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#/usr/bin/python
#!/usr/bin/python
# File: ${file}
# Author: David Zemon
# Project: PropWare
Expand Down

0 comments on commit d997e35

Please sign in to comment.