Mercurial > hg > config
comparison python/randomize.py @ 0:f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
author | k0s <k0scist@gmail.com> |
---|---|
date | Thu, 15 Oct 2009 11:41:26 -0400 |
parents | |
children | 12299cbc45ee |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f3ab51c79813 |
---|---|
1 #!/usr/bin/env python | |
2 | |
3 import os | |
4 import random | |
5 import subprocess | |
6 import sys | |
7 | |
8 from optparse import OptionParser | |
9 | |
10 if __name__ == '__main__': | |
11 parser = OptionParser() | |
12 parser.add_option("-e", "--exec", dest="callable", | |
13 help="program to execute") | |
14 (options, argv) = parser.parse_args() | |
15 args = [] | |
16 for i in argv: | |
17 if os.path.isdir(i): | |
18 for root, dirs, files in os.walk(i): | |
19 args.extend([os.path.join(root, f) for f in files]) | |
20 else: | |
21 args.append(i) | |
22 random.shuffle(args) | |
23 if options.callable: | |
24 for i in args: | |
25 subprocess.call([options.callable, i]) | |
26 else: | |
27 print '\n'.join(args) |