Hi Roger,

Thanks for your feedback!

Roger Ineichen wrote:
>> -----Urspr√ľngliche Nachricht-----
>> 2.) looking up the product version
>> ----------------------------------
>> POTMaker._getProductVersion() doesn't work for me. 
>> zope.app.applicationcontrol is not used by Zope 2 and is not 
>> part of the specified dependencies. This raises an error.
>> Proposal: Catch the error. Return an empty string if version 
>> is not found.
> Sounds good to me as a workarround
> Probably we should try to use the package version of the egg
> which uses the i18n recipe?

Not every buildout is itself an egg. So in any case we need a fallback.

In my use case I plan to set the version manually in the pot_header 
template. So I don't need the version lookup.

i18nextract.main() initializes POTMaker this way:

     # setup pot maker
     maker = POTMaker(output_file, '')

The second argument is the path that is used by 
POTMaker._getProductVersion() to look up a 'version.txt' file. Maybe we 
could use a better path than ''. But I'll leave it to someone else to 
figure that out.

>> 4.) looking up basePath
>> -----------------------
>> i18nextract.main() contains these lines:
>>      # add maker for each given path
>>      for pkgName, path in eggPaths:
>>          srcIdx = path.rfind('src')
>>          if srcIdx == -1:
>>              # this is an egg package, strip down base path
>>              basePath = path
>>              moduleNames = pkgName.split('.')
>>              moduleNames.reverse()
>>              for mName in moduleNames:
>>                  mIdx = path.rfind(mName)
>>                  basePath = basePath[:mIdx]
>>              pkgPath = path[len(basePath):]
>>          else:
>>              # this is a package linked in as externals
>>              basePath = path[:srcIdx]
>>              pkgPath = path[len(basePath):]
>> I don't understand why we need different code for "packages 
>> linked in as externals". The "egg package" code works 
>> actually better for linked in packages that don't follow the 
>> 'src' convention.
>> Proposal: Use the 'if' code for all packages.
> I was fighting several times with this part during coding.
> The only thing which this part has to make sure is that
> we do not use anything outside of the package in our path.
> The reason for not including everything outside the package
> in our path is that such a path whould be depend on the 
> local setup e.g.
> D:\foo\dev\zope\session:3
> We only have to make sure that this never will happen and that
> we for each use case generate path like:
> zope/session.py:3
> It could be that the if part is working for all usecases. 
> but I'n not sure without debugging.

Debugging doesn't help much if we don't know all use cases.

What about testing it like this:

We remove the 'else' part and wait until someone complains. In that case 
we have a scenario for testing and fixing the issue. If nobody 
complains, the 'else' part was indeed useless.

The current code doesn't work for me because 'src' is found but not the 
right place to split the path.



Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to