comtypes
comtypes copied to clipboard
Fix cross import between `tools` and `client`
Currently there are no problems at runtime, but complex imports tend to cause strange bugs that occur when the code is changed.
Modification policies
Make client dependent on tools.
So that client is not imported from tools, except to use as workarounds when there is nothing else to do.
Generating modules in codegenerator
https://github.com/enthought/comtypes/blob/944e279890e3a4918e7661a8e268e6e2bddf57ae/comtypes/tools/codegenerator.py#L669-L679
The codegenerator is responsible for writing code to file I/O, but when generate_code is called, it generates the dependency modules.
Generating modules in the generating code process seems to be out of scope.
Generator is called by the client.
If generating dependency modules are necessary, I think that the Parser or Generator should have a method or attribute to obtain those COM libraries, and the process of generating modules should be done in the client.
move tlbparser.generate_module to client._generate
https://github.com/enthought/comtypes/blob/944e279890e3a4918e7661a8e268e6e2bddf57ae/comtypes/tools/tlbparser.py#L737-L767
When I first saw the implementation of this library, I wondered why there was a generate_module in tools.tlbparser and not in tools.codegenerator or client._generate.
https://github.com/enthought/comtypes/blob/944e279890e3a4918e7661a8e268e6e2bddf57ae/comtypes/tools/codegenerator.py#L1284-L1287
I think the role of module generation should be in client._generate.
this issue was closed since merging #342 and #348.