From 229e04a5fde7d43e9ba9df231dad704d8feee565 Mon Sep 17 00:00:00 2001 From: M Bernt Date: Tue, 25 Feb 2020 15:57:40 +0100 Subject: [PATCH 1/3] fix searchgui_archive set_meta probably with py3 reading a file from a zip file is binary. hence startswith and split fail. --- lib/galaxy/datatypes/binary.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/galaxy/datatypes/binary.py b/lib/galaxy/datatypes/binary.py index 1ba208f2c6f..f9193e86432 100644 --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -2112,6 +2112,7 @@ class SearchGuiArchive(CompressedArchive): if 'searchgui.properties' in tempzip.namelist(): with tempzip.open('searchgui.properties') as fh: for line in fh: + line = line.decode() if line.startswith('searchgui.version'): version = line.split('=')[1].strip() dataset.metadata.searchgui_version = version From 4f8ce5ecbf5cfc7b44e7f1938dbe8d8b98160e63 Mon Sep 17 00:00:00 2001 From: M Bernt Date: Wed, 26 Feb 2020 10:22:30 +0100 Subject: [PATCH 2/3] use TextIOWrapper instead of decode Co-Authored-By: Nicola Soranzo --- lib/galaxy/datatypes/binary.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/galaxy/datatypes/binary.py b/lib/galaxy/datatypes/binary.py index f9193e86432..0a03fca23e0 100644 --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -2111,8 +2111,7 @@ class SearchGuiArchive(CompressedArchive): with zipfile.ZipFile(dataset.file_name) as tempzip: if 'searchgui.properties' in tempzip.namelist(): with tempzip.open('searchgui.properties') as fh: - for line in fh: - line = line.decode() + for line in io.TextIOWrapper(fh): if line.startswith('searchgui.version'): version = line.split('=')[1].strip() dataset.metadata.searchgui_version = version From 7624a4dc663c0d31d4017c6b4477e242c5cf3509 Mon Sep 17 00:00:00 2001 From: M Bernt Date: Wed, 26 Feb 2020 10:52:11 +0100 Subject: [PATCH 3/3] add missing import --- lib/galaxy/datatypes/binary.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/galaxy/datatypes/binary.py b/lib/galaxy/datatypes/binary.py index 0a03fca23e0..33cb382d87b 100644 --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -3,6 +3,7 @@ from __future__ import print_function import binascii import gzip +import io import logging import os import shutil