Skip to content

Commit dc2629c

Browse files
author
Harlan
committed
Merge pull request #2111 from harlanhaskins/python3-toolchain
[build_support] Fixed python 3 errors
2 parents b464548 + 94f6ffc commit dc2629c

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

utils/swift_build_support/swift_build_support/debug.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
def _output(args):
2424
try:
2525
out = subprocess.check_output(args, stderr=subprocess.PIPE)
26-
return out.rstrip()
26+
return out.rstrip().decode()
2727
except subprocess.CalledProcessError:
2828
return None
2929

utils/swift_build_support/swift_build_support/toolchain.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ def __init__(self, cc=None, cxx=None, **kwargs):
3636
self.cc = cc
3737
self.cxx = cxx
3838
self.tools = [cc, cxx]
39-
for tool, path in kwargs.iteritems():
39+
for tool in kwargs:
40+
path = kwargs[tool]
4041
self.tools.append(path)
4142
setattr(self, tool, path)
4243

@@ -98,7 +99,8 @@ def host_toolchain(xcrun_toolchain='default', tools=None, suffixes=None):
9899
if platform.system() == 'Darwin':
99100
# Only use xcrun on Darwin
100101
path_map = {}
101-
for name, tool in tools.iteritems():
102+
for name in tools:
103+
tool = tools[name]
102104
path = xcrun.find(xcrun_toolchain, tool)
103105
if not path:
104106
return None

utils/swift_build_support/swift_build_support/which.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ def which(cmd):
3131
been backported to Python 2.7, which we support.
3232
"""
3333
try:
34-
return subprocess.check_output(['which', cmd]).rstrip()
34+
return subprocess.check_output(['which', cmd]).rstrip().decode()
3535
except subprocess.CalledProcessError:
3636
return None

utils/swift_build_support/swift_build_support/xcrun.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ def find(toolchain, tool):
2929
'--toolchain', toolchain,
3030
'--find', tool],
3131
stderr=subprocess.PIPE)
32-
return out.rstrip()
32+
return out.rstrip().decode()
3333
except subprocess.CalledProcessError:
3434
return None

utils/swift_build_support/tests/test_which.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_when_cmd_not_found_returns_none(self):
1919
self.assertIsNone(which('a-tool-that-doesnt-exist'))
2020

2121
def test_when_cmd_found_returns_path(self):
22-
self.assertEquals(os.path.split(which('ls'))[-1], 'ls')
22+
self.assertEqual(os.path.split(which('ls'))[-1], 'ls')
2323

2424

2525
if __name__ == '__main__':

0 commit comments

Comments
 (0)