mercurial-plugin-012 trunk bug with locale

1 view
Skip to first unread message

Jorge Vargas

unread,
Jan 25, 2009, 12:29:57 PM1/25/09
to trac...@googlegroups.com
Hello,

Please let me know if this isn't the place for this.

I just installed trac multirepo branch + mercurial plugin, and I'm
loving it awesome work and I hope this becomes the main branch for the
upcomming 0.12 release. That said I think I found a bug, but I'm not
100% sure. after the new i18n was added the following line was
introduced.


locale_dir = pkg_resources.resource_filename(__name__,'../locale')

I see two problems with this.
#1 __name__ is not supported in zipped eggs, which is the recommended
installation method for trac plugins.
#2 I believe the ../locale syntax isn't supported by said function.

ideally the first param should be the package name and the second only
"locale" but to be honest I don't know much of pkg_resources api to be
sure which will be the correct value.

Remy Blank

unread,
Jan 26, 2009, 4:18:19 PM1/26/09
to trac...@googlegroups.com
Jorge Vargas wrote:
> I just installed trac multirepo branch + mercurial plugin, and I'm
> loving it awesome work and I hope this becomes the main branch for the
> upcomming 0.12 release.

Yes, me too (hint, hint!).

-- Remy

signature.asc

Christian Boos

unread,
Jan 27, 2009, 12:53:50 PM1/27/09
to trac...@googlegroups.com
Jorge Vargas wrote:
> Hello,
>
> Please let me know if this isn't the place for this.
>
> I just installed trac multirepo branch + mercurial plugin, and I'm
> loving it awesome work and I hope this becomes the main branch for the
> upcomming 0.12 release. That said I think I found a bug, but I'm not
> 100% sure. after the new i18n was added the following line was
> introduced.
>
>

Did you actually face an installation issue? If yes, was it the same as
http://trac.edgewall.org/ticket/7877?

> locale_dir = pkg_resources.resource_filename(__name__,'../locale')
>
> I see two problems with this.
> #1 __name__ is not supported in zipped eggs, which is the recommended
> installation method for trac plugins.
>

I don't think Babel can deal with zipped eggs, so translated plugins
should be marked as zip-unsafe for now (if that works at all, cf.
problem above).

> #2 I believe the ../locale syntax isn't supported by said function.
>
> ideally the first param should be the package name and the second only
> "locale" but to be honest I don't know much of pkg_resources api to be
> sure which will be the correct value.
>

Honestly, same goes for me, I simply picked that line from
trac/utils/translations.py. As it worked fine for Trac itself, I figured
it would for plugins as well (and indeed it does work for me).

-- Christian


Jorge Vargas

unread,
Jan 27, 2009, 5:59:39 PM1/27/09
to trac...@googlegroups.com
On Tue, Jan 27, 2009 at 1:53 PM, Christian Boos <cb...@neuf.fr> wrote:
>
> Jorge Vargas wrote:
>> Hello,
>>
>> Please let me know if this isn't the place for this.
>>
>> I just installed trac multirepo branch + mercurial plugin, and I'm
>> loving it awesome work and I hope this becomes the main branch for the
>> upcomming 0.12 release. That said I think I found a bug, but I'm not
>> 100% sure. after the new i18n was added the following line was
>> introduced.
>>
>>
Hello Christian
>
> Did you actually face an installation issue? If yes, was it the same as
> http://trac.edgewall.org/ticket/7877?
>
actually yes that was the same error (I should have search trac first,
although I wasn't sure if tickets for this branch/mercurial where
supposed to go in there)

>> locale_dir = pkg_resources.resource_filename(__name__,'../locale')
>>
>> I see two problems with this.
>> #1 __name__ is not supported in zipped eggs, which is the recommended
>> installation method for trac plugins.
>>
>
> I don't think Babel can deal with zipped eggs, so translated plugins
> should be marked as zip-unsafe for now (if that works at all, cf.
> problem above).
>
biggest problem right now is that the instructions at actually tell
you to build an egg.
http://trac.edgewall.org/wiki/MultipleRepositorySupport so it's broken
and you are supposed to use it that way :)

>> #2 I believe the ../locale syntax isn't supported by said function.
>>
>> ideally the first param should be the package name and the second only
>> "locale" but to be honest I don't know much of pkg_resources api to be
>> sure which will be the correct value.
>>
>
> Honestly, same goes for me, I simply picked that line from
> trac/utils/translations.py. As it worked fine for Trac itself, I figured
> it would for plugins as well (and indeed it does work for me).
>
it does not work for me as a zipped egg becuase __name__ is mangled
inside the eggs. As you said zipsafe will probably fix it but then the
"traditional" way of installing trac plugins will be broken. I believe
something along the lines of
pkg_resources('tracext.hg','locale') should fix it but I'm simply not
sure. I'll try to consult with someone I know that knows setuptools...

Thanks

> -- Christian
>
>
>
> >
>
Reply all
Reply to author
Forward
0 new messages