From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RG8pe-0007a4-SO for qemu-devel@nongnu.org; Tue, 18 Oct 2011 08:31:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RG8pY-0004Jh-4S for qemu-devel@nongnu.org; Tue, 18 Oct 2011 08:31:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27854) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RG8pX-0004JT-Qb for qemu-devel@nongnu.org; Tue, 18 Oct 2011 08:31:40 -0400 Date: Tue, 18 Oct 2011 10:31:33 -0200 From: Luiz Capitulino Message-ID: <20111018103133.0835d391@doriath> In-Reply-To: <0M4G3X-1Qz4UO2nGl-00rP32@mrelay.perfora.net> References: <1318865377-3328-1-git-send-email-lcapitulino@redhat.com> <1318865377-3328-4-git-send-email-lcapitulino@redhat.com> <0M4G3X-1Qz4UO2nGl-00rP32@mrelay.perfora.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/4] qapi-types.py: Fail gracefully if out dir is not specified List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Roth Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org On Mon, 17 Oct 2011 16:27:34 -0500 Michael Roth wrote: > On Mon, 17 Oct 2011 13:29:36 -0200, Luiz Capitulino wrote: > > 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) > > + > > We should probably just set output_dir to os.getcwd() here. Fair enough. > > > c_file = os.path.join(output_dir, prefix + c_file) > > h_file = os.path.join(output_dir, prefix + h_file) > > > > -- > > 1.7.7.rc3 > > >