From 21ca46c1aa51253856fcff30c0dbc7b0b40d1a1c Mon Sep 17 00:00:00 2001 From: David Spickett Date: Mon, 17 Apr 2023 13:36:03 +0000 Subject: [PATCH] [compiler-rt][ASAN] Replace find_executable with shtuil.which in script distutils is deprecated and shutil.which is the suggested replacement for this function. https://peps.python.org/pep-0632/#migration-advice https://docs.python.org/3/library/shutil.html#shutil.which which was added in 3.3 (https://docs.python.org/3/library/shutil.html#shutil.which) and LLVM requires at least 3.6 (https://llvm.org/docs/GettingStarted.html#software). Reviewed By: delcypher, vitalybuka Differential Revision: https://reviews.llvm.org/D148528 --- compiler-rt/lib/asan/scripts/asan_symbolize.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler-rt/lib/asan/scripts/asan_symbolize.py b/compiler-rt/lib/asan/scripts/asan_symbolize.py index 4d5312858fdb..1e8540f0bf95 100755 --- a/compiler-rt/lib/asan/scripts/asan_symbolize.py +++ b/compiler-rt/lib/asan/scripts/asan_symbolize.py @@ -26,9 +26,9 @@ import getopt import logging import os import re +import shutil import subprocess import sys -from distutils.spawn import find_executable symbolizers = {} demangle = False @@ -155,7 +155,7 @@ class Addr2LineSymbolizer(Symbolizer): addr2line_tool = 'addr2line' if binutils_prefix: addr2line_tool = binutils_prefix + addr2line_tool - logging.debug('addr2line binary is %s' % find_executable(addr2line_tool)) + logging.debug('addr2line binary is %s' % shutil.which(addr2line_tool)) cmd = [addr2line_tool, '-fi'] if demangle: cmd += ['--demangle']