From be4e2a0a8e60018287775c6799e92d9b3242b2bb Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Fri, 16 Oct 2020 12:18:43 -0700 Subject: [PATCH 1/2] Update swift-rpathize.py to work with Python 3.8 and Python 2.7 In Python 2, str() is also a kind of bytes blob In Python 3, str() is a Unicode string that's unrelated --- utils/swift-rpathize.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/swift-rpathize.py b/utils/swift-rpathize.py index e88bdd81988ce..e7fb3cb4286a1 100755 --- a/utils/swift-rpathize.py +++ b/utils/swift-rpathize.py @@ -65,7 +65,8 @@ def rpathize(filename): # Build a command to invoke install_name_tool. command = ['install_name_tool'] for line in dylibsOutput.splitlines(): - match = dylib_regex.match(line) + l = line.decode("utf-8", "strict") + match = dylib_regex.match(l) if match: command.append('-change') command.append(match.group('path')) From a0d1e4e9913c7623f347ed70e00cb9e8aa392534 Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Fri, 16 Oct 2020 14:38:41 -0700 Subject: [PATCH 2/2] Avoid `l` as a variable name Python-lint correctly warns about single-character variables that can be confused with numbers --- utils/swift-rpathize.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/swift-rpathize.py b/utils/swift-rpathize.py index e7fb3cb4286a1..5db01717fad0c 100755 --- a/utils/swift-rpathize.py +++ b/utils/swift-rpathize.py @@ -64,9 +64,9 @@ def rpathize(filename): # Build a command to invoke install_name_tool. command = ['install_name_tool'] - for line in dylibsOutput.splitlines(): - l = line.decode("utf-8", "strict") - match = dylib_regex.match(l) + for binaryline in dylibsOutput.splitlines(): + line = binaryline.decode("utf-8", "strict") + match = dylib_regex.match(line) if match: command.append('-change') command.append(match.group('path'))