[Lldb-commits] [lldb] r251847 - Create lldbsuite.support package with `seven` file.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 2 14:41:01 PST 2015


Author: zturner
Date: Mon Nov  2 16:41:01 2015
New Revision: 251847

URL: http://llvm.org/viewvc/llvm-project?rev=251847&view=rev
Log:
Create lldbsuite.support package with `seven` file.

This file will be useful for filling in the gaps where `six` is
missing some things we need.

Added:
    lldb/trunk/packages/Python/lldbsuite/support/
    lldb/trunk/packages/Python/lldbsuite/support/__init__.py
    lldb/trunk/packages/Python/lldbsuite/support/seven.py

Added: lldb/trunk/packages/Python/lldbsuite/support/__init__.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/support/__init__.py?rev=251847&view=auto
==============================================================================
    (empty)

Added: lldb/trunk/packages/Python/lldbsuite/support/seven.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/support/seven.py?rev=251847&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/support/seven.py (added)
+++ lldb/trunk/packages/Python/lldbsuite/support/seven.py Mon Nov  2 16:41:01 2015
@@ -0,0 +1,17 @@
+import six
+
+if six.PY2:
+    import commands
+    get_command_output = commands.getoutput
+    get_command_status_output = commands.getstatusoutput
+
+else:
+    def get_command_status_output(command):
+        try:
+            import subprocess
+            return (0, subprocess.check_output(command, shell=True))
+        except subprocess.CalledProcessError as e:
+            return (e.returncode, e.output)
+
+    def get_command_output(command):
+        return get_command_status_output(command)[1]




More information about the lldb-commits mailing list