]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Modernize executable path handling in code formatting script 18460/head
authorEmmanuel Ferdman <emmanuelferdman@gmail.com>
Fri, 16 May 2025 23:12:49 +0000 (16:12 -0700)
committerEmmanuel Ferdman <emmanuelferdman@gmail.com>
Fri, 16 May 2025 23:12:49 +0000 (16:12 -0700)
Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
contrib/utilities/indent.py

index 6d4a9571eeb979d7fb2d99d5154bbdb9b30e8dac..6b799bf9bf05402dad22933899da5aa5ed321a4d 100755 (executable)
@@ -57,8 +57,7 @@ from __future__ import print_function
 
 import argparse
 import time
-import distutils.spawn
-import distutils.file_util
+import shutil
 
 import filecmp
 import fnmatch
@@ -99,7 +98,7 @@ def parse_arguments():
         "-b",
         "--clang-format-binary",
         metavar="PATH",
-        default=distutils.spawn.find_executable("clang-format"),
+        default=shutil.which("clang-format"),
     )
 
     parser.add_argument(
@@ -321,9 +320,7 @@ if __name__ == "__main__":
         os.environ["PATH"] += (
             ":" + os.getcwd() + "/contrib/utilities/programs/clang-16/bin"
         )
-        PARSED_ARGUMENTS.clang_format_binary = distutils.spawn.find_executable(
-            "clang-format"
-        )
+        PARSED_ARGUMENTS.clang_format_binary = shutil.which("clang-format")
 
     #
     # Do not log verbose information on dry-run.

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.