Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVRO-3977: Use shutil.which instead of distutils #2854

Merged
merged 2 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test-lang-py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
fail-fast: false
matrix:
python:
- '3.12'
- '3.11'
- '3.10'
- '3.9'
Expand Down
15 changes: 7 additions & 8 deletions lang/py/avro/test/test_tether_word_count.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
# limitations under the License.

import collections
import distutils.spawn
import os
import platform
import shutil
Expand Down Expand Up @@ -80,13 +79,13 @@ def _has_java(): # pragma: no coverage
telling you how to install java. This code does additional work around that
to be completely automatic.
"""
if platform.system() == "Darwin":
try:
output = subprocess.check_output("/usr/libexec/java_home", stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
output = e.output
return b"No Java runtime present" not in output
return bool(distutils.spawn.find_executable("java"))
if platform.system() != "Darwin":
return bool(shutil.which("java"))
try:
output = subprocess.check_output("/usr/libexec/java_home", stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
output = e.output
return b"No Java runtime present" not in output


@unittest.skipUnless(_has_java(), "No Java runtime present")
Expand Down
Loading