diff options
author | Zachary Turner <zturner@google.com> | 2015-11-03 18:55:22 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2015-11-03 18:55:22 +0000 |
commit | bb03a4660f669bff3875ce00c1d4acaf28c244ef (patch) | |
tree | 11dfd9a5292d0635b89514c5e92408b38c1d93c3 /lldb/packages/Python/lldbsuite/test | |
parent | e7fe1a46e4213842fc2f2c0b0dcd4232923bac20 (diff) | |
download | bcm5719-llvm-bb03a4660f669bff3875ce00c1d4acaf28c244ef.tar.gz bcm5719-llvm-bb03a4660f669bff3875ce00c1d4acaf28c244ef.zip |
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.
llvm-svn: 251959
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
4 files changed, 11 insertions, 11 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py index 9148b34ebe4..8b235b1cb57 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -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] diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py b/lldb/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py index f04c49ce3e2..552f46b83de 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py @@ -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)) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py b/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py index 9134692a332..94313bb27c2 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py @@ -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)) diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py b/lldb/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py index 5d8d3c11d66..7202d085869 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py @@ -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)) |