#! /usr/bin/env python

from abjad.tools import iotools
import os


def find_nontrivial_subdirectories():
   for d in os.listdir('.'):
      subdirectories = [ ]
      if d[0].isupper():
         try:
            for x in os.listdir(d):
               element = os.path.join(d, x)
               if os.path.isdir(element):
                  if not '.svn' in element:
                     if not 'test' in element:
                        subdirectories.append(element)
         except OSError:
            pass
      if subdirectories:
         print d
         print '\t%s' % subdirectories
         print ''


if __name__ == '__main__':
   iotools.clear_terminal()
   print 'Finding nontrivial subdirectories ...'
   print ''
   find_nontrivial_subdirectories()
