Beispiel #1
0
    def _find_toplevel_packages(self):
        egg_info_dir = find_egg_info_dir(os.getcwd())
        if egg_info_dir is None:
            print('Unable to find distribution egg-info, did you run setup.py egg_info or develop?')
            return []

        modules = os.path.join(egg_info_dir, 'top_level.txt')
        try:
            modules = open(modules).readlines()
        except:
            print('Unable to detect distribution top level packages.')
            return []

        modules = map(lambda x: x.strip().replace(os.sep, '.'), modules)
        modules = filter(lambda x: not x.startswith('test'), modules)  # Remove test suite modules
        return list(modules)
Beispiel #2
0
    def _load_commands_for_current_dir(self):
        egg_info_dir = find_egg_info_dir(os.getcwd())
        if egg_info_dir:
            package_name = os.path.splitext(os.path.basename(egg_info_dir))[0]

            try:
                pkg_resources.require(package_name)
            except pkg_resources.DistributionNotFound as e:
                msg = '%sNot Found%s: %s (is it an installed Distribution?)'
                if str(e) != package_name:
                    raise pkg_resources.DistributionNotFound(msg % (str(e) + ': ', ' for', package_name))
                else:
                    raise pkg_resources.DistributionNotFound(msg % ('', '', package_name))

            dist = pkg_resources.get_distribution(package_name)
            for epname, ep in dist.get_entry_map('gearbox.plugins').items():
                self.load_commands_for_package(ep.module_name)
Beispiel #3
0
    def _load_commands_for_current_dir(self):
        egg_info_dir = find_egg_info_dir(os.getcwd())
        if egg_info_dir:
            package_name = os.path.splitext(os.path.basename(egg_info_dir))[0]

            try:
                pkg_resources.require(package_name)
            except pkg_resources.DistributionNotFound as e:
                msg = '%sNot Found%s: %s (is it an installed Distribution?)'
                if str(e) != package_name:
                    raise pkg_resources.DistributionNotFound(
                        msg % (str(e) + ': ', ' for', package_name))
                else:
                    raise pkg_resources.DistributionNotFound(
                        msg % ('', '', package_name))

            dist = pkg_resources.get_distribution(package_name)
            for epname, ep in dist.get_entry_map('gearbox.plugins').items():
                self.load_commands_for_package(ep.module_name)