Skip to content

Commit

Permalink
Remove use of distutils
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nakulj authored and google-java-format Team committed Nov 15, 2021
1 parent 7edc048 commit 5bd619d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/google-java-format-diff.py
Expand Up @@ -33,7 +33,7 @@
import subprocess
import io
import sys
from distutils.spawn import find_executable
from shutil import which

def main():
parser = argparse.ArgumentParser(description=
Expand Down Expand Up @@ -105,7 +105,7 @@ def main():
elif args.google_java_format_jar:
base_command = ['java', '-jar', args.google_java_format_jar]
else:
binary = find_executable('google-java-format') or '/usr/bin/google-java-format'
binary = which('google-java-format') or '/usr/bin/google-java-format'
base_command = [binary]

# Reformat files containing changes in place.
Expand Down

0 comments on commit 5bd619d

Please sign in to comment.