Commit | Line | Data |
---|---|---|
d1d172be CR |
1 | #!/usr/bin/env python |
2 | # -*- encoding: utf-8 -*- | |
3 | ||
4 | import sys, os, shutil, glob | |
5 | ||
6 | ||
7 | ||
8 | ||
9 | def usage(): | |
10 | print "Usage: %s <template_path> <tracker_path>" % sys.argv[0] | |
11 | print " template_path: Path to the roundup template used by the tracker" | |
12 | print " tracker_path: Path to the tracker you want to update" | |
13 | ||
14 | if __name__ == "__main__": | |
15 | if len (sys.argv) == 3: | |
16 | paths = {'template': os.path.abspath(sys.argv[1]), | |
17 | 'tracker': os.path.abspath(sys.argv[2])} | |
18 | ||
19 | print "Updating" | |
20 | print "Template:", paths['template'] | |
21 | print "Tracker:", paths['tracker'] | |
22 | ||
23 | ||
24 | targets = ['html', 'detectors', 'extensions'] | |
25 | ||
26 | for directory in targets: | |
27 | print "updating", directory | |
28 | source = os.path.join(paths['template'], directory) | |
29 | dest = os.path.join(paths['tracker'], directory) | |
30 | ||
31 | if os.path.exists(source) and os.path.exists(dest): | |
32 | for file in glob.glob(os.path.join(source, "*")): | |
33 | shutil.copy(file, dest) | |
34 | else: | |
35 | print directory, "not found, skipping" | |
36 | ||
37 | ||
38 | print "done" | |
39 | ||
40 | else: | |
41 | usage() |