Re: [comtypes-users] generated modules

2008-09-18 Thread Thomas Heller
Thomas Heller schrieb:
 Here's the next idea that I have for the version checking:  Version check 
 inside
 the generated modules, but using code outside:
 
 So, inside the generated module:
 
 '''
 from comtypes import check_wrapper_version
 check_wrapper_version('42')
 '''
 
 comtypes.check_wrapper_version() would compare against the code generator 
 version,
 and in the simplest case raise an ImportError(version mismatch).  In a more
 sophisticated implementation it could regenerate and reload the module.
 

I have implemented this now; the code simply compares the actual and the 
required
version and raises an ImportError if they are unequal.

Also I must admit that I have reintroduced the os.stat() calls on the typelib 
files
and the generated module files, this is too damn convenient for me.  The code 
is much
simpler now, and if the generated module's timestamp is less than the typelib's 
timestamp
an ImportError is also raised.  If any of the os.stat() calls fail then the 
import succeeds.

I wonder if there should be a way in comtypes to enable/disable this timestamp 
check?
Currently I've enabled this code only when a script is run, in other words only 
when
hasattr(sys, frozen) is False.

-- 
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=100url=/
___
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users


Re: [comtypes-users] generated modules

2008-09-18 Thread Anthony Tuininga
On Thu, Sep 18, 2008 at 10:44 AM, Thomas Heller [EMAIL PROTECTED] wrote:
 Thomas Heller schrieb:
 Here's the next idea that I have for the version checking:  Version check 
 inside
 the generated modules, but using code outside:

 So, inside the generated module:

 '''
 from comtypes import check_wrapper_version
 check_wrapper_version('42')
 '''

 comtypes.check_wrapper_version() would compare against the code generator 
 version,
 and in the simplest case raise an ImportError(version mismatch).  In a more
 sophisticated implementation it could regenerate and reload the module.


 I have implemented this now; the code simply compares the actual and the 
 required
 version and raises an ImportError if they are unequal.

Looks good.

 Also I must admit that I have reintroduced the os.stat() calls on the typelib 
 files
 and the generated module files, this is too damn convenient for me.  The code 
 is much
 simpler now, and if the generated module's timestamp is less than the 
 typelib's timestamp
 an ImportError is also raised.  If any of the os.stat() calls fail then the 
 import succeeds.

Hmm, you have added a coder generator version inside the generated
module. Perhaps you could also add the type library timestamp inside
the generated module as well and compare that with the os.stat() on
the type library? The type library file should always exist, right?
Its the module that may not exist or rather be buried inside a zip
file. If you put the type library timestamp inside the generated
module that would work in both the script and frozen situations.
What do you think of that concept?

 I wonder if there should be a way in comtypes to enable/disable this 
 timestamp check?
 Currently I've enabled this code only when a script is run, in other words 
 only when
 hasattr(sys, frozen) is False.

See above.

 --
 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=100url=/
 ___
 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=100url=/
___
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users