[compiler-rt] 21ca46c - [compiler-rt][ASAN] Replace find_executable with shtuil.which in script

David Spickett via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 02:18:53 PDT 2023


Author: David Spickett
Date: 2023-04-19T09:18:47Z
New Revision: 21ca46c1aa51253856fcff30c0dbc7b0b40d1a1c

URL: https://github.com/llvm/llvm-project/commit/21ca46c1aa51253856fcff30c0dbc7b0b40d1a1c
DIFF: https://github.com/llvm/llvm-project/commit/21ca46c1aa51253856fcff30c0dbc7b0b40d1a1c.diff

LOG: [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

Added: 
    

Modified: 
    compiler-rt/lib/asan/scripts/asan_symbolize.py

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/scripts/asan_symbolize.py b/compiler-rt/lib/asan/scripts/asan_symbolize.py
index 4d5312858fdbb..1e8540f0bf95d 100755
--- a/compiler-rt/lib/asan/scripts/asan_symbolize.py
+++ b/compiler-rt/lib/asan/scripts/asan_symbolize.py
@@ -26,9 +26,9 @@
 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 @@ def open_addr2line(self):
     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']


        


More information about the llvm-commits mailing list