On Thu, Sep 4, 2008 at 2:03 PM, Thomas Heller <[EMAIL PROTECTED]> wrote:
> Thomas Heller schrieb:
>> Whether a generated module is up to date or not should only depend on two 
>> things:
>>
>> - the version number of the type library (this is clear)
>> - and the 'version number' of the comtypes codegenerator.
>>
>> The former is already taken care by the naming convention of the generated 
>> modules,
>> the latter can probably be achived by generating a code snippet like this
>> into the wrapper module itself:
>>
>> """
>> import comtypes.tools.codegenerator
>> if comtypes.tools.codegenerator.version != 42:
>>     raise ImportError("wrong version")
>> """
>>
>> and then regenerating the wrapper code when the import fails.  No longer
>> fiddling with imp.find_module(), searching for type library files, fiddling
>> with timestamps and so on.
>
> I have comitted an implementation as svn revision 407.

I took a look. Much better. :-)

Just one further question: is there any reason why you have the code
inside the generated module to raise an error if the generated number
does not match when you are already performing that check after you
import the module successfully? I think you can quite safely remove
that code. In other words, all you want in the generated code is

__codegen_version__ = 42

Then in the importing code

module = __import__()
if module.__codegen_version__ != comtypes.tools.codegenerator.version:
    raise ImportError("version mismatch")

Or am I missing something here? Please be gentle if I am. :-)

Anthony

> --
> Thanks,
> Thomas
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> comtypes-users mailing list
> comtypes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/comtypes-users
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to