Skip to content

Commit 4722707

Browse files
authored
Replace distutils.find_executable() with shutil.which()
Python version 3.12 has removed distutils.
1 parent 455c5bd commit 4722707

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

language_tool_python/download_lt.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from typing import Optional
1414
import zipfile
1515

16-
from distutils.spawn import find_executable
16+
from shutil import which
1717
from urllib.parse import urljoin
1818
from .utils import (
1919
find_existing_language_tool_downloads,
@@ -42,7 +42,6 @@
4242
r'^(?:java|openjdk) [version ]?(?P<major1>\d+)\.(?P<major2>\d+)',
4343
re.MULTILINE)
4444

45-
4645
def parse_java_version(version_text):
4746
"""Return Java version (major1, major2).
4847
@@ -74,7 +73,7 @@ def parse_java_version(version_text):
7473

7574
def confirm_java_compatibility():
7675
""" Confirms Java major version >= 8. """
77-
java_path = find_executable('java')
76+
java_path = which('java')
7877
if not java_path:
7978
raise ModuleNotFoundError(
8079
'No java install detected. '

0 commit comments

Comments
 (0)