From 7f8cb93092640ead96b3da60a6fb8c42eb0c13d9 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 8 Feb 2014 11:08:56 +0000 Subject: [PATCH] mkdist script tweaks to support releasing from any named branch --- Tools/mkdist.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Tools/mkdist.py b/Tools/mkdist.py index 234c768f2..2e69dbece 100755 --- a/Tools/mkdist.py +++ b/Tools/mkdist.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # This script builds a swig-x.y.z distribution. -# Usage : mkdist.py version, where version should be x.y.z +# Usage: mkdist.py version branch, where version should be x.y.z and branch is normally 'master' import sys import string @@ -16,10 +16,16 @@ def failed(): try: version = sys.argv[1] dirname = "swig-" + version + branch = sys.argv[2] except: - print "Usage: mkdist.py version, where version should be x.y.z" + print "Usage: mkdist.py version branch, where version should be x.y.z and branch is normally 'master'" sys.exit(1) +if sys.version_info[0:2] < (2, 7): + print "Error: Python 2.7 is required" + sys.exit(3) + + # Check name matches normal unix conventions if string.lower(dirname) != dirname: print "directory name ("+dirname+") should be in lowercase" @@ -38,7 +44,7 @@ os.system("rm -f "+dirname+".tar") # Grab the code from git print "Checking git repository is in sync with remote repository" -os.system("git remote update") == 0 or failed() +os.system("git remote update origin") == 0 or failed() command = ["git", "status", "--porcelain", "-uno"] out = subprocess.check_output(command) if out.strip() != "": @@ -47,7 +53,7 @@ if out.strip() != "": print out sys.exit(3) -command = ["git", "log", "--oneline", "master..origin/master"] +command = ["git", "log", "--oneline", branch + "..origin/" + branch] out = subprocess.check_output(command) if out.strip() != "": print "Remote repository has additional modifications to local repository" @@ -55,7 +61,7 @@ if out.strip() != "": print out sys.exit(3) -command = ["git", "log", "--oneline", "origin/master..master"] +command = ["git", "log", "--oneline", "origin/" + branch + ".." + branch] out = subprocess.check_output(command) if out.strip() != "": print "Local repository has modifications not pushed to the remote repository"