diff options
-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 | ||||
-rwxr-xr-x | lldb/scripts/verify_api.py | 4 |
9 files changed, 28 insertions, 17 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 diff --git a/lldb/scripts/verify_api.py b/lldb/scripts/verify_api.py index edf93e7637f..d422cded8c2 100755 --- a/lldb/scripts/verify_api.py +++ b/lldb/scripts/verify_api.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -import commands +import subprocess import optparse import os import os.path @@ -11,7 +11,7 @@ import sys def extract_exe_symbol_names(arch, exe_path, match_str): command = 'dsymutil --arch %s -s "%s" | grep "%s" | colrm 1 69' % ( arch, exe_path, match_str) - (command_exit_status, command_output) = commands.getstatusoutput(command) + (command_exit_status, command_output) = subprocess.getstatusoutput(command) if command_exit_status == 0: if command_output: return command_output[0:-1].split("'\n") |