Skip to content

Instantly share code, notes, and snippets.

@vpodzime
Created April 8, 2016 12:25
Show Gist options
  • Save vpodzime/367fe60aa129da1f7daf063eab89baca to your computer and use it in GitHub Desktop.
Save vpodzime/367fe60aa129da1f7daf063eab89baca to your computer and use it in GitHub Desktop.
from gi.repository import BlockDev as blockdev
blockdev.init()
def print_args(*args):
print(args)
# set print_args() as the logging function
blockdev.reinit(None, False, print_args)
if __name__ == "__main__":
extra = [blockdev.UtilExtraArg.new(opt, val) for opt, val in (("-L", "TEST_LABEL"), ("-v", ""))]
blockdev.fs_ext4_mkfs("/dev/loop0", extra)
@vpodzime
Copy link
Author

vpodzime commented Apr 8, 2016

Of course, it's easy to transform (_args, *_kwargs) into a list of blockdev.UtilExtraArg objects which is what we can/will do in the Python GI overrides. So the function will just look like this: fs_ext4_mkfs(device, *args, **kwargs) with all the magic happening automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment