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


Python errors.DistutilsArgError方法代碼示例

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


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

示例1: parse_distutils_args

# 需要導入模塊: from distutils import errors [as 別名]
# 或者: from distutils.errors import DistutilsArgError [as 別名]
def parse_distutils_args(args):
    # type: (List[str]) -> Dict[str, str]
    """Parse provided arguments, returning an object that has the
    matched arguments.

    Any unknown arguments are ignored.
    """
    result = {}
    for arg in args:
        try:
            _, match = _distutils_getopt.getopt(args=[arg])
        except DistutilsArgError:
            # We don't care about any other options, which here may be
            # considered unrecognized since our option list is not
            # exhaustive.
            pass
        else:
            result.update(match.__dict__)
    return result 
開發者ID:pantsbuild,項目名稱:pex,代碼行數:21,代碼來源:distutils_args.py

示例2: finalize_options

# 需要導入模塊: from distutils import errors [as 別名]
# 或者: from distutils.errors import DistutilsArgError [as 別名]
def finalize_options(self):
        orig.install.finalize_options(self)
        if self.root:
            self.single_version_externally_managed = True
        elif self.single_version_externally_managed:
            if not self.root and not self.record:
                raise DistutilsArgError(
                    "You must specify --record or --root when building system"
                    " packages"
                ) 
開發者ID:jpush,項目名稱:jbox,代碼行數:12,代碼來源:install.py

示例3: getopt

# 需要導入模塊: from distutils import errors [as 別名]
# 或者: from distutils.errors import DistutilsArgError [as 別名]
def getopt (self, args=None, object=None):
        """Parse command-line options in args. Store as attributes on object.

        If 'args' is None or not supplied, uses 'sys.argv[1:]'.  If
        'object' is None or not supplied, creates a new OptionDummy
        object, stores option values there, and returns a tuple (args,
        object).  If 'object' is supplied, it is modified in place and
        'getopt()' just returns 'args'; in both cases, the returned
        'args' is a modified copy of the passed-in 'args' list, which
        is left untouched.
        """
        if args is None:
            args = sys.argv[1:]
        if object is None:
            object = OptionDummy()
            created_object = 1
        else:
            created_object = 0

        self._grok_option_table()

        short_opts = string.join(self.short_opts)
        try:
            opts, args = getopt.getopt(args, short_opts, self.long_opts)
        except getopt.error, msg:
            raise DistutilsArgError, msg 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:28,代碼來源:fancy_getopt.py


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