mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Comparison made by distutils.version.LooseVersion
This commit is contained in:
parent
e7166bbc08
commit
df1c46974d
@ -80,7 +80,9 @@ a comma-separated list of group names.
|
||||
.. doctest::
|
||||
:pyversion: > 3.3
|
||||
|
||||
The supported operands are ``<``, ``<=``, ``==``, ``>=``, and ``>``.
|
||||
The supported operands are ``<``, ``<=``, ``==``, ``>=``, ``>``, and
|
||||
comparison is performed by `distutils.version.LooseVersion
|
||||
<https://www.python.org/dev/peps/pep-0386/#distutils>`__.
|
||||
|
||||
.. versionadded:: 1.5
|
||||
|
||||
|
@ -20,7 +20,7 @@ from os import path
|
||||
import doctest
|
||||
|
||||
from six import itervalues, StringIO, binary_type, text_type, PY2
|
||||
from distutils.version import StrictVersion
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from docutils import nodes
|
||||
from docutils.parsers.rst import Directive, directives
|
||||
@ -70,8 +70,8 @@ def compare_version(ver1, ver2, operand):
|
||||
"""
|
||||
if operand not in ('<=', '<', '==', '>=', '>'):
|
||||
raise ValueError("'%s' is not a valid operand.")
|
||||
v1 = StrictVersion(ver1)
|
||||
v2 = StrictVersion(ver2)
|
||||
v1 = LooseVersion(ver1)
|
||||
v2 = LooseVersion(ver2)
|
||||
return ((operand == '<=' and (v1 <= v2)) or
|
||||
(operand == '<' and (v1 < v2)) or
|
||||
(operand == '==' and (v1 == v2)) or
|
||||
|
Loading…
Reference in New Issue
Block a user