开发者

Automate PyDev Interpreter setup

I have a scenario where I want to be able automate the setting up of various Python interpreters for use in PyDev. These interpreters have special environment variables, forced built-ins 开发者_运维百科and libraries defined. Is there a way through perhaps an .ini file or through the PyDev / Jython API to programmatically define Python interpreters for PyDev?


In the Java API it's something as:

IInterpreterManager manager = PydevPlugin.getPythonInterpreterManager(true);
manager.setInfos(exesList, interpreterNamesToRestore, monitor);

The exesList is a list of org.python.pydev.ui.pythonpathconf.InterpreterInfo and the interpreterNamesToRestore a list of the interpreters that were changed (i.e.: should have the pythonpath restored).

You could probably do this from Jython, but PyDev provides no hooks where you'd be able to do that (i.e.: it only provides hooks for setting up an editor), so, the best solution right now would be creating a simple eclipse plugin that had an earlyStartup to do the configuration you want (should be straightforward).


I had this same question a while back after getting frustrated with Eclipse plug-ins fighting each other and ruining otherwise 'pristine' setups so I dug around and found these nifty tidbits:

Eclipse run-time options (cli options for running what would otherwise be captive-UI features.

Running Eclipse's update manager from the CLI

So, if you read through the run-time options a bit, you'll come across..

eclipse.pluginCustomization {-pluginCustomization}
the file system location of a properties file containing default settings for 
plug-in preferences. These default settings override default settings 
specified in the primary feature. Relative paths are interpreted relative 
to the current working directory for Eclipse itself.

Which will probably do what you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜