def _get_all_ns_packages(self):
        """Return sorted list of all package namespaces"""
        pkgs = self.distribution.namespace_packages or []
        return sorted(set(flatten(map(self._pkg_names, pkgs))))
Return sorted list of all package namespaces
product/gradle-plugin/src/main/python/setuptools/namespaces.py