view python/lsexts.py @ 446:95afeaf9c42d

-> http://k0s.org/portfolio/ideas/install_software_trifecta.txt
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 09 Aug 2013 16:28:20 -0700
parents 081614c468b8
children 5f186e65da09
line wrap: on
line source

#!/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