@staticmethod
    def _all_packages(pkg_name):
        while pkg_name:
            yield pkg_name
            pkg_name, sep, child = pkg_name.rpartition('.')
>>> list(install_lib._all_packages('foo.bar.baz'))
dataset/ETHPy150Open chalasr/Flask-P2P/venv/lib/python2.7/site-packages/setuptools/command/install_lib.py/install_lib._all_packages