On 05/28/2012 02:56 PM, Michael Pasternak wrote:
> On 05/27/2012 08:06 PM, ShaoHe Feng wrote:
>> On 05/26/2012 01:48 AM, Michael Pasternak wrote:
>>> Hi,
>>>
>>> On 05/24/2012 09:13 PM, ShaoHe Fen3g wrote:
>>>> Hi all,
>>>>
>>>> Now I'm using the code generation suites of ovirt-engine-sdk, I
>>>> find it is very troublesome.
>>> I completely agree with you, automating python entities generation
>>> is on top
>>> of my TODO stack see [1],
>>>
>>> Along with this, there was always something more important to do, and
>>> it was delayed time after time, so your help is most welcome.
>>>
>>> [1]
http://www.ovirt.org/wiki/SDK#codegen
>>>
>>>> IMO, we can simplify the process. And I want to engaged in it.
>>>>
>>>> there are two tools parse the api.xsd and generate the params.py
>>>> code. They are generateds_gui.py and generateDS.py.
>>>> but there still some code can not be generate by these tools. now
>>>> we should add these codes manually.
>>>>
>>>> the not NOT_GENERATED codes are as follow in the current
>>>> params.py code:
>>>> 1. import python module
>>>> 2. a new attribute of GeneratedsSuper class
>>>> 3. modify the get_root_tag function.
>>>> 4. modify the parseString function to shut up the stdout.
>>>> 5. _rootClassMap
>>>> 6 . _elementToClassMap
>>>> 7. findRootClass
>>>>
>>>> And I have two ideas about the code generation.
>>>> For we should not modify the generateDS.py tools.
>>>> But we can improve it.
>>>>
>>>> I think the 1, 2, 3, 7, can be hard-code, and 4, 5 and 6 can be
>>>> configured.
>>>> So I want to add an configure file to tell how to add the extra
>>>> code that are not generated by generateDS.py tools.
>>>> And new python program, as extension of generateDS.py to read the
>>>> configure file and generate these codes.
>>> sounds good, btw 5,6 can be constructed programmatically using
>>> __all__ generated by generateDS
>>> and finding element name in xsd by type (from __all__).
>> should all the element name in xsd by type be added to
>> _rootClassMap, and no element can be exception?
> basically yes, cause _rootClassMap is<name, type> holder which used
> for (by name) type retrieval,
> only exception is if certain type is not referenced by any other type
> (then none will look for
> it during the type construction), but i would not implement this logic.
>
Hi Michael,
what's your account on ovirt IRC channel?
seem I can not log on the #ovirt IRC
channel.
still some questions.
can I edit the generateDS.py directly in order to generate the params.py
code that we expect. and then rename the generateDS.py, put it into the
SDK directory?
or an new py program to call the functions of generateDS?
>>>> Or without the configure file, just make the new
python program
>>>> that supports an interactive commands.
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Engine-devel mailing list
>>>> Engine-devel(a)ovirt.org
>>>>
http://lists.ovirt.org/mailman/listinfo/engine-devel
>