34 PluginLoadError, PluginActivationError, PluginModuleFormatError, \ |
34 PluginLoadError, PluginActivationError, PluginModuleFormatError, \ |
35 PluginClassFormatError, PluginPy2IncompatibleError |
35 PluginClassFormatError, PluginPy2IncompatibleError |
36 |
36 |
37 import UI.PixmapCache |
37 import UI.PixmapCache |
38 |
38 |
|
39 import Globals |
39 import Utilities |
40 import Utilities |
40 import Preferences |
41 import Preferences |
41 |
42 |
42 from eric6config import getConfig |
43 from eric6config import getConfig |
43 |
44 |
1301 if pluginDetails is None: |
1302 if pluginDetails is None: |
1302 if not Preferences.getPluginManager("CheckInstalledOnly"): |
1303 if not Preferences.getPluginManager("CheckInstalledOnly"): |
1303 self.__updateAvailable = True |
1304 self.__updateAvailable = True |
1304 return |
1305 return |
1305 |
1306 |
1306 if version.count(".") >= 3: |
1307 versionTuple = Globals.versionToTuple(version)[:3] |
1307 # cope for extended version numbers by ignoring |
1308 pluginVersionTuple = Globals.versionToTuple( |
1308 # the extension |
1309 pluginDetails["version"])[:3] |
1309 checkVersion = ".".join(version.split(".", 3)[:3]) |
1310 |
1310 else: |
1311 if pluginVersionTuple < versionTuple: |
1311 checkVersion = version |
|
1312 if pluginDetails["version"] < checkVersion: |
|
1313 self.__updateAvailable = True |
1312 self.__updateAvailable = True |
1314 return |
1313 return |
1315 |
1314 |
1316 if not Preferences.getPluginManager("CheckInstalledOnly"): |
1315 if not Preferences.getPluginManager("CheckInstalledOnly"): |
1317 # Check against downloaded plugin archives |
1316 # Check against downloaded plugin archives |
1318 # 1. Check, if the archive file exists |
1317 # 1. Check, if the archive file exists |
1319 if not os.path.exists(archive): |
1318 if not os.path.exists(archive): |
1320 self.__updateAvailable = True |
|
1321 return |
1319 return |
1322 |
1320 |
1323 # 2. Check, if the archive is a valid zip file |
1321 # 2. Check, if the archive is a valid zip file |
1324 if not zipfile.is_zipfile(archive): |
1322 if not zipfile.is_zipfile(archive): |
1325 self.__updateAvailable = True |
1323 self.__updateAvailable = True |
1328 # 3. Check the version of the archive file |
1326 # 3. Check the version of the archive file |
1329 zipFile = zipfile.ZipFile(archive, "r") |
1327 zipFile = zipfile.ZipFile(archive, "r") |
1330 try: |
1328 try: |
1331 aversion = zipFile.read("VERSION").decode("utf-8") |
1329 aversion = zipFile.read("VERSION").decode("utf-8") |
1332 except KeyError: |
1330 except KeyError: |
1333 aversion = "" |
1331 aversion = "0.0.0" |
1334 zipFile.close() |
1332 zipFile.close() |
1335 |
1333 |
1336 if aversion != version: |
1334 aversionTuple = Globals.versionToTuple(aversion)[:3] |
|
1335 if aversionTuple != versionTuple: |
1337 self.__updateAvailable = True |
1336 self.__updateAvailable = True |
1338 |
1337 |
1339 def __sslErrors(self, reply, errors): |
1338 def __sslErrors(self, reply, errors): |
1340 """ |
1339 """ |
1341 Private slot to handle SSL errors. |
1340 Private slot to handle SSL errors. |