[Pydev-cvs] org.python.pydev/src/org/python/pydev/utils SimplePythonRunner.java,1.5,1.6
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2005-05-05 14:02:25
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1159/src/org/python/pydev/utils Modified Files: SimplePythonRunner.java Log Message: Indentation and PyLint with project Pythonpath Index: SimplePythonRunner.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/utils/SimplePythonRunner.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SimplePythonRunner.java 16 Feb 2005 16:48:48 -0000 1.5 --- SimplePythonRunner.java 5 May 2005 14:01:57 -0000 1.6 *************** *** 10,13 **** --- 10,14 ---- import java.io.IOException; import java.io.InputStreamReader; + import java.util.List; import org.eclipse.core.runtime.CoreException; *************** *** 15,18 **** --- 16,21 ---- import org.python.pydev.plugin.PydevPlugin; import org.python.pydev.plugin.PydevPrefs; + import org.python.pydev.ui.PyProjectProperties; + import org.eclipse.core.resources.IProject; /** *************** *** 40,43 **** --- 43,51 ---- } + + public static String runAndGetOutput(String script, String args, File workingDir) { + return runAndGetOutput(script, args, workingDir, null); + } + /** * Execute the string and format for windows if we have spaces... *************** *** 48,52 **** * @return */ ! public static String runAndGetOutput(String script, String args, File workingDir) { String osName = System.getProperty("os.name"); --- 56,60 ---- * @return */ ! public static String runAndGetOutput(String script, String args, File workingDir, IProject project) { String osName = System.getProperty("os.name"); *************** *** 60,66 **** String executionString = PydevPrefs.getDefaultInterpreter() + " -u " + script + " " + args; //System.out.println(executionString); ! return runAndGetOutput(executionString, workingDir); } /** * --- 68,78 ---- String executionString = PydevPrefs.getDefaultInterpreter() + " -u " + script + " " + args; //System.out.println(executionString); ! return runAndGetOutput(executionString, workingDir, project); } + public static String runAndGetOutput(String executionString, File workingDir) { + return runAndGetOutput(executionString, workingDir, null); + } + /** * *************** *** 69,76 **** * @throws CoreException */ ! public static String runAndGetOutput(String executionString, File workingDir) { Process process = null; try { ! process = Runtime.getRuntime().exec(executionString, null, workingDir); } catch (Exception e) { throw new RuntimeException(e); --- 81,107 ---- * @throws CoreException */ ! public static String runAndGetOutput(String executionString, File workingDir, IProject project) { Process process = null; try { ! if (project != null) { ! List paths = PyProjectProperties.getProjectPythonPath(project); ! int envSize = paths.size(); ! if (envSize < 1) { ! process = Runtime.getRuntime().exec(executionString, null, workingDir); ! } else { ! String path = "PYTHONPATH="; ! for (int i = 0; i < envSize; i++) { ! if (i > 0) ! path = path.concat(";");//XXX Need to be platform specific ! path = path.concat(paths.get(i).toString()); ! } ! ! String[] envp = new String[1]; ! envp[0] = path; ! process = Runtime.getRuntime().exec(executionString, envp, workingDir); ! } ! } else { ! process = Runtime.getRuntime().exec(executionString, null, workingDir); ! } } catch (Exception e) { throw new RuntimeException(e); |