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


Python version.LegacyVersion方法代碼示例

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


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

示例1: _parse_version

# 需要導入模塊: from setuptools.extern.packaging import version [as 別名]
# 或者: from setuptools.extern.packaging.version import LegacyVersion [as 別名]
def _parse_version(self, value):
        """Parses `version` option value.

        :param value:
        :rtype: str

        """
        version = self._parse_file(value)

        if version != value:
            version = version.strip()
            # Be strict about versions loaded from file because it's easy to
            # accidentally include newlines and other unintended content
            if isinstance(parse(version), LegacyVersion):
                tmpl = (
                    'Version loaded from {value} does not '
                    'comply with PEP 440: {version}'
                )
                raise DistutilsOptionError(tmpl.format(**locals()))

            return version

        version = self._parse_attr(value, self.package_dir)

        if callable(version):
            version = version()

        if not isinstance(version, string_types):
            if hasattr(version, '__iter__'):
                version = '.'.join(map(str, version))
            else:
                version = '%s' % version

        return version 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:36,代碼來源:config.py

示例2: msvc14_gen_lib_options

# 需要導入模塊: from setuptools.extern.packaging import version [as 別名]
# 或者: from setuptools.extern.packaging.version import LegacyVersion [as 別名]
def msvc14_gen_lib_options(*args, **kwargs):
    """
    Patched "distutils._msvccompiler.gen_lib_options" for fix
    compatibility between "numpy.distutils" and "distutils._msvccompiler"
    (for Numpy < 1.11.2)
    """
    if "numpy.distutils" in sys.modules:
        import numpy as np
        if LegacyVersion(np.__version__) < LegacyVersion('1.11.2'):
            return np.distutils.ccompiler.gen_lib_options(*args, **kwargs)
    return get_unpatched(msvc14_gen_lib_options)(*args, **kwargs) 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:13,代碼來源:msvc.py

示例3: _parse_version

# 需要導入模塊: from setuptools.extern.packaging import version [as 別名]
# 或者: from setuptools.extern.packaging.version import LegacyVersion [as 別名]
def _parse_version(self, value):
        """Parses `version` option value.

        :param value:
        :rtype: str

        """
        version = self._parse_file(value)

        if version != value:
            version = version.strip()
            # Be strict about versions loaded from file because it's easy to
            # accidentally include newlines and other unintended content
            if isinstance(parse(version), LegacyVersion):
                raise DistutilsOptionError('Version loaded from %s does not comply with PEP 440: %s' % (
                    value, version
                ))
            return version

        version = self._parse_attr(value, self.package_dir)

        if callable(version):
            version = version()

        if not isinstance(version, string_types):
            if hasattr(version, '__iter__'):
                version = '.'.join(map(str, version))
            else:
                version = '%s' % version

        return version 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:33,代碼來源:config.py


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