当前位置: 首页>>代码示例>>Python>>正文


Python Command.warn方法代码示例

本文整理汇总了Python中distutils.core.Command.warn方法的典型用法代码示例。如果您正苦于以下问题:Python Command.warn方法的具体用法?Python Command.warn怎么用?Python Command.warn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在distutils.core.Command的用法示例。


在下文中一共展示了Command.warn方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: warn

# 需要导入模块: from distutils.core import Command [as 别名]
# 或者: from distutils.core.Command import warn [as 别名]
def warn(self, msg):
        """Counts the number of warnings that occurs."""
        self._warnings += 1
        return Command.warn(self, msg) 
开发者ID:glmcdona,项目名称:meddle,代码行数:6,代码来源:check.py

示例2: check_metadata

# 需要导入模块: from distutils.core import Command [as 别名]
# 或者: from distutils.core.Command import warn [as 别名]
def check_metadata(self):
        """Ensures that all required elements of meta-data are supplied.

        name, version, URL, (author and author_email) or
        (maintainer and maintainer_email)).

        Warns if any are missing.
        """
        metadata = self.distribution.metadata

        missing = []
        for attr in ('name', 'version', 'url'):
            if not (hasattr(metadata, attr) and getattr(metadata, attr)):
                missing.append(attr)

        if missing:
            self.warn("missing required meta-data: %s"  % ', '.join(missing))
        if metadata.author:
            if not metadata.author_email:
                self.warn("missing meta-data: if 'author' supplied, " +
                          "'author_email' must be supplied too")
        elif metadata.maintainer:
            if not metadata.maintainer_email:
                self.warn("missing meta-data: if 'maintainer' supplied, " +
                          "'maintainer_email' must be supplied too")
        else:
            self.warn("missing meta-data: either (author and author_email) " +
                      "or (maintainer and maintainer_email) " +
                      "must be supplied") 
开发者ID:glmcdona,项目名称:meddle,代码行数:31,代码来源:check.py

示例3: check_restructuredtext

# 需要导入模块: from distutils.core import Command [as 别名]
# 或者: from distutils.core.Command import warn [as 别名]
def check_restructuredtext(self):
        """Checks if the long string fields are reST-compliant."""
        data = self.distribution.get_long_description()
        for warning in self._check_rst_data(data):
            line = warning[-1].get('line')
            if line is None:
                warning = warning[1]
            else:
                warning = '%s (line %s)' % (warning[1], line)
            self.warn(warning) 
开发者ID:glmcdona,项目名称:meddle,代码行数:12,代码来源:check.py

示例4: check_restructuredtext

# 需要导入模块: from distutils.core import Command [as 别名]
# 或者: from distutils.core.Command import warn [as 别名]
def check_restructuredtext(self):
        """Checks if the long string fields are reST-compliant."""
        data = self.distribution.get_long_description()
        if not isinstance(data, unicode):
            data = data.decode(PKG_INFO_ENCODING)
        for warning in self._check_rst_data(data):
            line = warning[-1].get('line')
            if line is None:
                warning = warning[1]
            else:
                warning = '%s (line %s)' % (warning[1], line)
            self.warn(warning) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:14,代码来源:check.py

示例5: check_metadata

# 需要导入模块: from distutils.core import Command [as 别名]
# 或者: from distutils.core.Command import warn [as 别名]
def check_metadata(self):
        """Ensures that all required elements of meta-data are supplied.

        Required fields:
            name, version, URL

        Recommended fields:
            (author and author_email) or (maintainer and maintainer_email))

        Warns if any are missing.
        """
        metadata = self.distribution.metadata

        missing = []
        for attr in ('name', 'version', 'url'):
            if not (hasattr(metadata, attr) and getattr(metadata, attr)):
                missing.append(attr)

        if missing:
            self.warn("missing required meta-data: %s"  % ', '.join(missing))
        if metadata.author:
            if not metadata.author_email:
                self.warn("missing meta-data: if 'author' supplied, " +
                          "'author_email' should be supplied too")
        elif metadata.maintainer:
            if not metadata.maintainer_email:
                self.warn("missing meta-data: if 'maintainer' supplied, " +
                          "'maintainer_email' should be supplied too")
        else:
            self.warn("missing meta-data: either (author and author_email) " +
                      "or (maintainer and maintainer_email) " +
                      "should be supplied") 
开发者ID:pypa,项目名称:setuptools,代码行数:34,代码来源:check.py


注:本文中的distutils.core.Command.warn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。