當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。