comparison python/lsexts.py @ 175:081614c468b8

add a file for listing extensions
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 25 Oct 2011 20:00:27 -0700
parents
children 5f186e65da09
comparison
equal deleted inserted replaced
174:492ec7e2d46e 175:081614c468b8
1 #!/usr/bin/env python
2
3 import os
4
5 def extensions(*filenames):
6 return set([os.path.splitext(f)[-1] for f in filenames
7 if '.' in f])
8
9 def find_extensions(*directories):
10 _extensions = set()
11 for directory in directories:
12 for _, _, fnames in os.walk(directory):
13 _extensions.update(extensions(*fnames))
14 return _extensions
15
16 if __name__ == '__main__':
17 import sys
18 for ext in sorted(find_extensions(*sys.argv[1:])):
19 print ext