Skip to content

Commit 5bd619d

Browse files
nakuljgoogle-java-format Team
authored andcommitted
Remove use of distutils
Distutils will be deprecated in python 3.12, see [PEP 632](https://www.python.org/dev/peps/pep-0632/). `shutil.which` is the recommended replacement for `distutils.spawn.find_executable`. Fixes #680 COPYBARA_INTEGRATE_REVIEW=#680 from nakulj:patch-1 48c041a PiperOrigin-RevId: 409989153
1 parent 7edc048 commit 5bd619d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/google-java-format-diff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import subprocess
3434
import io
3535
import sys
36-
from distutils.spawn import find_executable
36+
from shutil import which
3737

3838
def main():
3939
parser = argparse.ArgumentParser(description=
@@ -105,7 +105,7 @@ def main():
105105
elif args.google_java_format_jar:
106106
base_command = ['java', '-jar', args.google_java_format_jar]
107107
else:
108-
binary = find_executable('google-java-format') or '/usr/bin/google-java-format'
108+
binary = which('google-java-format') or '/usr/bin/google-java-format'
109109
base_command = [binary]
110110

111111
# Reformat files containing changes in place.

0 commit comments

Comments
 (0)