We use a script to install Eclipse and set up a workspace automatically on each user's machine. The first time the user starts Eclipse, Pydev should be set up to use a specific Python interpreter and path-no clicking required.
At first I tried to implement the initial setup in an Eclipse plugin, which worked, but seems an awfully complex way to solve such a simple problem. Pydev already knows how to read its settings from a file. I just need to populate the settings file and then cause Pydev to do its normal scan of the path.
I figured out a rather hacky but simple way to initialize the Pydev settings file:
PYTHONPATH=/my/extra/python/modules python /my/eclipse/plugins/org.python.pydev_*/PySrc/interpreterInfo.py 2>/dev/null | sed 's/INS_PATH$//g;s/OUT_PATH$//g;s/^EXECUTABLE:/Executable\\:/g' | tr -d '\n' | cat <(echo -en 'eclipse.preferences.version=1\nINTERPRETER_PATH_NEW=Name\:python\:EndName\:') - <(echo '&&&&&') >/my/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.python.pydev.prefs
This only works in a fresh workspace; if it already contains Pydev metadata, then Pydev doesn't try to scan the path and the user is stuck doing it manually.
I thought I'd share this in case anyone else is trying to solve a similar problem.