= How to develop Trac with Eclipse PyDev = == Installation == Install Eclipse (3.3 or newer will do) and pydev. Also either subclipse or subversive is good to have. 1. Install prerequisities, at least Genshi {{{ $ easy_install genshi }}} 2. You can check out the trac sources inside eclipse using either the subclipse or the subversive plugin. 3. Then build the setuptools info file from the command line {{{ $ set PYTHONPATH=c:\path\to\your\trac\sources $ python setup.py egg_info }}} 4. Create a trac environment, e.g. {{{ $ trac-admin /path/to/myproject initenv }}} This is of course a bit tricky if you don't have trac installed in system so workflow is a bit different: {{{ $ set PYTHONPATH=c:\path\to\your\trac\sources $ python >>> import trac.admin.console >>> trac.admin.console.run(['/path/to/myproject', 'initenv']) }}} 5. In Eclipse, make sure that the PYTHONPATH in the project properties dialog includes the sources for trac. 6. Create an initial run configuration by clicking right on ''trac/web/standalone.py file'', and choosing ''Run As->Python Run''. trac will complain that no environment has been set. 7. Select ''Run->Open Run Dialog...'' and set the correct command line arguments in the ''arguments'' tab, eg. ''--port 8000 /path/to/myproject'' (Note that the option --auto-reload will cause tracd to restart every time source code has been changed, but it seems to prevent debugging with pydev. Does someone have a clue?) 8. You should now be able to run tracd, as well as to debug it using the same run configuration. To run the test cases, just click on a test folder and select ''Run->Python unit tests'' 9. To debug a plugin, deploy it into your test environment via {{{ $ python setup.py develop -md /path/to/projenv/plugins }}} and then start the run configuration from above. If you are experiencing troubles in debugging Trac code, make sure that PYTHONPATH in project properties doesn't contain pointers to other Trac sources. Otherwise those sources will be picked instead checked out. Note: It could be wise to setup virtualenv and install genshi, babel etc. there. Then debugging is easier and it doesn't interfere with existing Trac sources. == Automatic translation compilation == If you want to setup automatic translation compilation it can be done very easily. 1. Right click on trac project and select ''Properties''. Select ''Builders''. Click ''New''. Select ''Program''. 2. Name builder, like 'Locale fi_FI builder' 3. ''Main'' tab: ''Location'': click ''Browse File System...''. Select Python executable.[[BR]] ''Working Directory'': set it to ''${project_loc}''[[BR]] ''Arguments'': ''setup.py compile_catalog -f -l fi_FI'' (change to your locale)[[BR]] 4. ''Refresh'' tab: Check ''Refresh resources upon completion''.[[BR]] Select ''Spesific resources'' and select ''trac/locale/fi_FI'' (select your locale)[[BR]] 5. ''Build Options'' tab: Check ''During auto builds''.[[BR]] Check ''Specify working set of relevan resources''.[[BR]] Click ''Specify resources...''. select ''trac/locale/fi_FI'' (select your locale, same as in step 4).[[BR]] Name it like ''fi_FI locale''.[[BR]] 6. After modifying your message.po file you should get following output: {{{ running compile_catalog compiling catalog 'trac/locale\\fi_FI\\LC_MESSAGES\\messages.po' to 'trac/locale\\fi_FI\\LC_MESSAGES\\messages.mo' }}} And if Trac is running you will have changes immediately effective. == Thanks == Originally these instructions were [http://groups.google.de/group/trac-dev/msg/235281558542b2ff posted on trac-dev list] by Joachim Hoessler.