From patchwork Thu Aug 28 12:44:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 383819 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3E142140120 for ; Thu, 28 Aug 2014 22:45:28 +1000 (EST) Received: from localhost ([::1]:36378 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMz4w-000596-Bg for incoming@patchwork.ozlabs.org; Thu, 28 Aug 2014 08:45:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMz4G-0004AG-VC for qemu-devel@nongnu.org; Thu, 28 Aug 2014 08:44:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMz4B-0008BH-PQ for qemu-devel@nongnu.org; Thu, 28 Aug 2014 08:44:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64522) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMz4B-0008BA-I6 for qemu-devel@nongnu.org; Thu, 28 Aug 2014 08:44:39 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7SCiZer025090 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 28 Aug 2014 08:44:36 -0400 Received: from localhost (ovpn-112-59.ams2.redhat.com [10.36.112.59]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s7SCiYvQ027406; Thu, 28 Aug 2014 08:44:35 -0400 From: Stefan Hajnoczi To: Date: Thu, 28 Aug 2014 13:44:22 +0100 Message-Id: <1409229867-16775-2-git-send-email-stefanha@redhat.com> In-Reply-To: <1409229867-16775-1-git-send-email-stefanha@redhat.com> References: <1409229867-16775-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , Stefan Hajnoczi Subject: [Qemu-devel] [PULL 1/6] qapi.py: avoid Python 2.5+ any() function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org There is one instance of any() in qapi.py that breaks builds on older distros that ship Python 2.4 (like RHEL5): GEN qmp-commands.h Traceback (most recent call last): File "build/scripts/qapi-commands.py", line 445, in ? exprs = parse_schema(input_file) File "build/scripts/qapi.py", line 329, in parse_schema schema = QAPISchema(open(input_file, "r")) File "build/scripts/qapi.py", line 110, in __init__ if any(include_path == elem[1] NameError: global name 'any' is not defined Signed-off-by: Stefan Hajnoczi --- scripts/qapi.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/qapi.py b/scripts/qapi.py index f2c6d1f..77d46aa 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -107,10 +107,10 @@ class QAPISchema: 'Expected a file name (string), got: %s' % include) include_path = os.path.join(self.input_dir, include) - if any(include_path == elem[1] - for elem in self.include_hist): - raise QAPIExprError(expr_info, "Inclusion loop for %s" - % include) + for elem in self.include_hist: + if include_path == elem[1]: + raise QAPIExprError(expr_info, "Inclusion loop for %s" + % include) # skip multiple include of the same file if include_path in previously_included: continue