'Return true for directories that are packages.'

def ispackagedir(self, file):

    if (not os.path.isdir(file)):
        return False
    init = os.path.join(file, '__init__.py')
    return os.path.exists(init)
