The binding provides the same functionality as libmount in C -- for now supported objects are:
- Fs - filesystem description
- Table - tab files parser and container for filesystems
- Context - high-level API to mount/umount.
Examples:
$ python >>> import libmount >>> tb = libmount.Table('/proc/self/mountinfo') >>> fs = tb.find_target('/home/kzak') >>> print fs.source /dev/mapper/luks-10d813de-fa82-4f67-a86c-23d5d0e7c30e
# python >>> import libmount >>> cx = libmount.Context() >>> cx.target = '/mnt/backup' >>> cx.mount() >>> fs = cx.mtab.find_target('/mnt/backup') >>> print fs.fstype nfs4
# python -c "import libmount; libmount.Context(target='/mnt/backup').umount()"
The side effect of the work on the Python binding is that libmount uses reference counting for libmnt_{fs,table,cache} objects now. So we're ready for more complicated scenarios.
.. and --without-python if you don't like it ;-)