#9961 closed defect (fixed)
first time easy_install won't compile the catalogs
| Reported by: | Christian Boos | Owned by: | Jun Omae |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.12.2 |
| Component: | i18n | Version: | 0.12 |
| Severity: | normal | Keywords: | setuptools |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
By doing a few test installations, I noticed a strange effect: for a new Python installation or for a new virtualenv having just setuptools and Babel, easy_install Trac calls the appropriate install_lib step but this fails to trigger a compile_catalog step (r9638 and r9763).
This can be easily reproduced, in a fresh Python environment having only setuptools and Babel installed so far:
$ tar xvfz Trac-0.12.1.tar.gz $ cd Trac-0.12.1 $ python setup.py -v bdist_egg ... running bdist_egg running egg_info writing requirements to Trac.egg-info/requires.txt writing Trac.egg-info/PKG-INFO writing top-level names to Trac.egg-info/top_level.txt writing dependency_links to Trac.egg-info/dependency_links.txt writing entry points to Trac.egg-info/entry_points.txt reading manifest file 'Trac.egg-info/SOURCES.txt' writing manifest file 'Trac.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py creating build ...
Whereas if the install is actually an upgrade, then it works as expected (e.g. easy_install Trac==0.12; easy_install -U Trac==0.12.1):
... running install_lib running compile_catalog_js compiling catalog 'trac/locale/sl/LC_MESSAGES/messages-js.po' to 'trac/locale/sl/LC_MESSAGES/messages-js.mo' ...
I suspect the from trac.util.dist import get_l10n_js_cmdclass line to fail in the first situation. Debugging this shows the following error: No module named genshi.builder… The compile_catalog_js step indeed requires Genshi so this is not a side effect error we could try to ignore. With setuptools, the bdist_egg step is executed before the Genshi package gets installed. That actually happens at the very end of easy_install Trac:
Installed .../lib/python2.5/site-packages/Trac-0.12.1-py2.5.egg Processing dependencies for Trac Searching for Genshi>=0.6 ...
So to solve this, we'd need to be able to trigger an install of Genshi at a very early stage.
In the meantime, we can advise to do an explicit:
easy_install Babel Genshi easy_install Trac
for first time installations (easy_install Babel Genshi Trac won't work either).
Attachments (1)
Change History (10)
comment:1 by , 15 years ago
| Summary: | first time easy_install don't compile the catalogs → first time easy_install won't compile the catalogs |
|---|
comment:2 by , 15 years ago
Ad hoc solution, it triggers to install genshi before the build stage.
Index: setup.py =================================================================== --- setup.py (revision 10435) +++ setup.py (working copy) @@ -85,6 +85,9 @@ test_suite = 'trac.test.suite', zip_safe = True, + setup_requires = [ + 'Genshi>=0.6', + ], install_requires = [ 'setuptools>=0.6b1', 'Genshi>=0.6',
comment:3 by , 15 years ago
The problem is that we require Genshi through the early import trac.utils.dist, in order to provide the generate_messages_js Command. So we should also delay importing the genshi dependencies, like:
-
dist.py
29 29 from distutils.errors import DistutilsOptionError 30 30 from setuptools.command.install_lib import install_lib as _install_lib 31 31 32 from genshi.core import Stream33 from genshi.input import XMLParser34 35 32 from trac.util.presentation import to_json 36 33 37 34 try: … … 47 44 Select <script type="javascript/text"> tags and delegate to 48 45 `extract_javascript`. 49 46 """ 47 from genshi.core import Stream 48 from genshi.input import XMLParser 50 49 out = StringIO() 51 50 stream = Stream(XMLParser(fileobj)) 52 51 stream.select('//script[@type="text/javascript"]').render(out=out)
But I'm not sure that's enough, there are indirect dependencies IIRC.
Anyway, thanks for the tip about setup_requires!
follow-up: 6 comment:4 by , 15 years ago
I just understand the problem now. Thanks for the more detailed explanation.
We need to be able to import get_l10n*cmdclass without Genshi in setup.py.
Then, I think that the cmdclasses should be moved to trac.dist from trac.util.dist.
trac.util.dist depends on trac.util and trac.util.html. trac.util.html directly depends on Genshi. trac.dist can minimize the dependencies with the delay importing.
I create a experimental patch t9961-dist.diff.
by , 15 years ago
| Attachment: | t9961-dist.diff added |
|---|
comment:5 by , 15 years ago
| Milestone: | next-major-0.1X → 0.12.2 |
|---|---|
| Owner: | changed from to |
Looks pretty good! I'll test this evening.
comment:6 by , 15 years ago
Replying to jomae:
Then, I think that the cmdclasses should be moved to
trac.distfromtrac.util.dist.
Minimizing (or even eliminating all) Trac dependencies in the dist module sounds like an excellent idea.
The fact that trac.util imports all sorts of stuff is a dependency nightmare (I understand we do it for backward compatibility), ideally it should be empty and all functionality should be in trac.util.* sub-modules. Maybe we should do some clean-up at some point.
comment:7 by , 15 years ago
The patch seems to work great!
(babel-only)cboos@lynx:~/tests/0.12-stable$ python setup.py bdist_egg warning: no previously-included files found matching 'doc/2000ft.graffle' warning: no previously-included files matching '*' found under directory 'doc/logo.lineform' zip_safe flag not set; analyzing archive contents... Installed /home/cboos/tests/0.12-stable/Genshi-0.6-py2.7.egg running bdist_egg running egg_info creating Trac.egg-info ... running install_lib running compile_catalog_js compiling catalog 'trac/locale/sl/LC_MESSAGES/messages-js.po' to ...
However as you can see above, the first thing we get are the warnings emitted by Genshi's install. This is not so nice, maybe we can do:
-
setup.py
diff --git a/setup.py b/setup.py
a b 43 43 from trac.dist import get_l10n_js_cmdclass 44 44 extra['cmdclass'] = get_l10n_js_cmdclass() 45 45 46 except ImportError , e:46 except ImportError: 47 47 pass 48 48 49 try: 50 import genshi 51 except ImportError: 52 print "Genshi is needed by Trac setup, pre-installing" 53 # give some context to the warnings we might get when installing Genshi 54 55 49 56 setup( 50 57 name = 'Trac', 51 58 version = '0.12.2',
Then we get:
(babel-only)cboos@lynx:~/tests/0.12-stable$ python setup.py bdist_egg Genshi is needed by Trac setup, pre-installing warning: no previously-included files found matching 'doc/2000ft.graffle' warning: no previously-included files matching '*' found under directory 'doc/logo.lineform' zip_safe flag not set; analyzing archive contents... Installed /home/cboos/tests/0.12-stable/Genshi-0.6-py2.7.egg running bdist_egg ...
only if Genshi was actually missing.
comment:8 by , 15 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Thanks for your testing and reviews! Committed in [10444].
comment:9 by , 15 years ago
Good! I'll take care of merging, as I'm currently merging 0.12-stable. On trunk I will redo the trac/util/dist.py → trac/dist.py as a copy ;-)



typo