[lldb/Test] Reduce code duplication by importing subprocess globally
authorJonas Devlieghere <jonas@devlieghere.com>
Fri, 31 Jul 2020 17:52:49 +0000 (10:52 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Fri, 31 Jul 2020 17:56:13 +0000 (10:56 -0700)
Import the subprocess module once instead of doing it inline which is
error prone and leads to needless code duplication.

lldb/test/API/lit.cfg.py

index a211abe6cc41cbbd005649a7dae5e74ebfd44ea6..e083e2fd9bebb61bc2bc6c5c07b2906e936aa4be 100644 (file)
@@ -6,6 +6,7 @@ import os
 import platform
 import shlex
 import shutil
+import subprocess
 
 import lit.formats
 
@@ -33,7 +34,6 @@ def mkdir_p(path):
 
 
 def find_sanitizer_runtime(name):
-  import subprocess
   resource_dir = subprocess.check_output(
       [config.cmake_cxx_compiler,
        '-print-resource-dir']).decode('utf-8').strip()
@@ -60,7 +60,6 @@ def find_python_interpreter():
     return copied_python
 
   # Find the "real" python binary.
-  import shutil, subprocess
   real_python = subprocess.check_output([
       config.python_executable,
       os.path.join(os.path.dirname(os.path.realpath(__file__)),