Package org.python.pydev.utils

Examples of org.python.pydev.utils.PyFileListing$PyFileInfo


            if (!container.exists()) {
                throw new RuntimeException("The directory passed: " + container + " no longer exists.");
            }

            File file = container.getLocation().toFile();
            PyFileListing pyFilesBelow = new PyFileListing();

            if (file.exists()) {
                pyFilesBelow = PyFileListing.getPyFilesBelow(file, monitor, true, false);
            }

            if (pyFilesBelow.getFoundPyFileInfos().size() == 0) { //no files
                return;
            }

            //add the folders to the cache
            boolean added = false;
            for (Iterator<File> it = pyFilesBelow.getFoundFolders().iterator(); it.hasNext();) {
                File f = it.next();
                if (!added) {
                    cache.addFolder(f);
                    added = true;
                } else {
                    cache.addFolder(f, f.getParentFile());
                }
            }

            PythonNature nature = PythonNature.getPythonNature(container);
            if (nature == null) {
                throw new RuntimeException("The directory passed: " + container
                        + " does not have an associated nature.");
            }
            AbstractRunner runner = UniversalRunner.getRunner(nature);

            //First, combine the results of the many runs we may have.
            Tuple<String, String> output = runner.runScriptAndGetOutput(PythonRunnerConfig.getCoverageScript(),
                    new String[] { "combine" }, getCoverageDirLocation(), monitor);

            if (output.o1 != null && output.o1.length() > 0) {
                Log.logInfo(output.o1);
            }
            if (output.o2 != null && output.o2.length() > 0) {
                if (output.o2.startsWith("Coverage.py warning:")) {
                    Log.logInfo(output.o2);

                } else {
                    Log.log(output.o2);
                }
            }

            //we have to make a process to execute the script. it should look
            // like:
            //coverage.py -r [-m] FILE1 FILE2 ...
            //Report on the statement coverage for the given files. With the -m
            //option, show line numbers of the statements that weren't
            // executed.

            //python coverage.py -r -m files....

            monitor.setTaskName("Starting shell to get info...");
            monitor.worked(1);
            Process p = null;

            try {
                //                Tuple<Process, String> tup = runner.createProcess(
                //                        PythonRunnerConfig.getCoverageScript(), new String[]{
                //                            "-r", "-m", "--include", ".*"}, getCoverageDirLocation(), monitor);
                Tuple<Process, String> tup = runner.createProcess(PythonRunnerConfig.getCoverageScript(),
                        new String[] { "--pydev-analyze" }, getCoverageDirLocation(), monitor);
                p = tup.o1;
                try {
                    p.exitValue();
                    throw new RuntimeException("Some error happened... the process could not be created.");
                } catch (Exception e) {
                    //that's ok
                }

                String files = "";

                for (Iterator<PyFileInfo> iter = pyFilesBelow.getFoundPyFileInfos().iterator(); iter.hasNext();) {
                    String fStr = iter.next().getFile().toString();
                    files += fStr + "|";
                }
                files += "\r";
                monitor.setTaskName("Writing to shell...");
View Full Code Here


                break;
            }

            //the slow part is getting the files... not much we can do (I think).
            File root = new File(element);
            PyFileListing below = getModulesBelow(root, monitor);
            if (below != null) {

                Iterator<PyFileInfo> e1 = below.getFoundPyFileInfos().iterator();
                while (e1.hasNext()) {
                    PyFileInfo pyFileInfo = e1.next();
                    File file = pyFileInfo.getFile();
                    String modName = pyFileInfo.getModuleName(tempBuf);
                    if (isValidModuleLastPart(FullRepIterable.getLastPart(modName))) {
View Full Code Here

TOP

Related Classes of org.python.pydev.utils.PyFileListing$PyFileInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.