24 QNetworkRequest, |
24 QNetworkRequest, |
25 ) |
25 ) |
26 from PyQt6.QtWidgets import QDialog, QInputDialog, QLineEdit |
26 from PyQt6.QtWidgets import QDialog, QInputDialog, QLineEdit |
27 |
27 |
28 from eric7 import Preferences |
28 from eric7 import Preferences |
|
29 from eric7.EricCore.EricProcess import EricProcess |
29 from eric7.EricNetwork.EricNetworkProxyFactory import ( |
30 from eric7.EricNetwork.EricNetworkProxyFactory import ( |
30 EricNetworkProxyFactory, |
31 EricNetworkProxyFactory, |
31 proxyAuthenticationRequired, |
32 proxyAuthenticationRequired, |
32 ) |
33 ) |
33 from eric7.EricWidgets import EricMessageBox |
34 from eric7.EricWidgets import EricMessageBox |
84 self.__networkManager.sslErrors.connect( |
85 self.__networkManager.sslErrors.connect( |
85 self.__sslErrorHandler.sslErrorsReply |
86 self.__sslErrorHandler.sslErrorsReply |
86 ) |
87 ) |
87 self.__replies = [] |
88 self.__replies = [] |
88 |
89 |
|
90 self.__outdatedProc = None |
|
91 |
89 self.__vulnerabilityChecker = PipVulnerabilityChecker(self, self) |
92 self.__vulnerabilityChecker = PipVulnerabilityChecker(self, self) |
90 |
93 |
91 def getNetworkAccessManager(self): |
94 def getNetworkAccessManager(self): |
92 """ |
95 """ |
93 Public method to get a reference to the network access manager object. |
96 Public method to get a reference to the network access manager object. |
103 |
106 |
104 @return reference to the vulnerability checker object |
107 @return reference to the vulnerability checker object |
105 @rtype PipVulnerabilityChecker |
108 @rtype PipVulnerabilityChecker |
106 """ |
109 """ |
107 return self.__vulnerabilityChecker |
110 return self.__vulnerabilityChecker |
|
111 |
|
112 def shutdown(self): |
|
113 """ |
|
114 Public method to perform shutdown actions. |
|
115 """ |
|
116 if self.__outdatedProc is not None: |
|
117 self.__outdatedProc.kill() # end the process forcefully |
|
118 self.__outdatedProc = None |
108 |
119 |
109 ########################################################################## |
120 ########################################################################## |
110 ## Methods below implement some utility functions |
121 ## Methods below implement some utility functions |
111 ########################################################################## |
122 ########################################################################## |
112 |
123 |
923 |
934 |
924 if Preferences.getPip("PipSearchIndex"): |
935 if Preferences.getPip("PipSearchIndex"): |
925 indexUrl = Preferences.getPip("PipSearchIndex") + "/simple" |
936 indexUrl = Preferences.getPip("PipSearchIndex") + "/simple" |
926 args += ["--index-url", indexUrl] |
937 args += ["--index-url", indexUrl] |
927 |
938 |
928 proc = QProcess() |
|
929 if callback: |
939 if callback: |
|
940 if self.__outdatedProc is not None: |
|
941 self.__outdatedProc.kill() # end the process forcefully |
|
942 self.__outdatedProc = None |
|
943 |
|
944 proc = EricProcess(timeout=30000) |
930 self.__outdatedProc = proc |
945 self.__outdatedProc = proc |
931 proc.finished.connect( |
946 proc.finished.connect( |
932 functools.partial(self.__outdatedFinished, callback, proc) |
947 functools.partial(self.__outdatedFinished, callback, proc) |
933 ) |
948 ) |
934 proc.start(interpreter, args) |
949 proc.start(interpreter, args) |
935 return None |
950 return None |
936 |
951 |
|
952 proc = QProcess() |
937 proc.start(interpreter, args) |
953 proc.start(interpreter, args) |
938 if proc.waitForStarted(15000) and proc.waitForFinished(30000): |
954 if proc.waitForStarted(15000) and proc.waitForFinished(30000): |
939 packages = self.__extractOutdatedPackages(proc) |
955 packages = self.__extractOutdatedPackages(proc) |
940 |
956 |
941 return packages |
957 return packages |
987 @param exitStatus exit status of the process |
1003 @param exitStatus exit status of the process |
988 @type QProcess.ExitStatus |
1004 @type QProcess.ExitStatus |
989 """ |
1005 """ |
990 packages = ( |
1006 packages = ( |
991 self.__extractOutdatedPackages(proc) |
1007 self.__extractOutdatedPackages(proc) |
992 if exitStatus == QProcess.ExitStatus.NormalExit and exitCode == 0 |
1008 if ( |
|
1009 not proc.timedOut() |
|
1010 and exitStatus == QProcess.ExitStatus.NormalExit |
|
1011 and exitCode == 0 |
|
1012 ) |
993 else {} |
1013 else {} |
994 ) |
1014 ) |
995 callback(packages) |
1015 callback(packages) |
996 self.__outdatedProc = None |
1016 self.__outdatedProc = None |
997 |
1017 |