예제 #1
0
파일: scaffold.py 프로젝트: NixePix/gearbox
    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)
예제 #2
0
파일: main.py 프로젝트: alexbodn/gearbox
    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)
예제 #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)