3 | | == Installing and configuring Python == |
4 | | |
5 | | === Python === |
6 | | |
7 | | Download and install latest [http://www.python.org/download/ Python]. |
8 | | |
9 | | === easy_install === |
10 | | |
11 | | Go to [http://peak.telecommunity.com/DevCenter/EasyInstall#installing-easy-install installing-easy-install] and follow the instructions there. |
12 | | |
13 | | However, most of the time you just take the file [http://peak.telecommunity.com/dist/ez_setup.py ez_setup.py], save it as ez_setup.py on your hard drive, and then from the command-line prompt type: |
14 | | {{{ |
15 | | python ez_setup.py |
16 | | }}} |
17 | | |
18 | | To test if the installation was successful, try typing from command-line prompt: |
19 | | {{{ |
20 | | easy_install --help |
21 | | }}} |
22 | | |
23 | | If it doesn't work, check to make sure your PATH includes the appropriate C:\\Python2X\\Scripts directory. See more info on [http://peak.telecommunity.com/DevCenter/EasyInstall Windows Notes] at easy_install manual page. |
24 | | |
25 | | === Genshi === |
26 | | |
27 | | Install [http://genshi.edgewall.org Genshi] using easy_install: |
28 | | {{{ |
29 | | easy_install genshi |
30 | | }}} |
31 | | |
32 | | You can also install using [http://genshi.edgewall.org/wiki/Download Genshi] windows installer or python egg if you prefer. |
33 | | |
34 | | == Installing and configuring Trac == |
35 | | |
36 | | === Downloading trac === |
37 | | From the command-line prompt: |
38 | | {{{ |
39 | | svn co http://svn.edgewall.org/repos/trac/trunk/ trac-trunk |
40 | | svn co http://svn.edgewall.org/repos/genshi/trunk/ genshi-trunk |
41 | | cd genshi-trunk |
42 | | python setup.py develop |
43 | | cd ../trac-trunk |
44 | | python setup.py develop |
45 | | cd .. |
46 | | }}} |
47 | | |
48 | | === Setuptools === |
49 | | |
50 | | Then build the setuptools info file from the command line |
51 | | {{{ |
52 | | $ set PYTHONPATH=c:\path\to\your\trac\sources |
53 | | $ python setup.py egg_info |
54 | | }}} |
55 | | |
56 | | This is of course a bit tricky if you don't have trac installed in system so workflow is a bit different: |
57 | | {{{ |
58 | | $ set PYTHONPATH=c:\path\to\your\trac\sources |
59 | | $ python |
60 | | >>> import trac.admin.console |
61 | | >>> trac.admin.console.run(['/path/to/myproject', 'initenv']) |
62 | | }}} |
63 | | |
64 | | === Creating test trac environment === |
65 | | From the command-line prompt: |
66 | | {{{ |
67 | | trac-admin /path/to/myproject initenv |
68 | | }}} |
69 | | '''note:''' Press return for every option. |
70 | | |
71 | | === Make anonymous users have full access === |
72 | | {{{ |
73 | | trac-admin test permission add anonymous TRAC_ADMIN |
74 | | }}} |
75 | | '''note:''' Don't do this in production! |
76 | | |
| 3 | Follow the instructions for ''Setting up the environment'' and ''Installing and configuring Trac'' on the [TracDev/DevelopmentEnvironmentSetup Developer setup for Trac] page, before configuring Eclipse and !PyDev. |
80 | | 1. Install [http://www.eclipse.org Eclipse] (3.3 or newer will do) |
81 | | |
82 | | 2. Install [http://pydev.sourceforge.net PyDev] |
83 | | |
84 | | 3. Also either [http://subclipse.tigris.org Subclipse] or [http://www.eclipse.org/subversive/ Subversive] is good to have for integrated support of SVN. |
85 | | |
86 | | 4. In Eclipse, make sure that the PYTHONPATH in the project properties dialog includes the sources for trac. |
87 | | |
88 | | 5. 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. |
89 | | |
90 | | 6. Select ''Run->Open Run Dialog...'' and set the correct command line arguments in the ''arguments'' tab, eg. ''--port 8000 /path/to/myproject''. |
91 | | Note that the option --auto-reload will cause tracd to restart every time source code has been changed, but it seems to prevent |
92 | | debugging with pydev. This seems to have something to do way Trac reloads new instance as a child thread using "thread" library which |
93 | | doesn't seem to be compatible with pydev debugging. Googling revelead some hints that instead using "thread"-module you should use |
94 | | "threading"-module (higherlevel) |
95 | | |
96 | | 7. 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'' |
97 | | |
98 | | 8. To debug a plugin, deploy it into your test environment via |
99 | | {{{ |
100 | | $ python setup.py develop -md /path/to/projenv/plugins |
101 | | }}} |
102 | | and then start the run configuration from above. |
103 | | 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. |
104 | | |
105 | | 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. |
| 7 | 1. Install [http://www.eclipse.org Eclipse] (3.3 or newer will do). |
| 8 | 1. Install the [http://pydev.sourceforge.net PyDev] plugin for Eclipse. |
| 9 | 1. (Optional) Install either [http://subclipse.tigris.org Subclipse] or [http://www.eclipse.org/subversive/ Subversive] for Eclipse-integrated Subversion tools. |
| 10 | 1. In Eclipse, make sure that the PYTHONPATH in the project properties dialog includes the sources for trac. |
| 11 | 1. 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. |
| 12 | 1. Select ''Run->Open Run Dialog...'' and set the correct command line arguments in the ''arguments'' tab, eg. ''--port 8000 /path/to/myproject''. |
| 13 | * 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. This seems to have something to do way Trac reloads new instance as a child thread using "thread" library which doesn't seem to be compatible with !PyDev debugging. Googling revelead some hints that instead using "thread"-module you should use "threading"-module (higherlevel) |
| 14 | 1. 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'' |
112 | | |
113 | | 2. Name builder, like 'Locale fi_FI builder' |
114 | | |
115 | | 3. ''Main'' tab: |
116 | | ''Location'': click ''Browse File System...''. Select Python executable.[[BR]] |
117 | | ''Working Directory'': set it to ''${project_loc}''[[BR]] |
118 | | ''Arguments'': ''setup.py compile_catalog -f -l fi_FI'' (change to your locale)[[BR]] |
119 | | |
120 | | 4. ''Refresh'' tab: |
121 | | Check ''Refresh resources upon completion''.[[BR]] |
122 | | Select ''Spesific resources'' and select ''trac/locale/fi_FI'' (select your locale)[[BR]] |
123 | | |
124 | | 5. ''Build Options'' tab: |
125 | | Check ''During auto builds''.[[BR]] |
126 | | Check ''Specify working set of relevan resources''.[[BR]] |
127 | | Click ''Specify resources...''. select ''trac/locale/fi_FI'' (select your locale, same as in step 4).[[BR]] |
128 | | Name it like ''fi_FI locale''.[[BR]] |
129 | | |
130 | | 6. After modifying your message.po file you should get following output: |
| 21 | 1. Name builder, like 'Locale fi_FI builder' |
| 22 | 1. ''Main'' tab: |
| 23 | * ''Location'': click ''Browse File System...''. Select Python executable. |
| 24 | * ''Working Directory'': set it to ''${project_loc}'' |
| 25 | * ''Arguments'': ''setup.py compile_catalog -f -l fi_FI'' (change to your locale) |
| 26 | 1. ''Refresh'' tab: |
| 27 | * Check ''Refresh resources upon completion''. |
| 28 | * Select ''Spesific resources'' and select ''trac/locale/fi_FI'' (select your locale) |
| 29 | 1. ''Build Options'' tab: |
| 30 | * Check ''During auto builds''. |
| 31 | * Check ''Specify working set of relevan resources''.[[BR]] |
| 32 | * Click ''Specify resources...''. select ''trac/locale/fi_FI'' (select your locale, same as in step 4). |
| 33 | * Name it like ''fi_FI locale''. |
| 34 | 1. After modifying your message.po file you should get following output: |