=== modified file 'linaro_image_tools/cmd_runner.py'
--- linaro_image_tools/cmd_runner.py	2011-07-21 15:47:56 +0000
+++ linaro_image_tools/cmd_runner.py	2012-06-07 12:59:21 +0000
@@ -72,7 +72,7 @@
 
     def __init__(self, args, env=None, **kwargs):
         self._my_args = args
-        self.except_on_cmd_fail=True
+        self.except_on_cmd_fail = True
         if env is None:
             env = os.environ.copy()
         env['LC_ALL'] = 'C'
@@ -118,4 +118,4 @@
         if self.stderr:
             message += '\nstderr was\n{0}'.format(self.stderr)
 
-        return message
\ No newline at end of file
+        return message

=== modified file 'linaro_image_tools/hwpack/better_tarfile.py'
--- linaro_image_tools/hwpack/better_tarfile.py	2011-01-28 19:50:48 +0000
+++ linaro_image_tools/hwpack/better_tarfile.py	2012-06-07 13:12:42 +0000
@@ -31,6 +31,7 @@
 default values for the mtime, uid, etc. of the created paths.
 """
 
+
 @contextmanager
 def writeable_tarfile(backing_file, mode="w", **kwargs):
     """A context manager to get a writeable better tarfile.

=== modified file 'linaro_image_tools/hwpack/builder.py'
--- linaro_image_tools/hwpack/builder.py	2011-09-21 12:15:48 +0000
+++ linaro_image_tools/hwpack/builder.py	2012-06-07 12:59:21 +0000
@@ -40,7 +40,7 @@
 logger = logging.getLogger(__name__)
 
 
-LOCAL_ARCHIVE_LABEL='hwpack-local'
+LOCAL_ARCHIVE_LABEL = 'hwpack-local'
 
 
 class ConfigFileMissing(Exception):

=== modified file 'linaro_image_tools/hwpack/config.py'
--- linaro_image_tools/hwpack/config.py	2012-04-29 10:44:55 +0000
+++ linaro_image_tools/hwpack/config.py	2012-06-07 13:22:47 +0000
@@ -28,6 +28,7 @@
     HardwarePackFormatV2,
     )
 
+
 class HwpackConfigError(Exception):
     pass
 
@@ -84,14 +85,12 @@
     SAMSUNG_ENV_LEN_KEY = 'samsung_env_len'
     SAMSUNG_BL2_LEN_KEY = 'samsung_bl2_len'
 
-
     DEFINED_PARTITION_LAYOUTS = [
         'bootfs16_rootfs',
         'bootfs_rootfs',
         'reserved_bootfs_rootfs',
         ]
 
-
     def __init__(self, fp):
         """Create a Config.
 
@@ -167,7 +166,7 @@
             # When this code no longer supports 1.0, it effectively makes
             # explicitly specifying format in hwpack files mandatory.
             format_string = "1.0"
-        
+
         if format_string == '1.0':
             return HardwarePackFormatV1()
         elif format_string == '2.0':
@@ -594,7 +593,7 @@
         if dtb_file is not None:
             self._assert_matches_pattern(
                 self.GLOB_REGEX, dtb_file, "Invalid path: %s" % dtb_file)
-        
+
     def _validate_extra_boot_options(self):
         # Optional and tricky to determine a valid pattern.
         pass
@@ -611,7 +610,6 @@
             self._assert_matches_pattern(
                 self.PATH_REGEX, boot_script, "Invalid path: %s" % boot_script)
 
-
     def _validate_snowball_startup_files_config(self):
         snowball_startup_files_config = self.snowball_startup_files_config
         if snowball_startup_files_config is not None:

=== modified file 'linaro_image_tools/hwpack/hardwarepack.py'
--- linaro_image_tools/hwpack/hardwarepack.py	2012-04-29 10:44:55 +0000
+++ linaro_image_tools/hwpack/hardwarepack.py	2012-06-07 13:22:47 +0000
@@ -195,7 +195,7 @@
 
         if not self.format.has_v2_fields:
             return metadata
-            
+
         if self.u_boot is not None:
             metadata += "U_BOOT=%s\n" % self.u_boot
         if self.spl is not None:

=== modified file 'linaro_image_tools/hwpack/packages.py'
--- linaro_image_tools/hwpack/packages.py	2012-04-29 10:44:55 +0000
+++ linaro_image_tools/hwpack/packages.py	2012-06-07 13:00:08 +0000
@@ -511,9 +511,9 @@
                                                    url_parsed.query,
                                                    url_parsed.fragment]
 
-                    auth_name=os.path.join(
+                    auth_name = os.path.join(
                         self.tempdir, "etc", "apt", "auth.conf")
-                    with open(auth_name,'w') as auth:
+                    with open(auth_name, 'w') as auth:
                         auth.write(
                             "machine " + url_parsed.hostname + "\n" +
                             "login " + url_parsed.username + "\n" +

=== modified file 'linaro_image_tools/hwpack/testing.py'
--- linaro_image_tools/hwpack/testing.py	2011-03-24 11:14:44 +0000
+++ linaro_image_tools/hwpack/testing.py	2012-06-07 12:59:21 +0000
@@ -169,7 +169,7 @@
 
     @property
     def sources_entry(self):
-        return "file:" + os.path.abspath(self.rootdir) +" ./"
+        return "file:" + os.path.abspath(self.rootdir) + " ./"
 
 
 class ConfigFileFixture(object):

=== modified file 'linaro_image_tools/hwpack/tests/__init__.py'
--- linaro_image_tools/hwpack/tests/__init__.py	2011-03-23 22:25:10 +0000
+++ linaro_image_tools/hwpack/tests/__init__.py	2012-06-07 13:12:42 +0000
@@ -21,6 +21,7 @@
 
 import unittest
 
+
 def test_suite():
     module_names = [
         'linaro_image_tools.hwpack.tests.test_better_tarfile',

=== modified file 'linaro_image_tools/hwpack/tests/test_builder.py'
--- linaro_image_tools/hwpack/tests/test_builder.py	2011-09-21 13:13:59 +0000
+++ linaro_image_tools/hwpack/tests/test_builder.py	2012-06-07 12:59:21 +0000
@@ -115,7 +115,8 @@
     def setUp(self):
         super(HardwarePackBuilderTests, self).setUp()
         self.useFixture(ChdirToTempdirFixture())
-        self.extra_config={'format': '2.0', 'u-boot-package': 'wanted-package',
+        self.extra_config = {'format': '2.0',
+                          'u-boot-package': 'wanted-package',
                           'u-boot-file': 'wanted-file', 
                           'partition_layout': 'bootfs_rootfs',
                           'x_loader_package': 'x-loader-omap4-panda',

=== modified file 'linaro_image_tools/hwpack/tests/test_hardwarepack.py'
--- linaro_image_tools/hwpack/tests/test_hardwarepack.py	2012-04-29 10:44:55 +0000
+++ linaro_image_tools/hwpack/tests/test_hardwarepack.py	2012-06-07 12:59:21 +0000
@@ -334,7 +334,8 @@
         tf = self.get_tarfile(hwpack)
         self.assertThat(
             tf,
-            HardwarePackHasFile("FORMAT", content=hwpack.format.__str__()+"\n"))
+            HardwarePackHasFile("FORMAT",
+                content=hwpack.format.__str__() + "\n"))
 
     def test_creates_metadata_file(self):
         metadata = Metadata(

=== modified file 'linaro_image_tools/hwpack/tests/test_packages.py'
--- linaro_image_tools/hwpack/tests/test_packages.py	2012-04-29 10:44:55 +0000
+++ linaro_image_tools/hwpack/tests/test_packages.py	2012-06-07 13:14:28 +0000
@@ -931,7 +931,6 @@
             open(os.path.join(
                 cache.tempdir, "var", "lib", "dpkg", "status")).read())
 
-
     def test_package_list_has_no_passwords(self):
         source1 = self.useFixture(AptSourceFixture([]))
         path = re.sub("file:/", "file://user:pass@", source1.sources_entry)
@@ -947,6 +946,7 @@
         sources_list = open(sources_list_location).read()
         self.assertEqual("deb %s\n" % source1.sources_entry, sources_list)
 
+
 class PackageFetcherTests(TestCaseWithFixtures):
 
     def test_context_manager(self):

=== modified file 'linaro_image_tools/hwpack/tests/test_script.py'
--- linaro_image_tools/hwpack/tests/test_script.py	2012-03-23 18:08:37 +0000
+++ linaro_image_tools/hwpack/tests/test_script.py	2012-06-07 13:22:47 +0000
@@ -103,10 +103,10 @@
             '\n[ubuntu]\nsources-entry=%s\n' % (
                 package_name, source.sources_entry)))
         stdout, stderr = self.run_script([config.filename, "1.0"])
-        
+
         # XXX Adding in the format deprecation message below is just a hack
         # until the test can be fixed up to test a new format hwpack.
-        
+
         self.assertThat(
             stderr,
             DocTestMatches(

=== modified file 'linaro_image_tools/hwpack/tests/test_testing.py'
--- linaro_image_tools/hwpack/tests/test_testing.py	2011-03-23 22:25:10 +0000
+++ linaro_image_tools/hwpack/tests/test_testing.py	2012-06-07 13:08:49 +0000
@@ -132,6 +132,7 @@
     def __init__(self, pattern, flags=0):
         self.pattern = pattern
         self.flags = flags
+
     def match(self, value):
         if not re.match(self.pattern, value, self.flags):
             return Mismatch("%r did not match %r" % (self.pattern, value))

=== modified file 'linaro_image_tools/media_create/__init__.py'
--- linaro_image_tools/media_create/__init__.py	2012-04-18 13:08:36 +0000
+++ linaro_image_tools/media_create/__init__.py	2012-06-07 13:22:47 +0000
@@ -66,6 +66,7 @@
         qemu_version = "Cannot find %s." % qemu_path
     return "%s\n: %s" % (__version__, qemu_version)
 
+
 def add_common_options(parser):
     parser.add_argument(
         '--extra-boot-args', dest='extra_boot_args', required=False,
@@ -74,6 +75,7 @@
         '--extra-boot-args-file', dest='extra_boot_args_file',
         required=False, help=('File containing extra boot arguments.'))
 
+
 def get_args_parser():
     """Get the ArgumentParser for the arguments given on the command line."""
     parser = argparse.ArgumentParser(version='%(prog)s ' + get_version())
@@ -157,10 +159,11 @@
         '--nocheck-mmc', dest='nocheck_mmc',
         action='store_true',
         help='Assume yes to the question "Are you 100%% sure, on selecting [mmc]"')
-    
+
     add_common_options(parser)
     return parser
 
+
 def get_android_args_parser():
     """Get the ArgumentParser for the arguments given on the command line."""
     parser = argparse.ArgumentParser(version='%(prog)s ' + get_version())

=== modified file 'linaro_image_tools/media_create/boards.py'
--- linaro_image_tools/media_create/boards.py	2012-05-17 12:15:15 +0000
+++ linaro_image_tools/media_create/boards.py	2012-06-07 13:22:47 +0000
@@ -94,11 +94,11 @@
     """Copy a file from src to destdir, dropping root ownership on the
     way.
     """
-    cmd = [ "cp", "-v",  src, dest_dir ]
+    cmd = ["cp", "-v", src, dest_dir]
     cmd_runner.run(cmd, as_root=True).wait()
 
     final = os.path.join(dest_dir, os.path.basename(src))
-    cmd = [ "chown", "%s:%s" % (os.getuid(), os.getgid()), final ]
+    cmd = ["chown", "%s:%s" % (os.getuid(), os.getgid()), final]
     cmd_runner.run(cmd, as_root=True).wait()
 
 
@@ -1353,7 +1353,7 @@
 
 class FastModelConfig(BoardConfig):
     supports_writing_to_mmc = False
-      
+
     @classmethod
     def _get_bootcmd(cls, d_img_data):
         """Get the bootcmd for FastModel.
@@ -1366,14 +1366,15 @@
     def _make_boot_files_v2(cls, boot_env, chroot_dir, boot_dir,
                          boot_device_or_file, k_img_data, i_img_data,
                          d_img_data):
-        output_dir=os.path.dirname(boot_device_or_file)
+        output_dir = os.path.dirname(boot_device_or_file)
 
-        bootwrapper=_get_file_matching("%s/boot/img.axf" % chroot_dir)
+        bootwrapper = _get_file_matching("%s/boot/img.axf" % chroot_dir)
 
         for filename in (bootwrapper, k_img_data, i_img_data, d_img_data):
             if filename != None:
                 copy_drop(filename, output_dir)
 
+
 class SamsungConfig(BoardConfig):
     @classproperty
     def extra_serial_opts(cls):
@@ -1511,6 +1512,7 @@
     mmc_part_offset = 1
     mmc_option = '0:2'
 
+
 class I386Config(BoardConfig):
     # define serial
     serial_tty = 'ttyS0'
@@ -1551,7 +1553,7 @@
         device = Device(boot_device_or_file)
         img_size = device.getLength() * SECTOR_SIZE
         img_loop = register_loopback(boot_device_or_file, 0, img_size)
-        
+
         # install bootloader
         cmd_runner.run([cls.BOOTLOADER_CMD, '--boot-directory=%s' % boot_dir,
             '--modules', 'part_msdos', img_loop],

=== modified file 'linaro_image_tools/media_create/check_device.py'
--- linaro_image_tools/media_create/check_device.py	2011-06-17 17:54:19 +0000
+++ linaro_image_tools/media_create/check_device.py	2012-06-07 13:22:47 +0000
@@ -26,7 +26,7 @@
 
 def _get_system_bus_and_udisks_iface():
     """Return the system bus and the UDisks interface.
-    
+
     :return: System bus and UDisks inteface tuple.
     """
     bus = dbus.SystemBus()
@@ -73,21 +73,21 @@
     devices.sort()
     for path in devices:
         device = bus.get_object("org.freedesktop.UDisks", path)
-        device_file =  _get_dbus_property('DeviceFile', device, path)
-        
+        device_file = _get_dbus_property('DeviceFile', device, path)
+
         mount_paths = _get_dbus_property('device-mount-paths', device, path)
         mount_point = ''.join(b for b in mount_paths)
         if mount_point == '':
             mount_point = 'none'
-        
+
         if _get_dbus_property('DeviceIsPartition', device, path):
             part_size = _get_dbus_property('partition-size', device, path)
             print '%-16s %-16s %dMB' % (
-                device_file, mount_point, part_size / 1024**2)
+                device_file, mount_point, part_size / 1024 ** 2)
         else:
             device_size = _get_dbus_property('device-size', device, path)
             print '%-16s %-16s %dMB' % (
-                device_file, mount_point, device_size / 1024**2)
+                device_file, mount_point, device_size / 1024 ** 2)
 
 
 def _select_device(device):
@@ -112,7 +112,7 @@
 
 def confirm_device_selection_and_ensure_it_is_ready(
                                                 device,
-                                                yes_to_mmc_selection = False):
+                                                yes_to_mmc_selection=False):
     """Confirm this is the device to use and ensure it's ready.
 
     If the device exists, the user is asked to confirm that this is the

=== modified file 'linaro_image_tools/media_create/chroot_utils.py'
--- linaro_image_tools/media_create/chroot_utils.py	2011-11-16 21:09:18 +0000
+++ linaro_image_tools/media_create/chroot_utils.py	2012-06-07 13:12:42 +0000
@@ -32,6 +32,7 @@
 # functions would only be called after l-m-c.py exits.
 local_atexit = []
 
+
 def prepare_chroot(chroot_dir, tmp_dir):
     """Prepares a chroot to run commands in it (networking and QEMU setup)."""
     chroot_etc = os.path.join(chroot_dir, 'etc')
@@ -42,6 +43,7 @@
         copy_file('/usr/bin/qemu-arm-static',
                   os.path.join(chroot_dir, 'usr', 'bin'))
 
+
 def install_hwpacks(
     chroot_dir, tmp_dir, tools_dir, hwpack_force_yes, verified_files, *hwpack_files):
     """Install the given hwpacks onto the given chroot."""

=== modified file 'linaro_image_tools/media_create/rootfs.py'
--- linaro_image_tools/media_create/rootfs.py	2012-04-19 01:12:10 +0000
+++ linaro_image_tools/media_create/rootfs.py	2012-06-07 12:59:21 +0000
@@ -110,7 +110,7 @@
         config = ''
     for interface in interfaces:
         if interface not in config:
-            config += "auto %(if)s\niface %(if)s inet dhcp\n" % ({ 'if': interface })
+            config += "auto %(if)s\niface %(if)s inet dhcp\n" % ({'if': interface})
     if config != '':
         write_data_to_protected_file(if_path, config)
 
@@ -157,7 +157,7 @@
     """Is there enough space for a swap file in the given root disk?"""
     statvfs = os.statvfs(root_disk)
     free_space = statvfs.f_bavail * statvfs.f_bsize
-    swap_size_in_bytes = int(swap_size_in_mega_bytes) * 1024**2
+    swap_size_in_bytes = int(swap_size_in_mega_bytes) * 1024 ** 2
     if free_space >= swap_size_in_bytes:
         return True
     return False

=== modified file 'linaro_image_tools/media_create/tests/__init__.py'
--- linaro_image_tools/media_create/tests/__init__.py	2011-03-23 22:25:10 +0000
+++ linaro_image_tools/media_create/tests/__init__.py	2012-06-07 13:12:42 +0000
@@ -1,5 +1,6 @@
 import unittest
 
+
 def test_suite():
     module_names = ['linaro_image_tools.media_create.tests.test_media_create',
                    ]

=== modified file 'linaro_image_tools/media_create/tests/fixtures.py'
--- linaro_image_tools/media_create/tests/fixtures.py	2011-03-24 11:05:26 +0000
+++ linaro_image_tools/media_create/tests/fixtures.py	2012-06-07 13:12:42 +0000
@@ -49,6 +49,7 @@
     def get_tarball(self):
         return self.tarball
 
+
 class MockCallableWithPositionalArgs(object):
     """A callable mock which just stores the positional args given to it.
 
@@ -57,6 +58,7 @@
     """
     calls = None
     return_value = None
+
     def __call__(self, *args):
         if self.calls is None:
             self.calls = []

=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
--- linaro_image_tools/media_create/tests/test_media_create.py	2012-05-24 10:47:27 +0000
+++ linaro_image_tools/media_create/tests/test_media_create.py	2012-06-07 13:12:42 +0000
@@ -301,6 +301,7 @@
         self.MockHardwarepackHandler.metadata_dict = {
             field_to_test: data_to_set,
             }
+
         class config(BoardConfig):
             pass
         config.set_metadata('ahwpack.tar.gz')
@@ -315,6 +316,7 @@
         self.MockHardwarepackHandler.metadata_dict = {
             field_to_test: data_to_set,
             }
+
         class config(BoardConfig):
             pass
         config.set_metadata('ahwpack.tar.gz')
@@ -329,6 +331,7 @@
         self.MockHardwarepackHandler.metadata_dict = {
             field_to_test: data_to_set,
             }
+
         class config(BoardConfig):
             pass
         config.set_metadata('ahwpack.tar.gz')
@@ -343,6 +346,7 @@
         self.MockHardwarepackHandler.metadata_dict = {
             field_to_test: data_to_set,
             }
+
         class config(BoardConfig):
             pass
         config.set_metadata('ahwpack.tar.gz')
@@ -357,6 +361,7 @@
         self.MockHardwarepackHandler.metadata_dict = {
             field_to_test: data_to_set,
             }
+
         class config(BoardConfig):
             pass
         config.set_metadata('ahwpack.tar.gz')
@@ -371,6 +376,7 @@
         self.MockHardwarepackHandler.metadata_dict = {
             field_to_test: data_to_set,
             }
+
         class config(BoardConfig):
             pass
         config.set_metadata('ahwpack.tar.gz')
@@ -385,6 +391,7 @@
         self.MockHardwarepackHandler.metadata_dict = {
             field_to_test: data_to_set,
             }
+
         class config(BoardConfig):
             pass
         config.set_metadata('ahwpack.tar.gz')
@@ -403,6 +410,7 @@
         self.MockHardwarepackHandler.metadata_dict = {
             field_to_test: data_to_set,
             }
+
         class config(BoardConfig):
             pass
         config.set_metadata('ahwpack.tar.gz')
@@ -419,6 +427,7 @@
         self.MockHardwarepackHandler.metadata_dict = {
             field_to_test: data_to_set,
             }
+
         class config(BoardConfig):
             pass
         config.set_metadata('ahwpack.tar.gz')
@@ -435,6 +444,7 @@
         self.MockHardwarepackHandler.metadata_dict = {
             field_to_test: data_to_set,
             }
+
         class config(BoardConfig):
             pass
         config.set_metadata('ahwpack.tar.gz')
@@ -449,6 +459,7 @@
         self.MockHardwarepackHandler.metadata_dict = {
             field_to_test: data_to_set,
             }
+
         class config(BoardConfig):
             pass
         config.set_metadata('ahwpack.tar.gz')
@@ -463,6 +474,7 @@
         self.MockHardwarepackHandler.metadata_dict = {
             field_to_test: data_to_set,
             }
+
         class config(BoardConfig):
             pass
         config.set_metadata('ahwpack.tar.gz')
@@ -477,6 +489,7 @@
         self.MockHardwarepackHandler.metadata_dict = {
             field_to_test: data_to_set,
             }
+
         class config(BoardConfig):
             pass
         self.assertRaises(AssertionError, config.set_metadata, 'ahwpack.tar.gz')
@@ -1091,6 +1104,7 @@
             'make_dtb', 'make_boot_script', 'make_boot_ini']
         self.assertEqual(expected, self.funcs_calls)
 
+
 class TestPopulateRawPartition(TestCaseWithFixtures):
 
     def setUp(self):
@@ -1344,6 +1358,7 @@
 
     def test_omap_make_boot_files_v2(self):
         self.set_appropriate_serial_tty_called = False
+
         class config(boards.BeagleConfig):
             hwpack_format = HardwarepackHandler.FORMAT_2
         self.mock_set_appropriate_serial_tty(config)
@@ -1687,6 +1702,7 @@
 
     def test_extra_boot_args_options_is_picked_by_get_boot_env(self):
         boot_args = 'whatever'
+
         class config(BoardConfig):
             extra_boot_args_options = boot_args
         boot_commands = config._get_boot_env(
@@ -1698,6 +1714,7 @@
 
     def test_passing_None_to_add_boot_args(self):
         boot_args = 'extra-args'
+
         class config(BoardConfig):
             extra_boot_args_options = boot_args
         config.add_boot_args(None)
@@ -1706,6 +1723,7 @@
     def test_passing_string_to_add_boot_args(self):
         boot_args = 'extra-args'
         extra_args = 'user-args'
+
         class config(BoardConfig):
             extra_boot_args_options = boot_args
         config.add_boot_args(extra_args)
@@ -1714,6 +1732,7 @@
 
     def test_passing_string_to_add_boot_args_with_no_default_extra_args(self):
         extra_args = 'user-args'
+
         class config(BoardConfig):
             extra_boot_args_options = None
         config.add_boot_args(extra_args)
@@ -1725,6 +1744,7 @@
         boot_arg_path = self.createTempFileAsFixture()
         with open(boot_arg_path, 'w') as boot_arg_file:
             boot_arg_file.write(extra_args)
+
         class config(BoardConfig):
             extra_boot_args_options = boot_args
         config.add_boot_args_from_file(boot_arg_path)
@@ -1733,6 +1753,7 @@
 
     def test_passing_None_to_add_boot_args_from_file(self):
         boot_args = 'extra-args'
+
         class config(BoardConfig):
             extra_boot_args_options = boot_args
         config.add_boot_args_from_file(None)
@@ -1744,6 +1765,7 @@
         boot_arg_path = self.createTempFileAsFixture()
         with open(boot_arg_path, 'w') as boot_arg_file:
             boot_arg_file.write('\n\n \t ' + extra_args + '  \n\n')
+
         class config(BoardConfig):
             extra_boot_args_options = boot_args
         config.add_boot_args_from_file(boot_arg_path)
@@ -1963,6 +1985,7 @@
         self.useFixture(MockSomethingFixture(
             boards, '_get_mlo_file',
             lambda chroot_dir: "%s/MLO" % chroot_dir))
+
         class config(BoardConfig):
             pass
         config.set_metadata([])
@@ -2064,6 +2087,7 @@
         tempdir = self.useFixture(CreateTempDirFixture()).tempdir
         flavorx = 'flavorX'
         flavorxy = 'flavorXY'
+
         class config(boards.BoardConfig):
             kernel_flavors = [flavorx, flavorxy]
         for f in reversed(config.kernel_flavors):
@@ -2078,6 +2102,7 @@
         tempdir = self.useFixture(CreateTempDirFixture()).tempdir
         flavorx = 'flavorX'
         flavorxy = 'flavorXY'
+
         class config(boards.BoardConfig):
             kernel_flavors = [flavorx, flavorxy]
             dtb_name = 'board_name.dtb'
@@ -2097,6 +2122,7 @@
         tempdir = self.useFixture(CreateTempDirFixture()).tempdir
         flavor1 = 'flavorXY'
         flavor2 = 'flavorAA'
+
         class config(boards.BoardConfig):
             kernel_flavors = [flavor1, flavor2]
         kfile = os.path.join(tempdir, 'vmlinuz-1-%s' % flavor1)
@@ -2110,6 +2136,7 @@
         tempdir = self.useFixture(CreateTempDirFixture()).tempdir
         flavor1 = 'flavorXY'
         flavor2 = 'flavorAA'
+
         class config(boards.BoardConfig):
             kernel_flavors = [flavor1, flavor2]
             dtb_name = 'board_name.dtb'
@@ -2128,6 +2155,7 @@
         tempdir = self.useFixture(CreateTempDirFixture()).tempdir
         flavor1 = 'flavorXY'
         flavor2 = 'flavorAA'
+
         class config(boards.BoardConfig):
             kernel_flavors = [flavor1, flavor2]
         self.assertRaises(ValueError, config._get_kflavor_files, tempdir)
@@ -2345,13 +2373,13 @@
         # Stub time.sleep() as create_partitions() use that.
         self.orig_sleep = time.sleep
         time.sleep = lambda s: None
-        self.linux_image_size = 30 * 1024**2
+        self.linux_image_size = 30 * 1024 ** 2
         self.linux_offsets_and_sizes = [
             (16384 * SECTOR_SIZE, 15746 * SECTOR_SIZE),
             (32768 * SECTOR_SIZE, (self.linux_image_size -
                                         32768 * SECTOR_SIZE))
             ]
-        self.android_image_size = 256 * 1024**2
+        self.android_image_size = 256 * 1024 ** 2
         # Extended partition info takes 32 sectors from the first ext partition
         ext_part_size = 32
         self.android_offsets_and_sizes = [
@@ -2367,7 +2395,7 @@
         self.android_snowball_offsets_and_sizes = [
             (8192 * SECTOR_SIZE, 24639 * SECTOR_SIZE),
             (32831 * SECTOR_SIZE, 65536 * SECTOR_SIZE),
-            ((98367 + ext_part_size)* SECTOR_SIZE,
+            ((98367 + ext_part_size) * SECTOR_SIZE,
              (65536 - ext_part_size) * SECTOR_SIZE),
             (294975 * SECTOR_SIZE, 131072 * SECTOR_SIZE),
             ((426047 + ext_part_size) * SECTOR_SIZE,
@@ -2403,10 +2431,10 @@
         self.assertEqual(512 * 1024, convert_size_to_bytes('512K'))
 
     def test_convert_size_in_mbytes_to_bytes(self):
-        self.assertEqual(100 * 1024**2, convert_size_to_bytes('100M'))
+        self.assertEqual(100 * 1024 ** 2, convert_size_to_bytes('100M'))
 
     def test_convert_size_in_gbytes_to_bytes(self):
-        self.assertEqual(12 * 1024**3, convert_size_to_bytes('12G'))
+        self.assertEqual(12 * 1024 ** 3, convert_size_to_bytes('12G'))
 
     def test_convert_size_float_no_suffix(self):
         self.assertEqual(1539, convert_size_to_bytes('1539.49'))
@@ -2418,10 +2446,10 @@
         self.assertEqual(int(round(234.8 * 1024)), convert_size_to_bytes('234.8K'))
 
     def test_convert_size_float_in_mbytes_to_bytes(self):
-        self.assertEqual(int(round(876.123 * 1024**2)), convert_size_to_bytes('876.123M'))
+        self.assertEqual(int(round(876.123 * 1024 ** 2)), convert_size_to_bytes('876.123M'))
 
     def test_convert_size_float_in_gbytes_to_bytes(self):
-        self.assertEqual(int(round(1.9 * 1024**3)), convert_size_to_bytes('1.9G'))
+        self.assertEqual(int(round(1.9 * 1024 ** 3)), convert_size_to_bytes('1.9G'))
 
     def test_calculate_partition_size_and_offset(self):
         tmpfile = self._create_tmpfile()
@@ -2581,6 +2609,7 @@
         popen_fixture = self.useFixture(MockCmdRunnerPopenFixture())
         self.useFixture(MockSomethingFixture(
             sys, 'stdout', open('/dev/null', 'w')))
+
         def ensure_partition_not_mounted(part):
             raise AssertionError(
                 "ensure_partition_is_not_mounted must not be called when "
@@ -2717,6 +2746,7 @@
 
     def test_basic(self):
         popen_fixture = self.useFixture(MockCmdRunnerPopenFixture())
+
         def test_func():
             with partition_mounted('foo', 'bar', '-t', 'proc'):
                 pass
@@ -2728,6 +2758,7 @@
 
     def test_exception_raised_inside_with_block(self):
         popen_fixture = self.useFixture(MockCmdRunnerPopenFixture())
+
         def test_func():
             with partition_mounted('foo', 'bar'):
                 raise TestException('something')
@@ -2745,10 +2776,12 @@
         # otherwise it could shadow an exception raised inside the 'with'
         # block.
         popen_fixture = self.useFixture(MockCmdRunnerPopenFixture())
+
         def failing_umount(path):
             raise cmd_runner.SubcommandNonZeroReturnValue('umount', 1)
         self.useFixture(MockSomethingFixture(
             partitions, 'umount', failing_umount))
+
         def test_func():
             with partition_mounted('foo', 'bar'):
                 pass
@@ -2923,6 +2956,7 @@
         # command that it runs, but we need to monkey-patch SUDO_ARGS because
         # we don't want to use 'sudo' in tests.
         orig_sudo_args = cmd_runner.SUDO_ARGS
+
         def restore_sudo_args():
             cmd_runner.SUDO_ARGS = orig_sudo_args
         self.addCleanup(restore_sudo_args)
@@ -2934,6 +2968,7 @@
         tempdir = self.useFixture(CreateTempDirFixture()).tempdir
         popen_fixture = self.useFixture(MockCmdRunnerPopenFixture())
         file1 = self.createTempFileAsFixture(dir=tempdir)
+
         def mock_list_files(directory):
             return [file1]
         self.useFixture(MockSomethingFixture(
@@ -2947,14 +2982,14 @@
     def test_has_space_left_for_swap(self):
         statvfs = os.statvfs('/')
         space_left = statvfs.f_bavail * statvfs.f_bsize
-        swap_size_in_megs = space_left / (1024**2)
+        swap_size_in_megs = space_left / (1024 ** 2)
         self.assertTrue(
             has_space_left_for_swap('/', swap_size_in_megs))
 
     def test_has_no_space_left_for_swap(self):
         statvfs = os.statvfs('/')
         space_left = statvfs.f_bavail * statvfs.f_bsize
-        swap_size_in_megs = (space_left / (1024**2)) + 1
+        swap_size_in_megs = (space_left / (1024 ** 2)) + 1
         self.assertFalse(
             has_space_left_for_swap('/', swap_size_in_megs))
 
@@ -2972,6 +3007,7 @@
         tempdir = self.useFixture(CreateTempDirFixture()).get_temp_dir()
         os.makedirs(os.path.join(tempdir, 'etc', 'network'))
         if_path = os.path.join(tempdir, 'etc', 'network', 'interfaces')
+
         class board_config(boards.BoardConfig):
             pass
 
@@ -2985,6 +3021,7 @@
         tempdir = self.useFixture(CreateTempDirFixture()).get_temp_dir()
         os.makedirs(os.path.join(tempdir, 'etc', 'network'))
         if_path = os.path.join(tempdir, 'etc', 'network', 'interfaces')
+
         class board_config(boards.BoardConfig):
             wired_interfaces = ['eth0']
 
@@ -3000,6 +3037,7 @@
         tempdir = self.useFixture(CreateTempDirFixture()).get_temp_dir()
         os.makedirs(os.path.join(tempdir, 'etc', 'network'))
         if_path = os.path.join(tempdir, 'etc', 'network', 'interfaces')
+
         class board_config(boards.BoardConfig):
             wired_interfaces = ['eth0', 'eth1']
             wireless_interfaces = ['wlan0']
@@ -3021,6 +3059,7 @@
         if_path = os.path.join(tempdir, 'etc', 'network', 'interfaces')
         with open(if_path, 'w') as interfaces:
             interfaces.write('Original contents of file.\n')
+
         class board_config(boards.BoardConfig):
             wired_interfaces = ['eth0']
 
@@ -3105,6 +3144,7 @@
 
     def test_ensure_device_partitions_not_mounted(self):
         partitions_umounted = []
+
         def ensure_partition_is_not_mounted_mock(part):
             partitions_umounted.append(part)
         self.useFixture(MockSomethingFixture(
@@ -3301,11 +3341,14 @@
         self.useFixture(MockSomethingFixture(
             sys, 'stderr', open('/dev/null', 'w')))
         self.call_order = []
+
         class TestException(Exception):
             pass
+
         def raising_func():
             self.call_order.append('raising_func')
             raise TestException()
+
         def behaving_func():
             self.call_order.append('behaving_func')
             self.behaving_func_called = True
@@ -3354,6 +3397,7 @@
 
     def setUp(self):
         super(TestInstallHWPack, self).setUp()
+
         # Ensure the list of cleanup functions gets cleared to make sure tests
         # don't interfere with one another.
         def clear_atexits():

=== modified file 'linaro_image_tools/media_create/unpack_binary_tarball.py'
--- linaro_image_tools/media_create/unpack_binary_tarball.py	2011-03-08 15:32:43 +0000
+++ linaro_image_tools/media_create/unpack_binary_tarball.py	2012-06-07 13:12:42 +0000
@@ -27,6 +27,7 @@
     proc.wait()
     return proc.returncode
 
+
 def unpack_binary_tarball(tarball, unpack_dir, as_root=True):
     proc = cmd_runner.run(
         ['tar', '--numeric-owner', '-C', unpack_dir, '-xf', tarball],

=== modified file 'linaro_image_tools/testing.py'
--- linaro_image_tools/testing.py	2011-03-24 11:14:44 +0000
+++ linaro_image_tools/testing.py	2012-06-07 13:22:47 +0000
@@ -56,4 +56,3 @@
         _, filename = tempfile.mkstemp(prefix=prefix, dir=dir)
         self.addCleanup(os.unlink, filename)
         return filename
-

=== modified file 'linaro_image_tools/tests/__init__.py'
--- linaro_image_tools/tests/__init__.py	2012-03-02 13:56:37 +0000
+++ linaro_image_tools/tests/__init__.py	2012-06-07 13:22:47 +0000
@@ -7,6 +7,7 @@
     )
 from linaro_image_tools.utils import has_command
 
+
 def test_suite():
     module_names = [
         'linaro_image_tools.tests.test_cmd_runner',
@@ -14,11 +15,14 @@
         ]
     # if pyflakes is installed and we're running from a bzr checkout...
     if has_command('pyflakes') and not os.path.isabs(__file__):
-        # ...also run the pyflakes tests
+        # ...also run the pyflakes test
         module_names.append('linaro_image_tools.tests.test_pyflakes')
+    # if pep8 is installed and we're running from a bzr checkout...
+    if has_command('pep8') and not os.path.isabs(__file__):
+        # ...also run the pep8 test
+        module_names.append('linaro_image_tools.tests.test_pep8')
     loader = unittest.TestLoader()
     suite = loader.loadTestsFromNames(module_names)
     suite.addTests(hwpack_suite())
     suite.addTests(media_create_suite())
     return suite
-

=== modified file 'linaro_image_tools/tests/fixtures.py'
--- linaro_image_tools/tests/fixtures.py	2011-06-20 09:10:10 +0000
+++ linaro_image_tools/tests/fixtures.py	2012-06-07 13:22:47 +0000
@@ -105,6 +105,7 @@
     def stdin(self):
         return StringIO()
 
+
 class MockCmdRunnerPopenFixture(MockSomethingFixture):
     """A test fixture which mocks cmd_runner.do_run with the given mock.
 
@@ -121,4 +122,3 @@
             raise AssertionError(
                 "You should call wait() or communicate() to ensure "
                 "the subprocess is finished before proceeding.")
-

=== modified file 'linaro_image_tools/tests/test_cmd_runner.py'
--- linaro_image_tools/tests/test_cmd_runner.py	2011-04-04 12:57:33 +0000
+++ linaro_image_tools/tests/test_cmd_runner.py	2012-06-07 13:22:47 +0000
@@ -52,6 +52,7 @@
         cmd_runner.sanitize_path(self.env)
         self.assertEqual(cmd_runner.DEFAULT_PATH, self.env['PATH'])
 
+
 class TestCmdRunner(TestCaseWithFixtures):
 
     def test_run(self):
@@ -110,4 +111,3 @@
         proc = cmd_runner.Popen('true')
         returncode = proc.wait()
         self.assertEqual(0, returncode)
-

=== added file 'linaro_image_tools/tests/test_pep8.py'
--- linaro_image_tools/tests/test_pep8.py	1970-01-01 00:00:00 +0000
+++ linaro_image_tools/tests/test_pep8.py	2012-06-08 07:59:18 +0000
@@ -0,0 +1,43 @@
+# Copyright (C) 2012 Linaro Ltd.
+#
+# Author: Loic Minier <loic.minier@linaro.org>
+#
+# This file is part of Linaro Image Tools.
+#
+# Linaro Image Tools 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, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Linaro Image Tools 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, see <http://www.gnu.org/licenses/>.
+
+import subprocess
+from testtools import TestCase
+
+
+class TestPep8(TestCase):
+    def test_pep8(self):
+        # too many of these, should preferably be fixed while updating
+        # surrounding code:
+        #    E202 whitespace before ')' or ']'
+        #    E501 line too long
+        #    W291 trailing whitespace
+        # NB: E202 is actually only reported with the natty version of pep8 and
+        #     can be re-enabled once we drop support for natty
+        ignore = ['E202', 'E501', 'W291']
+        # ignore return code
+        proc = subprocess.Popen(['pep8',
+            '--repeat',
+            '--ignore=%s' % ','.join(ignore),
+            '.'],
+            stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE)
+        (stdout, stderr) = proc.communicate()
+        self.assertEquals('', stdout)
+        self.assertEquals('', stderr)

=== modified file 'linaro_image_tools/tests/test_pyflakes.py'
--- linaro_image_tools/tests/test_pyflakes.py	2011-11-21 13:48:20 +0000
+++ linaro_image_tools/tests/test_pyflakes.py	2012-06-07 13:22:47 +0000
@@ -20,6 +20,7 @@
 import subprocess
 from testtools import TestCase
 
+
 class TestPyflakes(TestCase):
     def test_pyflakes(self):
         # ignore return code
@@ -29,4 +30,3 @@
         (stdout, stderr) = proc.communicate()
         self.assertEquals('', stdout)
         self.assertEquals('', stderr)
-

