diff mbox

[Branch,~linaro-image-tools/linaro-image-tools/trunk] Rev 396: Merge lp:~lool/linaro-image-tools/misc-syntax-fixes; fixes support for older

Message ID 20110728145543.15867.93716.launchpad@loganberry.canonical.com
State Accepted
Headers show

Commit Message

loic.minier@linaro.org July 28, 2011, 2:55 p.m. UTC
Merge authors:
  Loïc Minier (lool)
Related merge proposals:
  https://code.launchpad.net/~lool/linaro-image-tools/misc-syntax-fixes/+merge/69621
  proposed by: Loïc Minier (lool)
------------------------------------------------------------
revno: 396 [merge]
fixes bug(s): https://launchpad.net/bugs/817060
committer: Loïc Minier <loic.minier@linaro.org>
branch nick: linaro-image-tools
timestamp: Thu 2011-07-28 16:53:44 +0200
message:
  Merge lp:~lool/linaro-image-tools/misc-syntax-fixes; fixes support for older
  Python versions and various syntax issues reported by pyflakes; LP: #817060.
modified:
  README
  linaro_image_tools/fetch_image.py
  linaro_image_tools/hwpack/builder.py
  linaro_image_tools/media_create/tests/test_media_create.py
  linaro_image_tools/tests/test_pyflakes.py


--
lp:linaro-image-tools
https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk

You are subscribed to branch lp:linaro-image-tools.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'README'
--- README	2011-04-29 11:04:38 +0000
+++ README	2011-07-28 10:48:11 +0000
@@ -33,6 +33,9 @@ 
   - qemu-kvm
   - sfdisk
 
+Also consider installing pyflakes, which is optional but will enable more
+tests.
+
 And run the following command:
 
   $ testr init

=== modified file 'linaro_image_tools/fetch_image.py'
--- linaro_image_tools/fetch_image.py	2011-07-27 19:39:57 +0000
+++ linaro_image_tools/fetch_image.py	2011-07-28 13:37:20 +0000
@@ -47,7 +47,6 @@ 
         self.event_queue        = None
         self.to_download        = None
         self.sha1_files         = None
-        self.gpg_files          = None
         self.downloaded_files   = None
         self.sig_files          = None
         self.verified_files     = None
@@ -382,8 +381,8 @@ 
         self.to_download = self.generate_download_list()
 
         gpg_urls = [f for f in self.to_download if re.search('\.asc$', f)]
-        gpg_files = self.download_files(gpg_urls, self.settings,
-                                        force_download=force_download)
+        self.download_files(
+            gpg_urls, self.settings, force_download=force_download)
 
     def _check_downloads(self):
         self.get_sig_files()
@@ -475,10 +474,10 @@ 
                 else:
                     print "Re-downloading corrupt files"
                 # There are some files to re-download
-                redownloaded_files = self.download_files(
-                                           to_retry, self.settings,
-                                           self.event_queue,
-                                           force_download=True)
+                self.download_files(to_retry,
+                                    self.settings,
+                                    self.event_queue,
+                                    force_download=True)
 
                 (self.verified_files,
                  self.gpg_sig_ok) = utils.verify_file_integrity(self.sig_files)

=== modified file 'linaro_image_tools/hwpack/builder.py'
--- linaro_image_tools/hwpack/builder.py	2011-06-20 13:33:01 +0000
+++ linaro_image_tools/hwpack/builder.py	2011-07-28 10:33:14 +0000
@@ -134,28 +134,30 @@ 
                 fetcher = PackageFetcher(
                     sources, architecture=architecture,
                     prefer_label=LOCAL_ARCHIVE_LABEL)
-                with fetcher, PackageUnpacker() as package_unpacker:
-                    fetcher.ignore_packages(self.config.assume_installed)
-                    packages = fetcher.fetch_packages(
-                        packages, download_content=self.config.include_debs)
-
-                    if self.config.u_boot_package is not None:
-                        u_boot_package = self.find_fetched_package(
-                            packages, self.config.u_boot_package)
-                        hwpack.metadata.u_boot = self.add_file_to_hwpack(
-                            u_boot_package, self.config.u_boot_file,
-                            package_unpacker, hwpack, hwpack.U_BOOT_DIR)
-
-                    logger.debug("Adding packages to hwpack")
-                    hwpack.add_packages(packages)
-                    for local_package in local_packages:
-                        if local_package not in packages:
-                            logger.warning(
-                                "Local package '%s' not included",
-                                local_package.name)
-                    hwpack.add_dependency_package(self.config.packages)
-                    with open(hwpack.filename(), 'w') as f:
-                        hwpack.to_file(f)
-                        logger.info("Wrote %s" % hwpack.filename())
-                    with open(hwpack.filename('.manifest.txt'), 'w') as f:
-                        f.write(hwpack.manifest_text())
+                with fetcher:
+                    with PackageUnpacker() as package_unpacker:
+                        fetcher.ignore_packages(self.config.assume_installed)
+                        packages = fetcher.fetch_packages(
+                            packages,
+                            download_content=self.config.include_debs)
+
+                        if self.config.u_boot_package is not None:
+                            u_boot_package = self.find_fetched_package(
+                                packages, self.config.u_boot_package)
+                            hwpack.metadata.u_boot = self.add_file_to_hwpack(
+                                u_boot_package, self.config.u_boot_file,
+                                package_unpacker, hwpack, hwpack.U_BOOT_DIR)
+
+                        logger.debug("Adding packages to hwpack")
+                        hwpack.add_packages(packages)
+                        for local_package in local_packages:
+                            if local_package not in packages:
+                                logger.warning(
+                                    "Local package '%s' not included",
+                                    local_package.name)
+                        hwpack.add_dependency_package(self.config.packages)
+                        with open(hwpack.filename(), 'w') as f:
+                            hwpack.to_file(f)
+                            logger.info("Wrote %s" % hwpack.filename())
+                        with open(hwpack.filename('.manifest.txt'), 'w') as f:
+                            f.write(hwpack.manifest_text())

=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
--- linaro_image_tools/media_create/tests/test_media_create.py	2011-07-26 15:20:56 +0000
+++ linaro_image_tools/media_create/tests/test_media_create.py	2011-07-28 10:43:00 +0000
@@ -2068,6 +2068,8 @@ 
             with partition_mounted('foo', 'bar'):
                 pass
         test_func()
+        expected = ['sudo -E mount foo bar', 'sync']
+        self.assertEqual(expected, popen_fixture.mock.commands_executed)
 
 
 class TestPopulateBoot(TestCaseWithFixtures):

=== modified file 'linaro_image_tools/tests/test_pyflakes.py'
--- linaro_image_tools/tests/test_pyflakes.py	2011-06-21 09:18:32 +0000
+++ linaro_image_tools/tests/test_pyflakes.py	2011-07-28 10:44:05 +0000
@@ -29,8 +29,8 @@ 
         (stdout, stderr) = proc.communicate()
         stdout = stdout.splitlines()
         stdout.sort()
-        expected = ["./linaro_image_tools/utils.py:27: redefinition of "
-                        "unused 'CommandNotFound' from line 25" ]
+        expected = ["./linaro_image_tools/utils.py:29: redefinition of "
+                        "unused 'CommandNotFound' from line 27" ]
         self.assertEquals(expected, stdout)
         self.assertEquals('', stderr)