private static String getOutput(Module module1, boolean test) {
   CompilerModuleExtension compilerModuleExtension = CompilerModuleExtension.getInstance(module1);
   assertNotNull(compilerModuleExtension);
   VirtualFile output =
       test
           ? compilerModuleExtension.getCompilerOutputPathForTests()
           : compilerModuleExtension.getCompilerOutputPath();
   return getFSPath(output);
 }
  private static void addRootsFromModule(Module module, Collection<String> pythonPathList) {

    // for Jython
    final CompilerModuleExtension extension = CompilerModuleExtension.getInstance(module);
    if (extension != null) {
      final VirtualFile path = extension.getCompilerOutputPath();
      if (path != null) {
        pythonPathList.add(path.getPath());
      }
      final VirtualFile pathForTests = extension.getCompilerOutputPathForTests();
      if (pathForTests != null) {
        pythonPathList.add(pathForTests.getPath());
      }
    }

    // additional paths from facets (f.e. buildout)
    final Facet[] facets = FacetManager.getInstance(module).getAllFacets();
    for (Facet facet : facets) {
      if (facet instanceof PythonPathContributingFacet) {
        List<String> more_paths = ((PythonPathContributingFacet) facet).getAdditionalPythonPath();
        if (more_paths != null) pythonPathList.addAll(more_paths);
      }
    }
  }
예제 #3
0
 /**
  * @param module
  * @param forTestClasses true if directory for test sources, false - for sources.
  * @return a directory to which the sources (or test sources depending on the second partameter)
  *     should be compiled. Null is returned if output directory is not specified or is not valid
  */
 @Nullable
 public static VirtualFile getModuleOutputDirectory(final Module module, boolean forTestClasses) {
   final CompilerModuleExtension compilerModuleExtension =
       CompilerModuleExtension.getInstance(module);
   VirtualFile outPath;
   if (forTestClasses) {
     final VirtualFile path = compilerModuleExtension.getCompilerOutputPathForTests();
     if (path != null) {
       outPath = path;
     } else {
       outPath = compilerModuleExtension.getCompilerOutputPath();
     }
   } else {
     outPath = compilerModuleExtension.getCompilerOutputPath();
   }
   if (outPath == null) {
     return null;
   }
   if (!outPath.isValid()) {
     LOG.info("Requested output path for module " + module.getName() + " is not valid");
     return null;
   }
   return outPath;
 }
 private static void removeModuleOutput(Module module, List<VirtualFile> from) {
   final CompilerModuleExtension extension =
       ModuleRootManager.getInstance(module).getModuleExtension(CompilerModuleExtension.class);
   from.remove(extension.getCompilerOutputPath());
   from.remove(extension.getCompilerOutputPathForTests());
 }