本文整理匯總了Python中django.utils.version.get_version_tuple方法的典型用法代碼示例。如果您正苦於以下問題:Python version.get_version_tuple方法的具體用法?Python version.get_version_tuple怎麽用?Python version.get_version_tuple使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類django.utils.version
的用法示例。
在下文中一共展示了version.get_version_tuple方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: check_django_compatability
# 需要導入模塊: from django.utils import version [as 別名]
# 或者: from django.utils.version import get_version_tuple [as 別名]
def check_django_compatability():
"""
Verify that this version of django-cockroachdb is compatible with the
installed version of Django. For example, any django-cockroachdb 2.2.x is
compatible with Django 2.2.y.
"""
from . import __version__
if django.VERSION[:2] != get_version_tuple(__version__)[:2]:
raise ImproperlyConfigured(
'You must use the latest version of django-cockroachdb {A}.{B}.x '
'with Django {A}.{B}.y (found django-cockroachdb {C}).'.format(
A=django.VERSION[0],
B=django.VERSION[1],
C=__version__,
)
)
示例2: psycopg2_version
# 需要導入模塊: from django.utils import version [as 別名]
# 或者: from django.utils.version import get_version_tuple [as 別名]
def psycopg2_version():
version = psycopg2.__version__.split(' ', 1)[0]
return get_version_tuple(version)
示例3: geos_version_tuple
# 需要導入模塊: from django.utils import version [as 別名]
# 或者: from django.utils.version import get_version_tuple [as 別名]
def geos_version_tuple():
"""Return the GEOS version as a tuple (major, minor, subminor)."""
return get_version_tuple(geos_version().decode())
示例4: test_get_version_tuple
# 需要導入模塊: from django.utils import version [as 別名]
# 或者: from django.utils.version import get_version_tuple [as 別名]
def test_get_version_tuple(self):
self.assertEqual(get_version_tuple('1.2.3'), (1, 2, 3))
self.assertEqual(get_version_tuple('1.2.3b2'), (1, 2, 3))
self.assertEqual(get_version_tuple('1.2.3b2.dev0'), (1, 2, 3))