From patchwork Wed Oct 17 11:33:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Morten Svendsen X-Patchwork-Id: 192019 X-Patchwork-Delegate: esben@haabendal.dk Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hugin.dotsrc.org (hugin.dotsrc.org [130.225.254.102]) by ozlabs.org (Postfix) with ESMTP id 09A872C009A for ; Wed, 17 Oct 2012 22:33:41 +1100 (EST) Received: from hugin.dotsrc.org (localhost [127.0.0.1]) by hugin.dotsrc.org (Postfix) with ESMTP id C23193FF84 for ; Wed, 17 Oct 2012 13:33:40 +0200 (CEST) X-Original-To: dev@oe-lite.org Delivered-To: dev@oe-lite.org Received: from mail01.prevas.se (mail01.prevas.se [62.95.78.3]) by hugin.dotsrc.org (Postfix) with ESMTPS id 4E1A73FA0B for ; Wed, 17 Oct 2012 13:33:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=prevas.dk; i=@prevas.dk; l=956; q=dns/txt; s=ironport1; t=1350473617; x=1382009617; h=from:to:subject:date:message-id:in-reply-to:references: mime-version; bh=S+Qq9T3Jlkjt+X710lhP3kejhf+eDFteBMH0D9DsGOI=; b=PvIsxzo03Y5Q1mNYL8ehq9UdP5quxheksKfcPKomrKKxBMVqzkCfFnZh LzQAFWoJNl3kpYOk8OZJP2I+k3BqWmzDq8Wnv3iXtUmvtTfQ3z0j8WofD twwFm3q/c3lR8lc; X-IronPort-AV: E=Sophos;i="4.80,600,1344204000"; d="scan'208";a="2426426" Received: from vmprevas3.prevas.se (HELO smtp.prevas.se) ([172.16.8.103]) by ironport1.prevas.se with ESMTP/TLS/AES128-SHA; 17 Oct 2012 13:33:37 +0200 Received: from fire.prevas.dk (172.16.10.61) by smtp.prevas.se (172.16.8.105) with Microsoft SMTP Server (TLS) id 14.2.318.1; Wed, 17 Oct 2012 13:33:36 +0200 From: Morten Thunberg Svendsen To: Subject: [PATCH 4/4] classes/core: runstrip() print error if filtype can not be determined Date: Wed, 17 Oct 2012 13:33:30 +0200 Message-ID: X-Mailer: git-send-email 1.7.10 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [172.16.10.61] X-BeenThere: dev@oe-lite.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: OE-lite development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dev-bounces@oe-lite.org Errors-To: dev-bounces@oe-lite.org Prints readable error message instead of the following: File "/src/oe-lite/meta/core/classes/core.oeclass", line 147, in runstrip if "not stripped" not in filetype: TypeError: argument of type 'NoneType' is not iterable The actual cause of this error is unknown. The magic python module do not raise an exception when file is not readable, but returns a NoneType object 'None'. --- classes/core.oeclass | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/classes/core.oeclass b/classes/core.oeclass index 33dfe22..9de03fc 100644 --- a/classes/core.oeclass +++ b/classes/core.oeclass @@ -144,6 +144,10 @@ def runstrip(file, d): filemagic.load() filetype = filemagic.file(file) + if not filetype: + bb.error("runstrip() unable to determine file type: %s"%(file)) + return + if "not stripped" not in filetype: print "runstrip() skip %s"%(file) return