Skip to content

Commit

Permalink
[nggb] Make activation script perform 'git add'.
Browse files Browse the repository at this point in the history
git-svn-id: https://valelab.ucsf.edu/svn/micromanager2/trunk@13209 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd
  • Loading branch information
mark committed Apr 22, 2014
1 parent 0e3df24 commit 9fb0172
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions buildscripts/nextgen-gnubuild/activate.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
import sys


def activate(initial=True):
def activate(initial=True, git_add=False):
all_deletes, all_renames = [], []
for nextgen_filename in iterate_nextgen_files():
print("reading " + nextgen_filename)
Expand All @@ -74,7 +74,12 @@ def activate(initial=True):
if all_deletes:
print("delete files: " + " ".join(all_deletes))
for filename in all_deletes:
os.unlink(filename)
if git_add:
subprocess.call("cd '{}'; git rm '{}'".
format(*os.path.split(filename)),
shell=True)
else:
os.unlink(filename)

umask = os.umask(0o777); os.umask(umask)
for src, dst, mode in all_renames:
Expand All @@ -86,6 +91,10 @@ def activate(initial=True):
print("copy", src, "->", dst, "(0{:03o})".format(masked_mode))
copy_for_activation(src, dst)
os.chmod(dst, masked_mode)
if git_add:
subprocess.call("cd '{}'; git add '{}'".
format(*os.path.split(dst)),
shell=True)
else:
print("up to date: " + dst + " (from " + src + ")")
else:
Expand Down Expand Up @@ -279,18 +288,22 @@ def ngize(filename, header=None):
def run():
p = argparse.ArgumentParser()
p.add_argument("-a", "--activate", action="store_true")
p.add_argument("-A", "--activate-and-git-add", action="store_true")
p.add_argument("-r", "--reactivate", action="store_true")
p.add_argument("-d", "--deactivate", action="store_true")
p.add_argument("-s", "--sum", nargs="+")
p.add_argument("-n", "--ngize", nargs="+")
p.add_argument("-H", "--header", nargs=1)
args = p.parse_args()
if sum(1 for _ in filter(None, [args.activate, args.reactivate,
args.activate_and_git_add,
args.deactivate, args.sum, args.ngize])) > 1:
print("multiple verbs not allowed")
sys.exit(1)
if args.activate:
activate()
elif args.activate_and_git_add:
activate(git_add=True)
elif args.reactivate:
activate(False)
elif args.deactivate:
Expand Down

0 comments on commit 9fb0172

Please sign in to comment.