PyDev install and configure
Originally written by Chip Holden
Initial note: Befitting the Zenossian tradition of linguistic confusion, I have no idea what the official capitalization of PyDev is supposed to be. Sometimes it seems to be 'Pydev', other times 'PyDev', other times 'pydev'. Whatever.
OK, here's what I've got so far:
1. Download/Install Eclipse
Download the latest tarball of Eclipse Classic for OS X. Currently, that is version 3.3.2 and can be found here. Installing Eclipse is just a matter of untarring it wherever you'd like to run it from. I have a firmly entrenched habit of putting this kind of stuff in a devtools directory at the root level. As long as you have Java 1.5 or higher installed (which is the case for Leopard), you can run Eclipse.app in the eclipse directory that was just created.
Download the latest tarball of Eclipse Classic for OS X. Currently, that is version 3.3.2 and can be found here. Installing Eclipse is just a matter of untarring it wherever you'd like to run it from. I have a firmly entrenched habit of putting this kind of stuff in a devtools directory at the root level. As long as you have Java 1.5 or higher installed (which is the case for Leopard), you can run Eclipse.app in the eclipse directory that was just created.
2. Download/Install PyDev
Start Eclipse. It may ask you whether you want to use the current default workspace, which is in a folder named workspace in your Documents directory. In the top menu, go to Help->Software Updates->Find and Install. Select Search for new features to install and Next. Click New Remote Site on the right side and enter the name PyDev and the url http://pydev.sourceforge.net/updates/.
Start Eclipse. It may ask you whether you want to use the current default workspace, which is in a folder named workspace in your Documents directory. In the top menu, go to Help->Software Updates->Find and Install. Select Search for new features to install and Next. Click New Remote Site on the right side and enter the name PyDev and the url http://pydev.sourceforge.net/updates/.
If PyDev is not already checked, check it before pressing Finish. Open up the PyDev node and only check the PyDev for Eclipse 1.3.15 checkbox. Do not check the Mylyn or Mylar integration checkboxes. Click next, agree to the license, click next, then click Finish. A do-you-really-wanna-do-this dialog will pop up. Assuming you haven't had a change of heart, click it, let it finish installing, then let it restart Eclipse.
3. Download/Install Subversive
Go back to the Software Updates install dialog (Help->Software Updates->Find and Install). Again select Search for new features to install and New Remote Site. This time enter Subversive as the name and http://download.eclipse.org/technology/subversive/0.7/update-site/ as the url. Then do the same for Subversive connectors and http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/. Click through to the Updates dialog. Unselect all the components that are missing prerequisites.
Go back to the Software Updates install dialog (Help->Software Updates->Find and Install). Again select Search for new features to install and New Remote Site. This time enter Subversive as the name and http://download.eclipse.org/technology/subversive/0.7/update-site/ as the url. Then do the same for Subversive connectors and http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/. Click through to the Updates dialog. Unselect all the components that are missing prerequisites.
4. Configure the interpreter
Got to Eclipse->Preferences->PyDev->Interpreter - Python. Click New to add a new interpreter. Add the interpreter in the Zenoss install at $ZENHOME/bin/python2.4 (or whatever interpreter you plan to use). That should drag a bunch of stuff into your PYTHONPATH and Forced built-ins.
Got to Eclipse->Preferences->PyDev->Interpreter - Python. Click New to add a new interpreter. Add the interpreter in the Zenoss install at $ZENHOME/bin/python2.4 (or whatever interpreter you plan to use). That should drag a bunch of stuff into your PYTHONPATH and Forced built-ins.
5. Create zenoss project
Okay, here's where the hack-a-shaq starts. There's a couple of ways to do this and I'm not sure which is best yet. I'll put the one that has worked best (meaning 'least sucky') for me, so far.
Go to Window->Open Perspective->Other...->SVN Repository Exploring. At the top of the left-hand SVN Repository pane, click the second-to-last button on right to add a New Repository Location. In the URL field, enter http://dev.zenoss.com/svn. Right click trunk and choose Find/Check Out As.
When the Check Out As dialog comes up, keep the top radio button selected (yaddayaddaNew Project wizard) but unselect the Checkout recursively box below. When asked to select a wizard, choose Pydev Project. Choose a Project name-- something tasteful but possibly hinting at missed opportunities and lost love. I chose core. Might I also suggest dachsund? Keep the Use default box checked but uncheck Create default 'src' folder, then hit Finish. At this point, Eclipse may warn you about overwriting local files with files from the repository. Ignore that; it's just Eclipse being overprotective as usual. Remember when Eclipse was so much more carefree? Whatever happened to the Eclipse that drove her Miata down MLK at 3 in the morning with the headlights off and an empty Coors Light box over her head? IT'S LIKE I DON'T EVEN KNOW YOU ANYMORE, ECLIPSE! Anyway, this checkout may take a few seconds, so feel free to relax and have a beer, perhaps a Coors Light if there are any left. Now go back to the Subversion browsing, open trunk, and select Products and zenpacks. Right-click them and select Find/Check Out As. Select the radio button for Check out as a folders(sic) into existing project and make sure the Checkout recursively is checked. Check them out into the project you just created.
Press Command-Shift-R. That should bring up a dialog for finding files. Enter zenhub.py and open the file. In the imports, go down to the import line "from twisted.cred import portal, checkers, etc." Hold down the Command and hover over the word portal. It should turn into a link. Click the link. It should take you to portal.py. Go back to zenhub.py. Try the same thing with Event on the "from Products.ZenEvents.Event import Event" line. It barks no-go. I think this is because PyDev doesn't recognize Products as a valid package yet because there's no __init__. Add an empty __init__.py file to Products then right-click on the project and choose Refresh. Now go back to zenhub.py and try to Command-click Event. It should take you to the Event class in the Event.py file.
Issues:
- PyDev extensions - The option for-pay extensions are available at http://www.fabioz.com/pydev/updates/. I haven't figured out exactly what they bring. I need to figure this out. They're $40 a seat. One thing they bring is a boatload of warnings/errors about doing tricky things. I may turn all of this off.
- I'm sure there's a better way (like some script that moves/mods files appropriately).