1362 ).strip() |
1362 ).strip() |
1363 with contextlib.suppress(json.JSONDecodeError): |
1363 with contextlib.suppress(json.JSONDecodeError): |
1364 licenses = json.loads(output) |
1364 licenses = json.loads(output) |
1365 |
1365 |
1366 return licenses |
1366 return licenses |
|
1367 |
|
1368 ####################################################################### |
|
1369 ## Cleanup of the site-packages directory in case pip updated or |
|
1370 ## removed packages currently in use. |
|
1371 ####################################################################### |
|
1372 |
|
1373 def runCleanup(self, envName): |
|
1374 """ |
|
1375 Public method to perform a cleanup run for a given environment. |
|
1376 |
|
1377 @param envName name of the environment to get the licenses for |
|
1378 @type str |
|
1379 @return flag indicating a successful removal. A missing environment |
|
1380 name or an undefined Python interpreter is treated as success |
|
1381 (i.e. nothing to do). |
|
1382 @rtype bool |
|
1383 """ |
|
1384 if envName: |
|
1385 interpreter = self.getVirtualenvInterpreter(envName) |
|
1386 if interpreter: |
|
1387 args = [os.path.join(os.path.dirname(__file__), "pipcleanup.py")] |
|
1388 |
|
1389 proc = QProcess() |
|
1390 proc.start(interpreter, args) |
|
1391 if proc.waitForStarted(15000) and proc.waitForFinished(30000): |
|
1392 return proc.exitCode() == 0 |
|
1393 |
|
1394 return False |
|
1395 |
|
1396 return True |