changeset 175:081614c468b8

add a file for listing extensions
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 25 Oct 2011 20:00:27 -0700
parents 492ec7e2d46e
children b91750a108b2
files python/lsexts.py
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/python/lsexts.py	Tue Oct 25 20:00:27 2011 -0700
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+import os
+
+def extensions(*filenames):
+    return set([os.path.splitext(f)[-1] for f in filenames
+                if '.' in f])
+
+def find_extensions(*directories):
+    _extensions = set()
+    for directory in directories:
+        for _, _, fnames in os.walk(directory):
+            _extensions.update(extensions(*fnames))
+    return _extensions
+        
+if __name__ == '__main__':
+    import sys
+    for ext in sorted(find_extensions(*sys.argv[1:])):
+        print ext