[Python] Simplify the code. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@358721 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/examples/python/memory.py b/examples/python/memory.py
index d2bc60c..9f8f7e3 100755
--- a/examples/python/memory.py
+++ b/examples/python/memory.py
@@ -15,11 +15,7 @@
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 @@
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(
diff --git a/examples/python/performance.py b/examples/python/performance.py
index 9a514e7..aec6b30 100755
--- a/examples/python/performance.py
+++ b/examples/python/performance.py
@@ -16,14 +16,10 @@
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 @@
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(
diff --git a/examples/python/process_events.py b/examples/python/process_events.py
index 9fd1347..6039ebf 100755
--- a/examples/python/process_events.py
+++ b/examples/python/process_events.py
@@ -14,11 +14,7 @@
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 @@
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(
diff --git a/examples/python/types.py b/examples/python/types.py
index 9613197..a401e37 100755
--- a/examples/python/types.py
+++ b/examples/python/types.py
@@ -16,11 +16,7 @@
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 @@
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(