當前位置: 首頁>>代碼示例>>Python>>正文


Python exceptions.CommandError方法代碼示例

本文整理匯總了Python中pip.exceptions.CommandError方法的典型用法代碼示例。如果您正苦於以下問題:Python exceptions.CommandError方法的具體用法?Python exceptions.CommandError怎麽用?Python exceptions.CommandError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pip.exceptions的用法示例。


在下文中一共展示了exceptions.CommandError方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: check_required_packages

# 需要導入模塊: from pip import exceptions [as 別名]
# 或者: from pip.exceptions import CommandError [as 別名]
def check_required_packages(self):
        import_or_raise(
            'wheel.bdist_wheel',
            CommandError,
            "'pip wheel' requires the 'wheel' package. To fix this, run: "
            "pip install wheel"
        )
        pkg_resources = import_or_raise(
            'pkg_resources',
            CommandError,
            "'pip wheel' requires setuptools >= 0.8 for dist-info support."
            " To fix this, run: pip install --upgrade setuptools"
        )
        if not hasattr(pkg_resources, 'DistInfoDistribution'):
            raise CommandError(
                "'pip wheel' requires setuptools >= 0.8 for dist-info "
                "support. To fix this, run: pip install --upgrade "
                "setuptools"
            ) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:21,代碼來源:wheel.py

示例2: run

# 需要導入模塊: from pip import exceptions [as 別名]
# 或者: from pip.exceptions import CommandError [as 別名]
def run(self, options, args):
        from pip.commands import commands_dict, get_similar_commands

        try:
            # 'pip help' with no args is handled by pip.__init__.parseopt()
            cmd_name = args[0]  # the command we need help for
        except IndexError:
            return SUCCESS

        if cmd_name not in commands_dict:
            guess = get_similar_commands(cmd_name)

            msg = ['unknown command "%s"' % cmd_name]
            if guess:
                msg.append('maybe you meant "%s"' % guess)

            raise CommandError(' - '.join(msg))

        command = commands_dict[cmd_name]()
        command.parser.print_help()

        return SUCCESS 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:24,代碼來源:help.py

示例3: run

# 需要導入模塊: from pip import exceptions [as 別名]
# 或者: from pip.exceptions import CommandError [as 別名]
def run(self, options, args):
        from pip.commands import commands, get_similar_commands

        try:
            # 'pip help' with no args is handled by pip.__init__.parseopt()
            cmd_name = args[0]  # the command we need help for
        except IndexError:
            return SUCCESS

        if cmd_name not in commands:
            guess = get_similar_commands(cmd_name)

            msg = ['unknown command "%s"' % cmd_name]
            if guess:
                msg.append('maybe you meant "%s"' % guess)

            raise CommandError(' - '.join(msg))

        command = commands[cmd_name]()
        command.parser.print_help()

        return SUCCESS 
開發者ID:aliyun,項目名稱:oss-ftp,代碼行數:24,代碼來源:help.py

示例4: run

# 需要導入模塊: from pip import exceptions [as 別名]
# 或者: from pip.exceptions import CommandError [as 別名]
def run(self, options, args):
        if not args:
            raise CommandError('Missing required argument (search query).')
        query = args
        index_url = options.index

        pypi_hits = self.search(query, index_url)
        hits = transform_hits(pypi_hits)

        terminal_width = None
        if sys.stdout.isatty():
            terminal_width = get_terminal_size()[0]

        print_results(hits, terminal_width=terminal_width)
        if pypi_hits:
            return SUCCESS
        return NO_MATCHES_FOUND 
開發者ID:aliyun,項目名稱:oss-ftp,代碼行數:19,代碼來源:search.py


注:本文中的pip.exceptions.CommandError方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。