294 """ |
294 """ |
295 Private method to check, if an upgrade of PyQt packages is attempted. |
295 Private method to check, if an upgrade of PyQt packages is attempted. |
296 |
296 |
297 @param packages list of packages to upgrade |
297 @param packages list of packages to upgrade |
298 @type list of str |
298 @type list of str |
299 @return flag indicating to abort the upgrade attempt |
299 @return flag indicating a PyQt upgrade |
300 @rtype bool |
300 @rtype bool |
301 """ |
301 """ |
302 pyqtPackages = [ |
302 pyqtPackages = [ |
303 p for p in packages if p.lower() in [ |
303 p for p in packages if p.lower() in [ |
304 "pyqt6", "pyqt6-sip", "pyqt6-webengine", "pyqt6-charts", |
304 "pyqt6", "pyqt6-sip", "pyqt6-webengine", "pyqt6-charts", |
306 "pyqt6-charts-qt6" |
306 "pyqt6-charts-qt6" |
307 ] |
307 ] |
308 ] |
308 ] |
309 return bool(pyqtPackages) |
309 return bool(pyqtPackages) |
310 |
310 |
|
311 def __checkUpgradeEric(self, packages): |
|
312 """ |
|
313 Private method to check, if an upgrade of the eric-ide package is |
|
314 attempted. |
|
315 |
|
316 @param packages list of packages to upgrade |
|
317 @type list of str |
|
318 @return flag indicating an eric-ide upgrade |
|
319 @rtype bool |
|
320 """ |
|
321 ericPackages = [ |
|
322 p for p in packages if p.lower() == "eric-ide" |
|
323 ] |
|
324 return bool(ericPackages) |
|
325 |
311 def upgradePackages(self, packages, venvName, userSite=False): |
326 def upgradePackages(self, packages, venvName, userSite=False): |
312 """ |
327 """ |
313 Public method to upgrade the given list of packages. |
328 Public method to upgrade the given list of packages. |
314 |
329 |
315 @param packages list of packages to upgrade |
330 @param packages list of packages to upgrade |
323 @rtype bool |
338 @rtype bool |
324 """ |
339 """ |
325 if not venvName: |
340 if not venvName: |
326 return False |
341 return False |
327 |
342 |
328 if ( |
343 if self.getVirtualenvInterpreter(venvName) == sys.executable: |
329 self.getVirtualenvInterpreter(venvName) == sys.executable and |
344 upgradePyQt = self.__checkUpgradePyQt(packages) |
330 self.__checkUpgradePyQt(packages) |
345 upgradeEric = self.__checkUpgradeEric(packages) |
331 ): |
346 if upgradeEric or upgradePyQt: |
332 try: |
347 try: |
333 self.__ui.upgradePyQt() |
348 if upgradeEric and upgradePyQt: |
334 return None # should not be reached; play it safe |
349 self.__ui.upgradeEricPyQt() |
335 except AttributeError: |
350 elif upgradeEric: |
336 return False |
351 self.__ui.upgradeEric() |
|
352 elif upgradePyQt: |
|
353 self.__ui.upgradePyQt() |
|
354 return None # should not be reached; play it safe |
|
355 except AttributeError: |
|
356 return False |
337 |
357 |
338 interpreter = self.getVirtualenvInterpreter(venvName) |
358 interpreter = self.getVirtualenvInterpreter(venvName) |
339 if not interpreter: |
359 if not interpreter: |
340 return False |
360 return False |
341 |
361 |
661 package["latest_version"], |
681 package["latest_version"], |
662 )) |
682 )) |
663 |
683 |
664 return packages |
684 return packages |
665 |
685 |
|
686 def checkPackageOutdated(self, packageStart, envName): |
|
687 """ |
|
688 Public method to check, if a group of packages is outdated. |
|
689 |
|
690 @param packageStart start string for package names to be checked |
|
691 (case insensitive) |
|
692 @type str |
|
693 @param envName name of the environment to get the packages for |
|
694 @type str |
|
695 @return tuple containing a flag indicating outdated packages and the |
|
696 list of tuples containing the package name, installed version |
|
697 and available version |
|
698 @rtype tuple of (bool, (str, str, str)) |
|
699 """ |
|
700 filteredPackages = [] |
|
701 |
|
702 if bool(envName) and bool(packageStart): |
|
703 packages = self.getOutdatedPackages(envName) |
|
704 filterStr = packageStart.lower() |
|
705 filteredPackages = [ |
|
706 p for p in packages |
|
707 if p[0].lower().startswith(filterStr)] |
|
708 |
|
709 return bool(filteredPackages), filteredPackages |
|
710 |
666 def getPackageDetails(self, name, version): |
711 def getPackageDetails(self, name, version): |
667 """ |
712 """ |
668 Public method to get package details using the PyPI JSON interface. |
713 Public method to get package details using the PyPI JSON interface. |
669 |
714 |
670 @param name package name |
715 @param name package name |