Mercurial > hg-stable
changeset 49507:35bf7f23b84c
run-tests: deal with distutil deprecation
PEP 632 recommend the use of `packaging.version` to replace the deprecated
`distutil.version`. So lets do it.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 22 Sep 2022 01:48:02 +0200 |
parents | 59a72267f5ce |
children | 1baf0fffd82f |
files | tests/run-tests.py |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/run-tests.py Fri Sep 09 12:45:26 2022 -0700 +++ b/tests/run-tests.py Thu Sep 22 01:48:02 2022 +0200 @@ -48,7 +48,7 @@ import collections import contextlib import difflib -import distutils.version as version + import errno import functools import json @@ -72,6 +72,13 @@ import uuid import xml.dom.minidom as minidom +try: + # PEP 632 recommend the use of `packaging.version` to replace the + # deprecated `distutil.version`. So lets do it. + import packaging.version as version +except ImportError: + import distutils.version as version + if sys.version_info < (3, 5, 0): print( '%s is only supported on Python 3.5+, not %s'