#9374 closed defect (fixed)
init/update catalog now need an installed trac
Reported by: | nzoltan | Owned by: | Christian Boos |
---|---|---|---|
Priority: | normal | Milestone: | 0.12 |
Component: | i18n | Version: | 0.12dev |
Severity: | normal | Keywords: | setuptools |
Cc: | felix.schwarz@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Trac is not installed on my build environment. r9786 is not built anymore.
[build]$ python setup.py update_catalog -l hu Traceback (most recent call last): File "setup.py", line 33, in ? from trac.util.dist import get_l10n_js_cmdclass File "/home/dev/project/trac/trunk/src/trac/__init__.py", line 14, in ? __version__ = __import__('pkg_resources').get_distribution('Trac').version File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 229, in get_distribution if isinstance(dist,Requirement): dist = get_provider(dist) File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 115, in get_provider return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0] File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 585, in require needed = self.resolve(parse_requirements(requirements)) File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 483, in resolve raise DistributionNotFound(req) # XXX put more info here pkg_resources.DistributionNotFound: Trac
Is it a bug or feature?
Attachments (0)
Change History (13)
comment:1 by , 15 years ago
follow-up: 3 comment:2 by , 15 years ago
Ah wait, I suppose all you need to do is to issue a python setup.py egg_info
command before init/update
.
comment:3 by , 15 years ago
Replying to cboos:
Ah wait, I suppose all you need to do is to issue a
python setup.py egg_info
command beforeinit/update
.
[build]$ python setup.py egg_info Traceback (most recent call last): File "setup.py", line 33, in ? from trac.util.dist import get_l10n_js_cmdclass File "/home/dev/project/trac/trunk/src/trac/__init__.py", line 14, in ? __version__ = __import__('pkg_resources').get_distribution('Trac').version File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 229, in get_distribution if isinstance(dist,Requirement): dist = get_provider(dist) File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 115, in get_provider return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0] File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 585, in require needed = self.resolve(parse_requirements(requirements)) File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 483, in resolve raise DistributionNotFound(req) # XXX put more info here pkg_resources.DistributionNotFound: Trac
follow-up: 5 comment:4 by , 15 years ago
Ah yes, chicken … egg_info problem ;-)
So comment:1 seems the way to go.
comment:5 by , 15 years ago
Replying to cboos:
Ah yes, chicken … egg_info problem ;-)
So comment:1 seems the way to go.
Still no luck. :(
[build]$ python setup.py update_catalog -l hu Traceback (most recent call last): File "setup.py", line 37, in ? except pkg_resources.DistributionNotFound: NameError: name 'pkg_resources' is not defined
comment:6 by , 15 years ago
Ok, no idea why there was a __import__('pkg_resources')
- maybe there was a good reason…
If not, the following should do:
from pkg_resources import DistributionNotFound, get_distribution try: __version__ = get_distribution('Trac').version except DistributionNotFound: __version__ = '0.12dev'
comment:7 by , 15 years ago
My setup.py patch is:
@@ -13,6 +13,7 @@ # history and logs, available at http://trac.edgewall.org/log/. from setuptools import setup, find_packages +from pkg_resources import DistributionNotFound, get_distribution extra = {} @@ -30,8 +31,12 @@ 'tracopt': extractors, } - from trac.util.dist import get_l10n_js_cmdclass - extra['cmdclass'] = get_l10n_js_cmdclass() + try: + from trac.util.dist import get_l10n_js_cmdclass + extra['cmdclass'] = get_l10n_js_cmdclass() + __version__ = __import__('pkg_resources').get_distribution('Trac').version + except DistributionNotFound: + __version__ = '0.12dev' except ImportError, e: pass
The "python setup.py update_catalog -l hu"
is now works fine, but:
[build]$ python setup.py init_catalog_js -l hu usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help error: invalid command 'init_catalog_js'
and the "update_catalog_js"
result is same. How can I create the messages-js.po file?
follow-up: 9 comment:8 by , 15 years ago
Sorry, my instructions were not clear, comment:6 was a patch for source:/trunk/trac/__init__.py, I'll write a real patch later today.
comment:9 by , 15 years ago
Replying to cboos:
Sorry, my instructions were not clear, comment:6 was a patch for source:/trunk/trac/__init__.py, I'll write a real patch later today.
No, it's my fault, the traceback root is the __init__.py
, I was careless, sorry. :) Now everything works fine with the modified __init__.py
.
comment:10 by , 15 years ago
Cc: | added |
---|
comment:11 by , 15 years ago
Keywords: | setuptools added |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Fix applied in [9806].
I suppose the __import__('pkg_resources')
was preferred to import pkg_resources
in order to keep the trac
namespace clean, so we could add a del get_distribution, DistributionNotFound
to reach the same effect, though I don't think it's worth the trouble.
comment:12 by , 15 years ago
Owner: | set to |
---|
comment:13 by , 14 years ago
I have the same problem with 0.12 AND 0.13
invalid command 'update_catalog'
python setup.py update_catalog -l hu update_catalog_js -l hu usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] …]
or: setup.py —help [cmd1 cmd2 …] or: setup.py —help-commands or: setup.py cmd —help
error: invalid command 'update_catalog' make: * [update-hu] Error 1
A bug …
Try replacing with: