agrover/python-kmod — pull request #3 by wking (2012-10-19 05:15:37+00:00)
Title: Convert from a raw C extension to Cython and flesh out Module attributes.

I want to get modinfo-style output for a particular module (especially staging and vermagic) from Python, so I thought this would be the module to use. Unfortunately, I'm running Python 3, and the trunk module is written for Python 2. I took a peak at upgrading to Python 3, but quite a bit of the C extension boilerplate has changed, so I gave up and just translated python-kmod into Cython. This patch series makes that conversion, and fleshes out a new Module class with a number of attributes. I also touched up the packaging a bit (setup.py, MANIFEST.in). Now you can do things like:

>>> import kmod
>>> k = kmod.Kmod()
>>> for module in k.loaded():
... for attribute in ['name', 'info']:
... print('{}: {}'.format(attribute, getattr(module, attribute)))
name: ntfs
info: {'description': 'NTFS 1.2/3.x driver - Copyright (c) 2001-2011 Anton Altaparmakov and Tuxera Inc.', 'license': 'GPL', …}
…

This should close issue #1.