From patchwork Mon Oct 17 15:29:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 120234 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3551CB6F6B for ; Tue, 18 Oct 2011 02:29:59 +1100 (EST) Received: from localhost ([::1]:40043 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFp8W-0000yZ-DA for incoming@patchwork.ozlabs.org; Mon, 17 Oct 2011 11:29:56 -0400 Received: from eggs.gnu.org ([140.186.70.92]:42797) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFp8P-0000xh-Pu for qemu-devel@nongnu.org; Mon, 17 Oct 2011 11:29:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RFp8O-0006Aq-HR for qemu-devel@nongnu.org; Mon, 17 Oct 2011 11:29:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13898) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFp8O-0006AT-6z for qemu-devel@nongnu.org; Mon, 17 Oct 2011 11:29:48 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9HFTkt8002529 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 17 Oct 2011 11:29:46 -0400 Received: from localhost (ovpn-113-62.phx2.redhat.com [10.3.113.62]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p9HFTjAk026384; Mon, 17 Oct 2011 11:29:46 -0400 From: Luiz Capitulino To: mdroth@linux.vnet.ibm.com Date: Mon, 17 Oct 2011 13:29:36 -0200 Message-Id: <1318865377-3328-4-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1318865377-3328-1-git-send-email-lcapitulino@redhat.com> References: <1318865377-3328-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 3/4] qapi-types.py: Fail gracefully if out dir is not specified 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 Otherwise we get: Traceback (most recent call last): File "./scripts/qapi-types.py", line 183, in os.makedirs(output_dir) File "/usr/lib64/python2.7/os.py", line 157, in makedirs mkdir(name, mode) OSError: [Errno 2] No such file or directory: '' Signed-off-by: Luiz Capitulino --- scripts/qapi-types.py | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index 8df4b72..4a2ddc4 100644 --- a/scripts/qapi-types.py +++ b/scripts/qapi-types.py @@ -178,7 +178,11 @@ if __name__ == '__main__': prefix = a elif o in ("-o", "--output-dir"): output_dir = a - + + if not output_dir: + sys.stdout.write("ouput directory was not specified\n") + sys.exit(1) + c_file = os.path.join(output_dir, prefix + c_file) h_file = os.path.join(output_dir, prefix + h_file)