diff options
author | Serge Guelton <sguelton@redhat.com> | 2019-03-26 14:46:15 +0000 |
---|---|---|
committer | Serge Guelton <sguelton@redhat.com> | 2019-03-26 14:46:15 +0000 |
commit | 1a12dd70c00a44e34384b1904d18d309ae3c3ac6 (patch) | |
tree | fd786218bf2e1d8894562c909de7b30f08608f02 /lldb/examples/python/memory.py | |
parent | 25f9094d89d01d4fb562ba0edcc2eb63f9e074d7 (diff) | |
download | bcm5719-llvm-1a12dd70c00a44e34384b1904d18d309ae3c3ac6.tar.gz bcm5719-llvm-1a12dd70c00a44e34384b1904d18d309ae3c3ac6.zip |
python 2/3 compat: commands vs subprocess
Differential Revision: https://reviews.llvm.org/D59584
llvm-svn: 356995
Diffstat (limited to 'lldb/examples/python/memory.py')
-rwxr-xr-x | lldb/examples/python/memory.py | 9 |
1 files changed, 6 insertions, 3 deletions
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 |