AddonManager: Further older ssl/urllib2 version support

This commit is contained in:
Yorik van Havre
2017-06-09 11:05:17 -03:00
parent 2ea7a1fc6f
commit ab1b344410

View File

@@ -353,7 +353,10 @@ class UpdateWorker(QtCore.QThread):
def run(self):
"populates the list of addons"
self.progressbar_show.emit(True)
u = urllib2.urlopen("https://github.com/FreeCAD/FreeCAD-addons",context=ctx)
if ctx:
u = urllib2.urlopen("https://github.com/FreeCAD/FreeCAD-addons",context=ctx)
else:
u = urllib2.urlopen("https://github.com/FreeCAD/FreeCAD-addons")
p = u.read()
if sys.version_info.major >= 3 and isinstance(p, bytes):
p = p.decode("utf-8")
@@ -397,7 +400,10 @@ class InfoWorker(QtCore.QThread):
i = 0
for repo in self.repos:
url = repo[1]
u = urllib2.urlopen(url,context=ctx)
if ctx:
u = urllib2.urlopen(url,context=ctx)
else:
u = urllib2.urlopen(url)
p = u.read()
if sys.version_info.major >= 3 and isinstance(p, bytes):
p = p.decode("utf-8")
@@ -468,7 +474,10 @@ class MacroWorker(QtCore.QThread):
self.info_label.emit("Downloading list of macros...")
self.progressbar_show.emit(True)
macropath = FreeCAD.ParamGet('User parameter:BaseApp/Preferences/Macro').GetString("MacroPath",os.path.join(FreeCAD.ConfigGet("UserAppData"),"Macro"))
u = urllib2.urlopen("https://www.freecadweb.org/wiki/Macros_recipes",context=ctx)
if ctx:
u = urllib2.urlopen("https://www.freecadweb.org/wiki/Macros_recipes",context=ctx)
else:
u = urllib2.urlopen("https://www.freecadweb.org/wiki/Macros_recipes")
p = u.read()
if sys.version_info.major >= 3 and isinstance(p, bytes):
p = p.decode("utf-8")
@@ -510,7 +519,10 @@ class ShowWorker(QtCore.QThread):
else:
url = self.repos[self.idx][1]
self.info_label.emit(translate("AddonsInstaller", "Retrieving info from ") + str(url))
u = urllib2.urlopen(url,context=ctx)
if ctx:
u = urllib2.urlopen(url,context=ctx)
else:
u = urllib2.urlopen(url)
p = u.read()
if sys.version_info.major >= 3 and isinstance(p, bytes):
p = p.decode("utf-8")
@@ -554,7 +566,10 @@ class ShowMacroWorker(QtCore.QThread):
mac = mac.replace("+","%2B")
url = "https://www.freecadweb.org/wiki/Macro_"+mac
self.info_label.emit("Retrieving info from " + str(url))
u = urllib2.urlopen(url,context=ctx)
if ctx:
u = urllib2.urlopen(url,context=ctx)
else:
u = urllib2.urlopen(url)
p = u.read()
if sys.version_info.major >= 3 and isinstance(p, bytes):
p = p.decode("utf-8")