Add support for Python 3.12

Python 3.12 completely removed the builtin `distutils` module. This
commit replaces its use with the `packaging` package, which is an
external dependency, but maintained by the Python developers.

Signed-off-by: Andrew Gunnerson <accounts+gitlab@chiller3.com>
This commit is contained in:
Andrew Gunnerson 2023-11-11 21:18:28 -05:00
parent 2fb8fc4879
commit 679ba6f552
No known key found for this signature in database
5 changed files with 16 additions and 15 deletions

View file

@ -21,7 +21,7 @@ import yaml
import zipfile
import textwrap
from datetime import datetime
from distutils.version import LooseVersion
from packaging.version import Version
from pathlib import Path
from testcommon import TmpCwd, mkdtemp
from unittest import mock
@ -1041,7 +1041,7 @@ class UpdateTest(unittest.TestCase):
javac = config['jarsigner'].replace('jarsigner', 'javac')
v = subprocess.check_output([javac, '-version'], stderr=subprocess.STDOUT)[6:-1].decode('utf-8')
if LooseVersion(v) < LooseVersion('1.8.0_132'):
if Version(v) < Version('1.8.0_132'):
print('SKIPPING: running tests with old Java (' + v + ')')
return