[Lldb-commits] [lldb] r251959 - Python 3 - Don't use `commands` module anymore.
Zachary Turner via lldb-commits
lldb-commits at lists.llvm.org
Tue Nov 3 10:55:23 PST 2015
Author: zturner
Date: Tue Nov 3 12:55:22 2015
New Revision: 251959
URL: http://llvm.org/viewvc/llvm-project?rev=251959&view=rev
Log:
Python 3 - Don't use `commands` module anymore.
The `commands` module was deprecated in 2.7 and removed in 3.x.
As a workaround, we introduce a new module `seven` in
lldbsuite.support, and write helper functions in there that delegate
to the commands module if it is available, and re-implement their
functionality for cases where it is not available.
Modified:
lldb/trunk/packages/Python/lldbsuite/test/dotest.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py
Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=251959&r1=251958&r2=251959&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Tue Nov 3 12:55:22 2015
@@ -25,7 +25,6 @@ import lldbsuite
import lldbtest_config
import atexit
-import commands
import importlib
import os
import dotest_args
@@ -43,6 +42,7 @@ import unittest2
import test_categories
import six
+import lldbsuite.support.seven as seven
def is_exe(fpath):
"""Returns true if fpath is an executable."""
@@ -512,7 +512,7 @@ def parseOptionsAndInitTestdirs():
else:
# Use a compiler appropriate appropriate for the Apple SDK if one was specified
if platform_system == 'Darwin' and args.apple_sdk:
- compilers = [commands.getoutput('xcrun -sdk "%s" -find clang 2> /dev/null' % (args.apple_sdk))]
+ compilers = [seven.get_command_output('xcrun -sdk "%s" -find clang 2> /dev/null' % (args.apple_sdk))]
else:
# 'clang' on ubuntu 14.04 is 3.4 so we try clang-3.5 first
candidateCompilers = ['clang-3.5', 'clang', 'gcc']
@@ -529,15 +529,15 @@ def parseOptionsAndInitTestdirs():
# Set SDKROOT if we are using an Apple SDK
if platform_system == 'Darwin' and args.apple_sdk:
- os.environ['SDKROOT'] = commands.getoutput('xcrun --sdk "%s" --show-sdk-path 2> /dev/null' % (args.apple_sdk))
+ os.environ['SDKROOT'] = seven.get_command_output('xcrun --sdk "%s" --show-sdk-path 2> /dev/null' % (args.apple_sdk))
if args.archs:
archs = args.archs
for arch in archs:
if arch.startswith('arm') and platform_system == 'Darwin' and not args.apple_sdk:
- os.environ['SDKROOT'] = commands.getoutput('xcrun --sdk iphoneos.internal --show-sdk-path 2> /dev/null')
+ os.environ['SDKROOT'] = seven.get_command_output('xcrun --sdk iphoneos.internal --show-sdk-path 2> /dev/null')
if not os.path.exists(os.environ['SDKROOT']):
- os.environ['SDKROOT'] = commands.getoutput('xcrun --sdk iphoneos --show-sdk-path 2> /dev/null')
+ os.environ['SDKROOT'] = seven.get_command_output('xcrun --sdk iphoneos --show-sdk-path 2> /dev/null')
else:
archs = [platform_machine]
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py?rev=251959&r1=251958&r2=251959&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py Tue Nov 3 12:55:22 2015
@@ -6,15 +6,15 @@ from __future__ import print_function
import use_lldb_suite
import lldb
-import commands
import os
import time
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+import lldbsuite.support.seven as seven
def execute_command (command):
#print('%% %s' % (command))
- (exit_status, output) = commands.getstatusoutput(command)
+ (exit_status, output) = seven.get_command_status_output(command)
#if output:
# print(output)
#print('status = %u' % (exit_status))
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py?rev=251959&r1=251958&r2=251959&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py Tue Nov 3 12:55:22 2015
@@ -6,15 +6,15 @@ from __future__ import print_function
import use_lldb_suite
import lldb
-import commands
import os
import time
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+import lldbsuite.support.seven as seven
def execute_command (command):
# print('%% %s' % (command))
- (exit_status, output) = commands.getstatusoutput(command)
+ (exit_status, output) = seven.get_command_status_output(command)
# if output:
# print(output)
# print('status = %u' % (exit_status))
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py?rev=251959&r1=251958&r2=251959&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py Tue Nov 3 12:55:22 2015
@@ -7,15 +7,15 @@ from __future__ import print_function
import use_lldb_suite
import os, time
-import commands
import re
import lldb
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.lldbtest import *
+import lldbsuite.support.seven as seven
def execute_command (command):
# print('%% %s' % (command))
- (exit_status, output) = commands.getstatusoutput(command)
+ (exit_status, output) = seven.get_command_status_output(command)
# if output:
# print(output)
# print('status = %u' % (exit_status))
More information about the lldb-commits
mailing list