This revision was automatically updated to reflect the committed changes.
Closed by commit rL356995: python 2/3 compat: commands vs subprocess (authored 
by serge_sans_paille, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D59584?vs=191446&id=192279#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59584/new/

https://reviews.llvm.org/D59584

Files:
  lldb/trunk/examples/python/delta.py
  lldb/trunk/examples/python/gdbremote.py
  lldb/trunk/examples/python/globals.py
  lldb/trunk/examples/python/memory.py
  lldb/trunk/examples/python/performance.py
  lldb/trunk/examples/python/process_events.py
  lldb/trunk/examples/python/stacks.py
  lldb/trunk/examples/python/types.py
  lldb/trunk/scripts/verify_api.py

Index: lldb/trunk/examples/python/memory.py
===================================================================
--- lldb/trunk/examples/python/memory.py
+++ lldb/trunk/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 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 @@
     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 @@
         print("error: couldn't locate the 'lldb' module, please set PYTHONPATH correctly")
         sys.exit(1)
 
-import commands
 import optparse
 import shlex
 import string
Index: lldb/trunk/examples/python/types.py
===================================================================
--- lldb/trunk/examples/python/types.py
+++ lldb/trunk/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 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 @@
     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 @@
         print("error: couldn't locate the 'lldb' module, please set PYTHONPATH correctly")
         sys.exit(1)
 
-import commands
 import optparse
 import shlex
 import time
Index: lldb/trunk/examples/python/process_events.py
===================================================================
--- lldb/trunk/examples/python/process_events.py
+++ lldb/trunk/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 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 @@
     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(
Index: lldb/trunk/examples/python/gdbremote.py
===================================================================
--- lldb/trunk/examples/python/gdbremote.py
+++ lldb/trunk/examples/python/gdbremote.py
@@ -17,7 +17,7 @@
 #----------------------------------------------------------------------
 
 import binascii
-import commands
+import subprocess
 import json
 import math
 import optparse
Index: lldb/trunk/examples/python/performance.py
===================================================================
--- lldb/trunk/examples/python/performance.py
+++ lldb/trunk/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 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 @@
     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 @@
         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
Index: lldb/trunk/examples/python/delta.py
===================================================================
--- lldb/trunk/examples/python/delta.py
+++ lldb/trunk/examples/python/delta.py
@@ -16,7 +16,6 @@
 # available.
 #----------------------------------------------------------------------
 
-import commands
 from __future__ import print_function
 
 import optparse
Index: lldb/trunk/examples/python/stacks.py
===================================================================
--- lldb/trunk/examples/python/stacks.py
+++ lldb/trunk/examples/python/stacks.py
@@ -1,7 +1,6 @@
 #!/usr/bin/python
 from __future__ import print_function
 import lldb
-import commands
 import optparse
 import shlex
 
Index: lldb/trunk/examples/python/globals.py
===================================================================
--- lldb/trunk/examples/python/globals.py
+++ lldb/trunk/examples/python/globals.py
@@ -10,7 +10,6 @@
 from __future__ import print_function
 
 import lldb
-import commands
 import optparse
 import os
 import shlex
Index: lldb/trunk/scripts/verify_api.py
===================================================================
--- lldb/trunk/scripts/verify_api.py
+++ lldb/trunk/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 @@
 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")
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to