IDEA-CR-10973 If packaging_tool.py fails, initialize cache with empty list
authorMikhail Golubev <mikhail.golubev@jetbrains.com>
Thu, 16 Jun 2016 17:25:53 +0000 (20:25 +0300)
committerMikhail Golubev <mikhail.golubev@jetbrains.com>
Thu, 23 Jun 2016 14:40:57 +0000 (17:40 +0300)
This way we won't keep calling the script over and over again via
PyPackageUtil#refreshAndGetPackagesModally() (e.g. in various project
wizards) if for some reason it doesn't succeed first time.

python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java

index da4e302f641f2bcd3e61a946394ec42e5ea1e3ff..2a4333cc84f81f45a854e0c2e6dea4c6009a4c43 100644 (file)
@@ -363,7 +363,11 @@ public class PyPackageManagerImpl extends PyPackageManager {
         final List<PyPackage> packages = collectPackages();
         LOG.debug("Packages installed in " + mySdk.getName() + ": " + packages);
         myPackagesCache = packages;
-        return packages;
+        return Collections.unmodifiableList(packages);
+      }
+      catch (ExecutionException e) {
+        myPackagesCache = Collections.emptyList();
+        throw e;
       }
       finally {
         myUpdatingCache = false;