Search in sources :

Example 1 with PythonPathContributingFacet

use of com.jetbrains.python.facet.PythonPathContributingFacet in project intellij-community by JetBrains.

the class PythonCommandLineState method addRootsFromModule.

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);
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) PythonPathContributingFacet(com.jetbrains.python.facet.PythonPathContributingFacet) LibraryContributingFacet(com.jetbrains.python.facet.LibraryContributingFacet) PythonPathContributingFacet(com.jetbrains.python.facet.PythonPathContributingFacet) Facet(com.intellij.facet.Facet)

Aggregations

Facet (com.intellij.facet.Facet)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 LibraryContributingFacet (com.jetbrains.python.facet.LibraryContributingFacet)1 PythonPathContributingFacet (com.jetbrains.python.facet.PythonPathContributingFacet)1