Skip to content

[build_support] Fixed python 3 errors #2111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion utils/swift_build_support/swift_build_support/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
def _output(args):
try:
out = subprocess.check_output(args, stderr=subprocess.PIPE)
return out.rstrip()
return out.rstrip().decode()
except subprocess.CalledProcessError:
return None

Expand Down
6 changes: 4 additions & 2 deletions utils/swift_build_support/swift_build_support/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ def __init__(self, cc=None, cxx=None, **kwargs):
self.cc = cc
self.cxx = cxx
self.tools = [cc, cxx]
for tool, path in kwargs.iteritems():
for tool in kwargs:
path = kwargs[tool]
self.tools.append(path)
setattr(self, tool, path)

Expand Down Expand Up @@ -98,7 +99,8 @@ def host_toolchain(xcrun_toolchain='default', tools=None, suffixes=None):
if platform.system() == 'Darwin':
# Only use xcrun on Darwin
path_map = {}
for name, tool in tools.iteritems():
for name in tools:
tool = tools[name]
path = xcrun.find(xcrun_toolchain, tool)
if not path:
return None
Expand Down
2 changes: 1 addition & 1 deletion utils/swift_build_support/swift_build_support/which.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ def which(cmd):
been backported to Python 2.7, which we support.
"""
try:
return subprocess.check_output(['which', cmd]).rstrip()
return subprocess.check_output(['which', cmd]).rstrip().decode()
except subprocess.CalledProcessError:
return None
2 changes: 1 addition & 1 deletion utils/swift_build_support/swift_build_support/xcrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ def find(toolchain, tool):
'--toolchain', toolchain,
'--find', tool],
stderr=subprocess.PIPE)
return out.rstrip()
return out.rstrip().decode()
except subprocess.CalledProcessError:
return None
2 changes: 1 addition & 1 deletion utils/swift_build_support/tests/test_which.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_when_cmd_not_found_returns_none(self):
self.assertIsNone(which('a-tool-that-doesnt-exist'))

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


if __name__ == '__main__':
Expand Down