959 indexUrl = Preferences.getPip("PipSearchIndex") + "/simple" |
959 indexUrl = Preferences.getPip("PipSearchIndex") + "/simple" |
960 args += ["--index-url", indexUrl] |
960 args += ["--index-url", indexUrl] |
961 |
961 |
962 if callback: |
962 if callback: |
963 if self.__outdatedProc is not None: |
963 if self.__outdatedProc is not None: |
|
964 self.__outdatedProc.finished.disconnect() |
964 self.__outdatedProc.kill() # end the process forcefully |
965 self.__outdatedProc.kill() # end the process forcefully |
965 self.__outdatedProc = None |
966 self.__outdatedProc = None |
966 |
967 |
967 proc = EricProcess(timeout=30000) |
968 proc = EricProcess(timeout=30000) |
968 self.__outdatedProc = proc |
969 self.__outdatedProc = proc |
970 functools.partial(self.__outdatedFinished, callback, proc) |
971 functools.partial(self.__outdatedFinished, callback, proc) |
971 ) |
972 ) |
972 proc.start(interpreter, args) |
973 proc.start(interpreter, args) |
973 return None |
974 return None |
974 |
975 |
975 proc = QProcess() |
976 else: |
976 proc.start(interpreter, args) |
977 proc = QProcess() |
977 if proc.waitForStarted(15000) and proc.waitForFinished(30000): |
978 proc.start(interpreter, args) |
978 packages = self.__extractOutdatedPackages(proc) |
979 if proc.waitForStarted(15000) and proc.waitForFinished(30000): |
|
980 packages = self.__extractOutdatedPackages(proc) |
979 |
981 |
980 return packages |
982 return packages |
981 |
983 |
982 def __extractOutdatedPackages(self, proc): |
984 def __extractOutdatedPackages(self, proc): |
983 """ |
985 """ |
1362 ).strip() |
1364 ).strip() |
1363 with contextlib.suppress(json.JSONDecodeError): |
1365 with contextlib.suppress(json.JSONDecodeError): |
1364 licenses = json.loads(output) |
1366 licenses = json.loads(output) |
1365 |
1367 |
1366 return licenses |
1368 return licenses |
|
1369 |
|
1370 ####################################################################### |
|
1371 ## Cleanup of the site-packages directory in case pip updated or |
|
1372 ## removed packages currently in use. |
|
1373 ####################################################################### |
|
1374 |
|
1375 def runCleanup(self, envName): |
|
1376 """ |
|
1377 Public method to perform a cleanup run for a given environment. |
|
1378 |
|
1379 @param envName name of the environment to get the licenses for |
|
1380 @type str |
|
1381 @return flag indicating a successful removal. A missing environment |
|
1382 name or an undefined Python interpreter is treated as success |
|
1383 (i.e. nothing to do). |
|
1384 @rtype bool |
|
1385 """ |
|
1386 if envName: |
|
1387 interpreter = self.getVirtualenvInterpreter(envName) |
|
1388 if interpreter: |
|
1389 args = [os.path.join(os.path.dirname(__file__), "pipcleanup.py")] |
|
1390 |
|
1391 proc = QProcess() |
|
1392 proc.start(interpreter, args) |
|
1393 if proc.waitForStarted(15000) and proc.waitForFinished(30000): |
|
1394 return proc.exitCode() == 0 |
|
1395 |
|
1396 return False |
|
1397 |
|
1398 return True |