eric7/PipInterface/Pip.py

branch
eric7
changeset 8973
ad4848b7fd9b
parent 8972
54816b8f740f
child 8976
ca442cd49b9e
equal deleted inserted replaced
8972:54816b8f740f 8973:ad4848b7fd9b
738 with contextlib.suppress(Exception): 738 with contextlib.suppress(Exception):
739 result = json.loads(data) 739 result = json.loads(data)
740 740
741 return result 741 return result
742 742
743 def getPackageVersions(self, name):
744 """
745 Public method to get a list of versions available for the given
746 package.
747
748 @param name package name
749 @type str
750 @return list of available versions
751 @rtype list of str
752 """
753 result = []
754
755 if name:
756 url = "{0}/{1}/json".format(self.getIndexUrlPypi(), name)
757 request = QNetworkRequest(QUrl(url))
758 reply = self.__networkManager.get(request)
759 while not reply.isFinished():
760 QCoreApplication.processEvents()
761 QThread.msleep(100)
762
763 reply.deleteLater()
764 if reply.error() == QNetworkReply.NetworkError.NoError:
765 dataStr = str(reply.readAll(),
766 Preferences.getSystem("IOEncoding"),
767 'replace')
768 with contextlib.suppress(Exception):
769 data = json.loads(dataStr)
770 result = list(data["releases"].keys())
771
772 return result
773
743 ####################################################################### 774 #######################################################################
744 ## Cache handling methods below 775 ## Cache handling methods below
745 ####################################################################### 776 #######################################################################
746 777
747 def showCacheInfo(self, venvName): 778 def showCacheInfo(self, venvName):

eric ide

mercurial