I was discussing code generation with a few people, and they said to look at how tp-glib does it. I took one look at it and thought "this looks horrible". istaz agreed so I spent a few hours re-factoring one of the files. It currently produces the exact same output as it did in master, but with only one print statement per function. I hope you like it. Patch can be found in http://git.collabora.co.uk/?p=user/alsuren/telepathy-glib.git;a=shortlog;h=refs/heads/constants-cleanup but I suspect the patch is far uglier to read than the new code because I've changed the structure quite a lot. If you like this patch, I can work my magic on the rest of tp-glib/tools and tp-python/tools too.
14:49 < smcv> alsuren: tbh, I'd prefer it if any rewrites were done using danni's spec parser (from telepathy-spec doc-generator) 14:49 < smcv> alsuren: rather than doing ad-hoc parsing for every codegen tool 14:49 < smcv> alsuren: er, not doc-generator, but the thing that produces the new multi-page spec ... 14:52 < smcv> I'm rather unconvinced by the templating library that danni uses for the HTML (cheetah?) 14:52 < smcv> and in any case I don't think it's an acceptable build-dependency for our other projects 14:53 < jonnylamb> You think we should NIH it? 14:53 < smcv> so we'll still be using the % operator in practice 14:53 < smcv> jonnylamb: I don't think our codegen is anywhere near as complex as the HTML, so yes, I suppose I do think that 14:53 < wjt> i think it'd be fine to "rebase" the code generator on top of the spec parser's object ... 14:56 < smcv> non-stdlib python for docs: fine, non-stdlib python for codegen: bad 14:56 < smcv> IMO 14:56 < smcv> I deliberately asked danni to avoid using third-party XML libraries for that reason 14:57 < smcv> so we could recycle the parser layer from tp-spec (but not the cheetah layer) as a codegen tool
If someone picks this up, to make it reviewable, I'd like it done like this: * step 0 (optional): adjust the current codegen so it comes out in a predictable order (e.g. alphabetical order), if that would make step 1 easier * step 1: rewrite it in terms of specparser.py, producing identical or identical-ignoring-whitespace output; quote a diff command line that proves that the output is the same as saved output from the old tools * step 2: change it around so the output looks nicer, if desired
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/telepathy/telepathy-glib/issues/19.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.