From patchwork Fri May 6 19:41:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: loic.minier@linaro.org X-Patchwork-Id: 1388 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:51:38 -0000 Delivered-To: patches@linaro.org Received: by 10.224.184.145 with SMTP id ck17cs153436qab; Fri, 6 May 2011 12:41:21 -0700 (PDT) Received: by 10.227.27.98 with SMTP id h34mr4128259wbc.113.1304710880442; Fri, 06 May 2011 12:41:20 -0700 (PDT) Received: from adelie.canonical.com (adelie.canonical.com [91.189.90.139]) by mx.google.com with ESMTP id m6si9984259wbh.113.2011.05.06.12.41.20; Fri, 06 May 2011 12:41:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.139 as permitted sender) client-ip=91.189.90.139; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.139 as permitted sender) smtp.mail=bounces@canonical.com Received: from loganberry.canonical.com ([91.189.90.37]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1QIQtr-0006li-Mx for ; Fri, 06 May 2011 19:41:19 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id AD0642E8952 for ; Fri, 6 May 2011 19:41:19 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: linaro-image-tools X-Launchpad-Branch: ~linaro-image-tools/linaro-image-tools/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 337 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 337: Merge lp:~lool/linaro-image-tools/no-size-suffix; fixes support for Message-Id: <20110506194119.8669.20393.launchpad@loganberry.canonical.com> Date: Fri, 06 May 2011 19:41:19 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="12981"; Instance="initZopeless config overlay" X-Launchpad-Hash: a6be9435ba587a59c5c2a47f22a1ebb300898320 Merge authors: Loïc Minier (lool) Related merge proposals: https://code.launchpad.net/~lool/linaro-image-tools/no-size-suffix/+merge/60183 proposed by: Loïc Minier (lool) review: Approve - Mattias Backman (mabac) ------------------------------------------------------------ revno: 337 [merge] committer: Loïc Minier branch nick: linaro-image-tools timestamp: Fri 2011-05-06 21:39:05 +0200 message: Merge lp:~lool/linaro-image-tools/no-size-suffix; fixes support for --image_size without an unit suffix. modified: linaro_image_tools/media_create/partitions.py linaro_image_tools/media_create/tests/test_media_create.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 === modified file 'linaro_image_tools/media_create/partitions.py' --- linaro_image_tools/media_create/partitions.py 2011-04-29 11:02:39 +0000 +++ linaro_image_tools/media_create/partitions.py 2011-05-06 13:58:54 +0000 @@ -330,6 +330,9 @@ def convert_size_to_bytes(size): """Convert a size string in Kbytes, Mbytes or Gbytes to bytes.""" unit = size[-1].upper() + # no unit? (ends with a digit) + if unit in '0123456789': + return int(size) real_size = int(size[:-1]) if unit == 'K': real_size = real_size * 1024 === modified file 'linaro_image_tools/media_create/tests/test_media_create.py' --- linaro_image_tools/media_create/tests/test_media_create.py 2011-05-02 07:59:07 +0000 +++ linaro_image_tools/media_create/tests/test_media_create.py 2011-05-06 13:29:10 +0000 @@ -846,6 +846,9 @@ return self._create_qemu_img_with_partitions( '16384,15746,0x0C,*\n32768,,,-') + def test_convert_size_no_suffix(self): + self.assertEqual(524288, convert_size_to_bytes('524288')) + def test_convert_size_in_kbytes_to_bytes(self): self.assertEqual(512 * 1024, convert_size_to_bytes('512K'))