Python wily module

  • From: Sam Holden <sholden@xxxxxxxxxxxxxx>
  • To: wilyfans@xxxxxxxxxxxxx
  • Date: Thu, 15 Jul 2004 02:41:48 +1000

My gcc doesn't like compiling the wilymodule.c python module, due to
multi-line strings. I quickly patched it by added \n\ to the end of all
the lines in the multi-line strings, which I assume someone else has
done somewhere anyway (that seemed easier than finding a magic gcc
command line option to make it work).

I also wrote a quick wrapper module a lot like wilywin.py but with a
slightly different interface. If anyone is interested in that then give
me a yell.

Finally, my dislike of C python modules (and the fact that I had
something important to do from which I needed to procrastinate) drove me
to implement a pure python interface to wily. Ie. all the joyous socket
handling and message parsing/flattening is done in python, with no need
for a C compiler - though a C compiler makes generating the python
definitions from the enums easier than typing them manually and trusting
your recollection of what number C assigns the first unassigned enum
value is correct.

It's certainly buggy since I haven't tested it any more then getting a
list of windows (and since the wily instance is at work haven't compared
the output to the actual windows), but it has a wrapper interface that
is identical to the wrapper I use around the C python module so when I
get work I'll drop it in and see what breaks...

If anyone wants it, then again give me a yell - though I need to add
docstrings which will take a little bit of time.

Next time I need to procrastinate I'll translate the python into perl (I
also dislike C perl modules - though an Inline::C module would be good
enough)...

Of course now that I've done that, after all these years, someone is
going to change the message format :)

-- 
Sam



Other related posts: