From 0032ccbd60f202ec76d9b738cddc8bdbf9f54133 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Tue, 31 Jul 2012 12:52:12 +0000 Subject: python scripts: pep8ize codebase This was done with the aid of the pep8 script, available by running `easy_install pep8`. It may be worth making this part of ./check, but that will require putting pep8 into the development tools stratum. This should be easy, given pep8 has no external dependencies. --- morphlib/fsutils.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'morphlib/fsutils.py') diff --git a/morphlib/fsutils.py b/morphlib/fsutils.py index c74e97db..45fb9e2f 100644 --- a/morphlib/fsutils.py +++ b/morphlib/fsutils.py @@ -1,14 +1,14 @@ # Copyright (C) 2012 Codethink Limited -# +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. @@ -22,10 +22,12 @@ def create_image(runcmd, image_name, size): runcmd(['dd', 'if=/dev/zero', 'of=' + image_name, 'bs=1', 'seek=%d' % size, 'count=0']) + def partition_image(runcmd, image_name): # FIXME make this more flexible with partitioning options runcmd(['sfdisk', image_name], feed_stdin='1,,83,*\n') + def install_syslinux_mbr(runcmd, image_name): for path in ['/usr/lib/extlinux/mbr.bin', '/usr/share/syslinux/mbr.bin']: @@ -34,6 +36,7 @@ def install_syslinux_mbr(runcmd, image_name): 'conv=notrunc']) break + def setup_device_mapping(runcmd, image_name): findstart = re.compile(r"start=\s+(\d+),") out = runcmd(['sfdisk', '-d', image_name]) @@ -48,17 +51,21 @@ def setup_device_mapping(runcmd, image_name): device = runcmd(['losetup', '--show', '-o', str(start), '-f', image_name]) return device.strip() + def create_fs(runcmd, partition): runcmd(['mkfs.btrfs', '-L', 'baserock', partition]) + def mount(runcmd, partition, mount_point): if not os.path.exists(mount_point): os.mkdir(mount_point) runcmd(['mount', partition, mount_point]) + def unmount(runcmd, mount_point): runcmd(['umount', mount_point]) + def undo_device_mapping(runcmd, image_name): out = runcmd(['losetup', '-j', image_name]) for line in out.splitlines(): -- cgit v1.2.1