diff options
Diffstat (limited to 'lldb/examples/python')
-rwxr-xr-x | lldb/examples/python/delta.py | 1 | ||||
-rwxr-xr-x | lldb/examples/python/gdbremote.py | 2 | ||||
-rwxr-xr-x | lldb/examples/python/globals.py | 1 | ||||
-rwxr-xr-x | lldb/examples/python/memory.py | 9 | ||||
-rwxr-xr-x | lldb/examples/python/performance.py | 10 | ||||
-rwxr-xr-x | lldb/examples/python/process_events.py | 8 | ||||
-rwxr-xr-x | lldb/examples/python/stacks.py | 1 | ||||
-rwxr-xr-x | lldb/examples/python/types.py | 9 |
8 files changed, 26 insertions, 15 deletions
diff --git a/lldb/examples/python/delta.py b/lldb/examples/python/delta.py index bb52cad633f..1a1f060c5e5 100755 --- a/lldb/examples/python/delta.py +++ b/lldb/examples/python/delta.py @@ -16,7 +16,6 @@ # available. #---------------------------------------------------------------------- -import commands from __future__ import print_function import optparse diff --git a/lldb/examples/python/gdbremote.py b/lldb/examples/python/gdbremote.py index d9647efe276..dcacbfccdaf 100755 --- a/lldb/examples/python/gdbremote.py +++ b/lldb/examples/python/gdbremote.py @@ -17,7 +17,7 @@ #---------------------------------------------------------------------- import binascii -import commands +import subprocess import json import math import optparse diff --git a/lldb/examples/python/globals.py b/lldb/examples/python/globals.py index 1b18ed42dcb..3e773441642 100755 --- a/lldb/examples/python/globals.py +++ b/lldb/examples/python/globals.py @@ -10,7 +10,6 @@ from __future__ import print_function import lldb -import commands import optparse import os import shlex diff --git a/lldb/examples/python/memory.py b/lldb/examples/python/memory.py index cdc89fc811d..d2bc60cb10f 100755 --- a/lldb/examples/python/memory.py +++ b/lldb/examples/python/memory.py @@ -9,7 +9,6 @@ # (lldb) command script import /path/to/cmdtemplate.py #---------------------------------------------------------------------- -import commands from __future__ import print_function import platform @@ -17,6 +16,11 @@ import os import re import sys +if sys.version_info.major == 2: + import commands as subprocess +else: + import subprocess + try: # Just try for LLDB in case PYTHONPATH is already correctly setup import lldb @@ -26,7 +30,7 @@ except ImportError: platform_system = platform.system() if platform_system == 'Darwin': # On Darwin, try the currently selected Xcode directory - xcode_dir = commands.getoutput("xcode-select --print-path") + xcode_dir = subprocess.getoutput("xcode-select --print-path") if xcode_dir: lldb_python_dirs.append( os.path.realpath( @@ -53,7 +57,6 @@ except ImportError: print("error: couldn't locate the 'lldb' module, please set PYTHONPATH correctly") sys.exit(1) -import commands import optparse import shlex import string diff --git a/lldb/examples/python/performance.py b/lldb/examples/python/performance.py index 5412be80293..9a514e74b7c 100755 --- a/lldb/examples/python/performance.py +++ b/lldb/examples/python/performance.py @@ -8,7 +8,6 @@ # export PYTHONPATH=/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python #---------------------------------------------------------------------- -import commands from __future__ import print_function import optparse @@ -20,6 +19,11 @@ import sys import time import types +if sys.version_info.major == 2: + import commands as subprocess +else: + import subprocess + #---------------------------------------------------------------------- # Code that auto imports LLDB #---------------------------------------------------------------------- @@ -32,7 +36,7 @@ except ImportError: platform_system = platform.system() if platform_system == 'Darwin': # On Darwin, try the currently selected Xcode directory - xcode_dir = commands.getoutput("xcode-select --print-path") + xcode_dir = subprocess.getoutput("xcode-select --print-path") if xcode_dir: lldb_python_dirs.append( os.path.realpath( @@ -303,7 +307,7 @@ class MemoryMeasurement(Measurement): self.value = dict() def Measure(self): - output = commands.getoutput(self.command).split("\n")[-1] + output = subprocess.getoutput(self.command).split("\n")[-1] values = re.split('[-+\s]+', output) for (idx, stat) in enumerate(values): multiplier = 1 diff --git a/lldb/examples/python/process_events.py b/lldb/examples/python/process_events.py index a00217b70c8..9fd1347176d 100755 --- a/lldb/examples/python/process_events.py +++ b/lldb/examples/python/process_events.py @@ -8,7 +8,6 @@ # export PYTHONPATH=/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python #---------------------------------------------------------------------- -import commands from __future__ import print_function import optparse @@ -16,6 +15,11 @@ import os import platform import sys +if sys.version_info.major == 2: + import commands as subprocess +else: + import subprocess + #---------------------------------------------------------------------- # Code that auto imports LLDB #---------------------------------------------------------------------- @@ -28,7 +32,7 @@ except ImportError: platform_system = platform.system() if platform_system == 'Darwin': # On Darwin, try the currently selected Xcode directory - xcode_dir = commands.getoutput("xcode-select --print-path") + xcode_dir = subprocess.getoutput("xcode-select --print-path") if xcode_dir: lldb_python_dirs.append( os.path.realpath( diff --git a/lldb/examples/python/stacks.py b/lldb/examples/python/stacks.py index 63c46ad046e..a676b82d097 100755 --- a/lldb/examples/python/stacks.py +++ b/lldb/examples/python/stacks.py @@ -1,7 +1,6 @@ #!/usr/bin/python from __future__ import print_function import lldb -import commands import optparse import shlex diff --git a/lldb/examples/python/types.py b/lldb/examples/python/types.py index a4cc91ba5dc..9613197db1d 100755 --- a/lldb/examples/python/types.py +++ b/lldb/examples/python/types.py @@ -9,7 +9,6 @@ # (lldb) command script import /path/to/cmdtemplate.py #---------------------------------------------------------------------- -import commands from __future__ import print_function import platform @@ -18,6 +17,11 @@ import re import signal import sys +if sys.version_info.major == 2: + import commands as subprocess +else: + import subprocess + try: # Just try for LLDB in case PYTHONPATH is already correctly setup import lldb @@ -27,7 +31,7 @@ except ImportError: platform_system = platform.system() if platform_system == 'Darwin': # On Darwin, try the currently selected Xcode directory - xcode_dir = commands.getoutput("xcode-select --print-path") + xcode_dir = subprocess.getoutput("xcode-select --print-path") if xcode_dir: lldb_python_dirs.append( os.path.realpath( @@ -54,7 +58,6 @@ except ImportError: print("error: couldn't locate the 'lldb' module, please set PYTHONPATH correctly") sys.exit(1) -import commands import optparse import shlex import time |