(directory, filename)
return packages
should walk up the tree until there is no __init__.py
should walk up the tree until there is no __init__.py
should walk up the tree until there is no __init__ . py
def findRootPackageList(directory, filename):
    "should walk up the tree until there is no __init__.py"
    isPackage = lambda path: os.path.exists(os.path.join(path, '__init__.py'))
    if not isPackage(directory):
        return []
    packages = []
    while directory and isPackage(directory):
        directory, tail = os.path.split(directory)
        if tail:
            packages.append(tail)
    packages.reverse()
    return packages
def findRootPackageList ( directory , filename ) : isPackage = lambda path : os . path . exists ( os . path . join ( path , '__init__.py' ) ) if not isPackage ( directory ) : return [ ] packages = [ ] while directory and isPackage ( directory ) : directory , tail = os . path . split ( directory ) if tail : packages . append ( tail ) packages . reverse ( ) return packages