# HG changeset patch # User Pierre-Yves David # Date 2022-09-21 23:48:02 # Node ID 35bf7f23b84cfcb3f7c18119230fb3556b5beda2 # Parent 59a72267f5ce0ae5e3612a35b6b4c08e11bba46a run-tests: deal with distutil deprecation PEP 632 recommend the use of `packaging.version` to replace the deprecated `distutil.version`. So lets do it. diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -48,7 +48,7 @@ import argparse import collections import contextlib import difflib -import distutils.version as version + import errno import functools import json @@ -72,6 +72,13 @@ import unittest 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'