Author: davide Date: Thu Apr 18 16:24:54 2019 New Revision: 358721 URL: http://llvm.org/viewvc/llvm-project?rev=358721&view=rev Log: [Python] Simplify the code. NFCI.
Modified: lldb/trunk/examples/python/memory.py lldb/trunk/examples/python/performance.py lldb/trunk/examples/python/process_events.py lldb/trunk/examples/python/types.py Modified: lldb/trunk/examples/python/memory.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/memory.py?rev=358721&r1=358720&r2=358721&view=diff ============================================================================== --- lldb/trunk/examples/python/memory.py (original) +++ lldb/trunk/examples/python/memory.py Thu Apr 18 16:24:54 2019 @@ -15,11 +15,7 @@ import platform import os import re import sys - -if sys.version_info.major == 2: - import commands as subprocess -else: - import subprocess +import subprocess try: # Just try for LLDB in case PYTHONPATH is already correctly setup @@ -30,7 +26,7 @@ except ImportError: platform_system = platform.system() if platform_system == 'Darwin': # On Darwin, try the currently selected Xcode directory - xcode_dir = subprocess.getoutput("xcode-select --print-path") + xcode_dir = subprocess.check_output("xcode-select --print-path", shell=True) if xcode_dir: lldb_python_dirs.append( os.path.realpath( Modified: lldb/trunk/examples/python/performance.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/performance.py?rev=358721&r1=358720&r2=358721&view=diff ============================================================================== --- lldb/trunk/examples/python/performance.py (original) +++ lldb/trunk/examples/python/performance.py Thu Apr 18 16:24:54 2019 @@ -16,14 +16,10 @@ import platform import re import resource import sys +import subprocess import time import types -if sys.version_info.major == 2: - import commands as subprocess -else: - import subprocess - #---------------------------------------------------------------------- # Code that auto imports LLDB #---------------------------------------------------------------------- @@ -36,7 +32,7 @@ except ImportError: platform_system = platform.system() if platform_system == 'Darwin': # On Darwin, try the currently selected Xcode directory - xcode_dir = subprocess.getoutput("xcode-select --print-path") + xcode_dir = subprocess.check_output("xcode-select --print-path", shell=True) if xcode_dir: lldb_python_dirs.append( os.path.realpath( Modified: lldb/trunk/examples/python/process_events.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/process_events.py?rev=358721&r1=358720&r2=358721&view=diff ============================================================================== --- lldb/trunk/examples/python/process_events.py (original) +++ lldb/trunk/examples/python/process_events.py Thu Apr 18 16:24:54 2019 @@ -14,11 +14,7 @@ import optparse import os import platform import sys - -if sys.version_info.major == 2: - import commands as subprocess -else: - import subprocess +import subprocess #---------------------------------------------------------------------- # Code that auto imports LLDB @@ -32,7 +28,7 @@ except ImportError: platform_system = platform.system() if platform_system == 'Darwin': # On Darwin, try the currently selected Xcode directory - xcode_dir = subprocess.getoutput("xcode-select --print-path") + xcode_dir = subprocess.check_output("xcode-select --print-path", shell=True) if xcode_dir: lldb_python_dirs.append( os.path.realpath( Modified: lldb/trunk/examples/python/types.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/types.py?rev=358721&r1=358720&r2=358721&view=diff ============================================================================== --- lldb/trunk/examples/python/types.py (original) +++ lldb/trunk/examples/python/types.py Thu Apr 18 16:24:54 2019 @@ -16,11 +16,7 @@ import os import re import signal import sys - -if sys.version_info.major == 2: - import commands as subprocess -else: - import subprocess +import subprocess try: # Just try for LLDB in case PYTHONPATH is already correctly setup @@ -31,7 +27,7 @@ except ImportError: platform_system = platform.system() if platform_system == 'Darwin': # On Darwin, try the currently selected Xcode directory - xcode_dir = subprocess.getoutput("xcode-select --print-path") + xcode_dir = subprocess.check_output("xcode-select --print-path", shell=True) if xcode_dir: lldb_python_dirs.append( os.path.realpath( _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits