AddonManager: Fixes download of metadata.txt with Py3

urllib2 in Py3 gives us a bytearray instead of a string. We have to decode it first to get the metadata.txt. When decoding fails we assume that we are in Py2 and process as before.
This commit is contained in:
Daniel Furtlehner
2018-08-28 17:00:54 +02:00
committed by Yorik van Havre
parent 0a61c78543
commit 71528b8660

View File

@@ -1003,6 +1003,13 @@ class InstallWorker(QtCore.QThread):
# metadata.txt found
depsfile = mu.read()
mu.close()
# urllib2 gives us a bytelike object instead of a string. Have to consider that
try:
depsfile = depsfile.decode('utf-8')
except AttributeError:
pass
deps = depsfile.split("\n")
for l in deps:
if l.startswith("workbenches="):