Python 3 - Port use of string.maketrans and don't use sets.Set.

`sets.Set` has been deprecated in favor of `set` since 2.6, and
`string.maketrans` has to be special cased.  In Python 3 there
is `str.maketrans`, `bytes.maketrans`, and `bytearray.maketrans`
and you have to choose the correct one.  So we need to introduce
a runtime version check at this site.

llvm-svn: 252348
This commit is contained in:
Zachary Turner 2015-11-06 21:37:33 +00:00
parent 5821f79714
commit e73a0601bd
2 changed files with 5 additions and 4 deletions

View File

@ -1726,8 +1726,10 @@ def run_suite():
if iterArchs or iterCompilers: if iterArchs or iterCompilers:
# Translate ' ' to '-' for pathname component. # Translate ' ' to '-' for pathname component.
from string import maketrans if six.PY2:
tbl = maketrans(' ', '-') tbl = string.maketrans(' ', '-')
else:
tbl = str.maketrans(' ', '-')
configPostfix = configString.translate(tbl) configPostfix = configString.translate(tbl)
# Check whether we need to split stderr/stdout into configuration # Check whether we need to split stderr/stdout into configuration

View File

@ -13,7 +13,6 @@ import platform
import random import random
import re import re
import select import select
import sets
import signal import signal
import socket import socket
import subprocess import subprocess
@ -785,7 +784,7 @@ class GdbRemoteTestCaseBase(TestBase):
def select_modifiable_register(self, reg_infos): def select_modifiable_register(self, reg_infos):
"""Find a register that can be read/written freely.""" """Find a register that can be read/written freely."""
PREFERRED_REGISTER_NAMES = sets.Set(["rax",]) PREFERRED_REGISTER_NAMES = set(["rax",])
# First check for the first register from the preferred register name set. # First check for the first register from the preferred register name set.
alternative_register_index = None alternative_register_index = None