Package org.python.pydev.ui.pythonpathconf

Examples of org.python.pydev.ui.pythonpathconf.InterpreterInfo


        Collection<String> pythonpath = new ArrayList<String>();
        pythonpath.add(TestDependent.PYTHON_LIB);
        pythonpath.add(TestDependent.PYTHON_SITE_PACKAGES);

        PreferenceStore prefs = new PreferenceStore();
        String interpreterStr = new InterpreterInfo("2.6", TestDependent.PYTHON_EXE, pythonpath).toString();
        prefs.setValue(IInterpreterManager.PYTHON_INTERPRETER_PATH, interpreterStr);
        PythonInterpreterManager manager = new PythonInterpreterManager(prefs);
        checkSameInterpreterInfo(manager);

        manager.clearCaches();
        InterpreterInfo info = checkSameInterpreterInfo(manager);

        pythonpath = new ArrayList<String>();
        pythonpath.add(TestDependent.PYTHON_LIB);
        pythonpath.add(TestDependent.PYTHON_SITE_PACKAGES);
        pythonpath.add(additionalPythonpathEntry.toString());
        interpreterStr = new InterpreterInfo("2.6", TestDependent.PYTHON_EXE, pythonpath).toString();
        prefs.setValue(IInterpreterManager.PYTHON_INTERPRETER_PATH, interpreterStr);

        info = checkSameInterpreterInfo(manager);
    }
View Full Code Here


        info = checkSameInterpreterInfo(manager);
    }

    private InterpreterInfo checkSameInterpreterInfo(PythonInterpreterManager manager) throws MisconfigurationException {
        InterpreterInfo infoInManager = manager.getInterpreterInfo(TestDependent.PYTHON_EXE, null);
        IInterpreterInfo[] interpreterInfos = manager.getInterpreterInfos();
        assertEquals(1, interpreterInfos.length);
        assertSame(interpreterInfos[0], infoInManager);
        return infoInManager;
    }
View Full Code Here

                AbstractAdditionalTokensInfo currInfo = AdditionalSystemInterpreterInfo.getAdditionalSystemInfo(
                        manager, interpreter);
                if (currInfo != null) {
                    currInfo.clearAllInfo();
                }
                InterpreterInfo defaultInterpreterInfo = (InterpreterInfo) manager.getInterpreterInfo(interpreter,
                        monitor);
                ISystemModulesManager m = defaultInterpreterInfo.getModulesManager();
                AbstractAdditionalTokensInfo info = restoreInfoForModuleManager(monitor, m,
                        "(system: " + manager.getManagerRelatedName() + " - " + interpreter + ")",
                        new AdditionalSystemInterpreterInfo(manager, interpreter), null, grammarVersion);

                if (info != null) {
View Full Code Here

        if (!new File(jythonJar).exists()) {
            throw new RuntimeException(com.aptana.shared_core.string.StringUtils.format(
                    "Error. The default configured interpreter: %s does not exist!", jythonJar));
        }
        InterpreterInfo info = (InterpreterInfo) interpreterManager.getInterpreterInfo(jythonJar,
                new NullProgressMonitor());

        //pythonpath is: base path + libs path.
        String libs = SimpleRunner.makePythonPathEnvFromPaths(info.libs);
        FastStringBuffer jythonPath = new FastStringBuffer(basePythonPath, 128);
View Full Code Here

        PythonModuleManager pythonModuleManager = new PythonModuleManager(CodeCompletionTestsBase.nature);
        if (version != null) {
            //As the files will be found in the system, we need to set the system modules manager info.
            IModulesManager modulesManager = pythonModuleManager.getIModuleManager();
            SystemModulesManager systemModulesManager = (SystemModulesManager) modulesManager.getSystemModulesManager();
            systemModulesManager.setInfo(new InterpreterInfo(version, "", new ArrayList<String>()));

            CodeCompletionTestsBase.nature.setVersion(version, null);
        }
        ModuleAdapter module = VisitorFactory.createModuleAdapter(pythonModuleManager, data.file, new Document(
                data.source), CodeCompletionTestsBase.nature, CodeCompletionTestsBase.nature);
View Full Code Here

        if (mod != null) {
            return mod;
        }

        try {
            InterpreterInfo interpreterInfo = this.getInterpreterInfo(projectInterpreterName, null);
            ISystemModulesManager modulesManager = interpreterInfo.getModulesManager();

            mod = modulesManager.getBuiltinModule("__builtin__", false);
            if (mod == null) {
                //Python 3.0 has builtins and not __builtin__
                mod = modulesManager.getBuiltinModule("builtins", false);
View Full Code Here

    public IInterpreterInfo createInterpreterInfo(String executable, IProgressMonitor monitor, boolean askUser) {

        monitor.worked(5);
        //ok, we have to get the info from the executable (and let's cache results for future use)...
        Tuple<InterpreterInfo, String> tup = null;
        InterpreterInfo info;
        try {

            tup = internalCreateInterpreterInfo(executable, monitor, askUser);
            if (tup == null) {
                //Canceled (in the dialog that asks the user to choose the valid paths)
View Full Code Here

        if (outTup.o1 == null || outTup.o1.trim().length() == 0) {
            throw new RuntimeException(
                    "No output was in the standard output when trying to create the interpreter info.\n"
                            + "The error output contains:>>" + outTup.o2 + "<<");
        }
        InterpreterInfo info = InterpreterInfo.fromString(outTup.o1, askUser);
        return info;
    }
View Full Code Here

            if (interpretersNamesToRestore != null) {
                if (!interpretersNamesToRestore.contains(interpreter)) {
                    continue; //only restore the ones specified
                }
            }
            InterpreterInfo info;
            try {
                info = getInterpreterInfo(interpreter, monitor);
                info.restorePythonpath(monitor); //that's it, info.modulesManager contains the SystemModulesManager

                List<IInterpreterObserver> participants = ExtensionHelper
                        .getParticipants(ExtensionHelper.PYDEV_INTERPRETER_OBSERVER);
                for (IInterpreterObserver observer : participants) {
                    try {
View Full Code Here

        Tuple<String, String> outTup = new SimpleJythonRunner().runAndGetOutputWithJar(FileUtils.getFileAbsolutePath(script),
                executable, null, null, null, monitor, "utf-8");

        String output = outTup.o1;

        InterpreterInfo info = createInfoFromOutput(monitor, outTup, askUser);
        if (info == null) {
            //cancelled
            return null;
        }
        //the executable is the jar itself
        info.executableOrJar = executable;

        //we have to find the jars before we restore the compiled libs
        List<File> jars = JavaVmLocationFinder.findDefaultJavaJars();
        for (File jar : jars) {
            info.libs.add(FileUtils.getFileAbsolutePath(jar));
        }

        //java, java.lang, etc should be found now
        info.restoreCompiledLibs(monitor);

        return new Tuple<InterpreterInfo, String>(info, output);
    }
View Full Code Here

TOP

Related Classes of org.python.pydev.ui.pythonpathconf.InterpreterInfo

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.