From 8d30c0b1fdbddd848ab407520f32a51e419bad69 Mon Sep 17 00:00:00 2001 From: David Zemon Date: Sat, 29 Mar 2014 22:37:13 -0500 Subject: [PATCH 1/6] Add tags to binary creation script --- util/createBinaryDistr.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/util/createBinaryDistr.py b/util/createBinaryDistr.py index a6160ecc..e3d0da85 100755 --- a/util/createBinaryDistr.py +++ b/util/createBinaryDistr.py @@ -17,6 +17,7 @@ import subprocess from time import sleep from shutil import copy2 +import argparse from propwareImporter import importAll import propwareUtils @@ -29,13 +30,14 @@ 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.0", "v1.1", "v1.2", "v2.0-beta1"] CURRENT_SUGGESTION = "release-2.0" def __init__(self): CreateBinaryDistr.BRANCHES.sort() self.successes = [] - def run(self): + def run(self, branches): propwareUtils.checkProperWorkingDirectory() # Import all extra libraries @@ -46,14 +48,14 @@ def run(self): CreateBinaryDistr.cleanOldArchives() try: - for branch in CreateBinaryDistr.BRANCHES: + for branch in branches: self.runInBranch(branch) except Exception as e: print(e, file=sys.stderr) finally: CreateBinaryDistr.attemptCleanExit() - self.printSummary() + self.printSummary(branches) def runInBranch(self, branch): # Clean any leftover crud @@ -154,7 +156,7 @@ 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) @@ -162,7 +164,7 @@ def printSummary(self): 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) @@ -176,5 +178,13 @@ 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("-t", "--tags", help="Create binary distributions for all tagged commits as well") + args = vars(parser.parse_args()) + runMe = CreateBinaryDistr() - runMe.run() + runMe.run(CreateBinaryDistr.BRANCHES) + + if args["tags"]: + runMe.run(CreateBinaryDistr.TAGS) From 66344ccc4db7920958fb024a65a1ccb5a8445a1b Mon Sep 17 00:00:00 2001 From: David Zemon Date: Sat, 29 Mar 2014 23:15:34 -0500 Subject: [PATCH 2/6] Minor fix to binary creation script --- util/createBinaryDistr.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/util/createBinaryDistr.py b/util/createBinaryDistr.py index e3d0da85..c23139f5 100755 --- a/util/createBinaryDistr.py +++ b/util/createBinaryDistr.py @@ -34,10 +34,8 @@ class CreateBinaryDistr: CURRENT_SUGGESTION = "release-2.0" def __init__(self): - CreateBinaryDistr.BRANCHES.sort() self.successes = [] - def run(self, branches): propwareUtils.checkProperWorkingDirectory() # Import all extra libraries @@ -47,6 +45,11 @@ def run(self, branches): os.chdir("..") CreateBinaryDistr.cleanOldArchives() + def run(self, branches): + assert (isinstance(branches, list)) + branches.sort() + self.successes = [] + try: for branch in branches: self.runInBranch(branch) From d3900f666dbad1e8f92a937c0d990626176e6a8b Mon Sep 17 00:00:00 2001 From: David Zemon Date: Sat, 29 Mar 2014 23:26:59 -0500 Subject: [PATCH 3/6] Add ! to the first line of all the python files; How did I miss that? --- util/createBinaryDistr.py | 2 +- util/importLibpropeller.py | 2 +- util/propgcc-map-sizes.py | 2 +- util/propwareImporter.py | 2 +- util/propwareUtils.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/util/createBinaryDistr.py b/util/createBinaryDistr.py index c23139f5..aee3301a 100755 --- a/util/createBinaryDistr.py +++ b/util/createBinaryDistr.py @@ -1,4 +1,4 @@ -#/usr/bin/python +#!/usr/bin/python # @file createBinaryDistr.py # @author David Zemon # @project PropWare diff --git a/util/importLibpropeller.py b/util/importLibpropeller.py index 004da341..8c95dd96 100755 --- a/util/importLibpropeller.py +++ b/util/importLibpropeller.py @@ -1,4 +1,4 @@ -#/usr/bin/python +#!/usr/bin/python # @file importLibpropeller.py # @author David Zemon # @project PropWare diff --git a/util/propgcc-map-sizes.py b/util/propgcc-map-sizes.py index 39ba569c..416df838 100755 --- a/util/propgcc-map-sizes.py +++ b/util/propgcc-map-sizes.py @@ -1,4 +1,4 @@ -#/usr/bin/python +#!/usr/bin/python # File: ${file} # Author: David Zemon # Project: PropWare diff --git a/util/propwareImporter.py b/util/propwareImporter.py index 21e7f10f..a335096e 100755 --- a/util/propwareImporter.py +++ b/util/propwareImporter.py @@ -1,4 +1,4 @@ -#/usr/bin/python +#!/usr/bin/python # File: ${file} # Author: David Zemon # Project: PropWare diff --git a/util/propwareUtils.py b/util/propwareUtils.py index e9c16c05..4416bf4f 100644 --- a/util/propwareUtils.py +++ b/util/propwareUtils.py @@ -1,4 +1,4 @@ -#/usr/bin/python +#!/usr/bin/python # File: ${file} # Author: David Zemon # Project: PropWare From d4d7b4c3d32b18a9f9287afe464a1048e61a3aeb Mon Sep 17 00:00:00 2001 From: David Zemon Date: Sat, 29 Mar 2014 23:39:38 -0500 Subject: [PATCH 4/6] Fix argument parser --- util/createBinaryDistr.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/util/createBinaryDistr.py b/util/createBinaryDistr.py index aee3301a..55c79598 100755 --- a/util/createBinaryDistr.py +++ b/util/createBinaryDistr.py @@ -183,11 +183,12 @@ 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("-t", "--tags", help="Create binary distributions for all tagged commits as well") - args = vars(parser.parse_args()) + 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(CreateBinaryDistr.BRANCHES) - if args["tags"]: + if args.tags: runMe.run(CreateBinaryDistr.TAGS) From 5ac95655604bfa1b0ddddc4bf1662536ea505f31 Mon Sep 17 00:00:00 2001 From: David Zemon Date: Sat, 29 Mar 2014 23:48:21 -0500 Subject: [PATCH 5/6] Don't try to pull changes after checking out a tag --- util/createBinaryDistr.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/util/createBinaryDistr.py b/util/createBinaryDistr.py index 55c79598..38ccbad5 100755 --- a/util/createBinaryDistr.py +++ b/util/createBinaryDistr.py @@ -45,14 +45,16 @@ def __init__(self): os.chdir("..") CreateBinaryDistr.cleanOldArchives() - def run(self, branches): + def run(self, branches, areTags=False): assert (isinstance(branches, list)) + assert (isinstance(areTags, bool)) + branches.sort() self.successes = [] try: for branch in branches: - self.runInBranch(branch) + self.runInBranch(branch, areTags) except Exception as e: print(e, file=sys.stderr) finally: @@ -60,12 +62,12 @@ def run(self, branches): 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() @@ -116,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 @@ -191,4 +196,4 @@ def __str__(self): runMe.run(CreateBinaryDistr.BRANCHES) if args.tags: - runMe.run(CreateBinaryDistr.TAGS) + runMe.run(CreateBinaryDistr.TAGS, True) From 17ef464a9f5d742e31e83315fadaec064440f6ac Mon Sep 17 00:00:00 2001 From: David Zemon Date: Sat, 29 Mar 2014 23:54:36 -0500 Subject: [PATCH 6/6] v1.0 tag cannot be built, it was a poor release and should be ignored --- util/createBinaryDistr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/createBinaryDistr.py b/util/createBinaryDistr.py index 38ccbad5..cfa5393e 100755 --- a/util/createBinaryDistr.py +++ b/util/createBinaryDistr.py @@ -30,7 +30,7 @@ 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.0", "v1.1", "v1.2", "v2.0-beta1"] + TAGS = ["v1.1", "v1.2", "v2.0-beta1"] CURRENT_SUGGESTION = "release-2.0" def __init__(self):