Ajout script mise a jour de tracker
authorCyril Robert <Cyril Robert cyrilrbt@gmail.com>
Thu, 27 May 2010 13:38:17 +0000 (09:38 -0400)
committerCyril Robert <Cyril Robert cyrilrbt@gmail.com>
Thu, 27 May 2010 13:38:17 +0000 (09:38 -0400)
scripts/update_tracker.py [new file with mode: 0755]

diff --git a/scripts/update_tracker.py b/scripts/update_tracker.py
new file mode 100755 (executable)
index 0000000..47b1b89
--- /dev/null
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+
+import sys, os, shutil, glob
+
+
+
+
+def usage():
+    print "Usage: %s <template_path> <tracker_path>" % sys.argv[0]
+    print "  template_path: Path to the roundup template used by the tracker"
+    print "  tracker_path: Path to the tracker you want to update"
+
+if __name__ == "__main__":
+    if len (sys.argv) == 3:
+        paths = {'template': os.path.abspath(sys.argv[1]),
+                 'tracker': os.path.abspath(sys.argv[2])}
+
+        print "Updating"
+        print "Template:", paths['template']
+        print "Tracker:", paths['tracker']
+        print
+
+        targets = ['html', 'detectors', 'extensions']
+
+        for directory in targets:
+            print "updating", directory
+            source = os.path.join(paths['template'], directory)
+            dest = os.path.join(paths['tracker'], directory)
+
+            if os.path.exists(source) and os.path.exists(dest):
+                for file in glob.glob(os.path.join(source, "*")):
+                    shutil.copy(file, dest)
+            else:
+                print directory, "not found, skipping"
+
+        print
+        print "done"
+        
+    else:
+        usage()