From patchwork Thu Apr 12 18:09:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 7770 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 09AE923E29 for ; Thu, 12 Apr 2012 18:10:01 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id C3C70A1814D for ; Thu, 12 Apr 2012 18:10:00 +0000 (UTC) Received: by yhpp61 with SMTP id p61so1580250yhp.11 for ; Thu, 12 Apr 2012 11:10:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=lqKfI8HvTpVo92cyYVdcGeNNL/FV0UHtSB4L8+y/Wak=; b=OsrI5PJM0JIngU3VDjpvSphFcyoG3gTECpOKqTWuBnr+zQUCYZISP8X9Jf6AzJSuhk OTVHQgSUEvc58U1R96CUlegnJK4AidjpPe3fEIkoG6/wtmoaqN8qPvoeeLrOIgA5UZzI rtOXVLcZWtJ7LW12bWn2D1BiMhJ7XduqyNEcBBFxqLIT6g7f55SYzHxhF1BYwFQPvRXs z7ouvbn3QUm+IC7R4GPP6xpORB0OGfKs8jZMrg0A0debhETWqxspyGDEXAV9J//cIWra XympQqCzkPWJUY9yxkKVRDy18tIsaIGJMHky694d/hlKup/i90U5XdiCReqND8lRjTgH wIPQ== Received: by 10.50.189.232 with SMTP id gl8mr3235659igc.50.1334254199864; Thu, 12 Apr 2012 11:09:59 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.70.69 with SMTP id c5csp279575ibj; Thu, 12 Apr 2012 11:09:59 -0700 (PDT) Received: by 10.216.228.165 with SMTP id f37mr2083961weq.83.1334254198605; Thu, 12 Apr 2012 11:09:58 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id he5si23356605wib.44.2012.04.12.11.09.57 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 12 Apr 2012 11:09:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1SIOSu-0006p7-Ov; Thu, 12 Apr 2012 19:09:52 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Boris Matti , qemu-trivial@nongnu.org Subject: [PATCH] configure: Insist on a Python 2, not Python 3 Date: Thu, 12 Apr 2012 19:09:52 +0100 Message-Id: <1334254192-26204-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-Gm-Message-State: ALoCoQnqNc8s7AvBPGtVKbPQJ7uWo3lBmcGx/K9twfyOu99ABDcFh1+BOqzj64ruxmwYYEZzclbe Our Python scripts require Python 2 and will fail on Python 3, eg: File "/home/petmay01/linaro/qemu-from-laptop/qemu/scripts/qapi-commands.py", line 378 except getopt.GetoptError, err: ^ SyntaxError: invalid syntax Add a check to configure that Python is not a Python 3, so we can fail with a comprehensible error rather than an obscure one. Reported-by: Boris Matti Signed-off-by: Peter Maydell --- configure | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/configure b/configure index e05f34b..1d5ab07 100755 --- a/configure +++ b/configure @@ -1242,6 +1242,14 @@ if ! has $python; then exit 1 fi +# Note that if the Python conditional here evaluates True we will exit +# with status 1 which is a shell 'false' value. +if ! "$python" -c 'import sys; sys.exit(sys.version_info[0] >= 3)'; then + echo "Python 2 required but '$python' is version 3 or better." + echo "Use --python=/path/to/python to specify a Python 2." + exit 1 +fi + if test -z "$target_list" ; then target_list="$default_target_list" else