This is an automated email from the ASF dual-hosted git repository. granthenke pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/kudu.git
commit 0b858e67f0ab3a41789490d00a6ebcebe342798d Author: Grant Henke <[email protected]> AuthorDate: Wed Mar 11 10:11:02 2020 -0500 [build] Fix relocate_binaries_for_mini_cluster.py on Python 3 This patch fixes relocate_binaries_for_mini_cluster.py on Python 3 by ignoring decode failures on string like objects. This keeps Python 2 compatibility as well. Change-Id: I792edd867546315baa05b15c711c72f456bb5bd3 Reviewed-on: http://gerrit.cloudera.org:8080/15405 Tested-by: Kudu Jenkins Reviewed-by: Adar Dembo <[email protected]> --- .../mini-cluster/relocate_binaries_for_mini_cluster.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/build-support/mini-cluster/relocate_binaries_for_mini_cluster.py b/build-support/mini-cluster/relocate_binaries_for_mini_cluster.py index a443814..21bed54 100755 --- a/build-support/mini-cluster/relocate_binaries_for_mini_cluster.py +++ b/build-support/mini-cluster/relocate_binaries_for_mini_cluster.py @@ -158,10 +158,15 @@ def parse_load_commands_macos(cmd_type, dump): state = PARSING_NONE values = [] for line in dump: + # Ensure the line is a string-like object. + try: + line = line.decode('utf-8') + except (UnicodeDecodeError, AttributeError): + pass if re.match('^Load command', line): state = PARSING_NEW_RECORD continue - splits = re.split('\s+', line.strip().decode("utf-8"), maxsplit=2) + splits = re.split('\s+', line.strip(), maxsplit=2) key = splits[0] val = splits[1] if len(splits) > 1 else None if state == PARSING_NEW_RECORD: @@ -236,7 +241,13 @@ def get_artifact_name(): raise NotImplementedError("Unsupported platform") arch = os.uname()[4] with open(os.path.join(SOURCE_ROOT, "version.txt"), 'r') as version: - version = version.readline().strip().decode("utf-8") + line = version.readline() + # Ensure the line is a string-like object. + try: + line = line.decode('utf-8') + except (UnicodeDecodeError, AttributeError): + pass + version = line.strip() artifact_name = "kudu-binary-%s-%s-%s" % (version, os_str, arch) return artifact_name
