From 2cebe09924c9afea47bb1f2444ba1cd8fc423669 Mon Sep 17 00:00:00 2001 From: shin- Date: Tue, 13 Aug 2013 20:28:06 +0200 Subject: [PATCH] brew: Display a clear error message when the path is invalid --- contrib/brew/brew/brew.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/brew/brew/brew.py b/contrib/brew/brew/brew.py index e07fdfdbbb..22fe5b7b40 100644 --- a/contrib/brew/brew/brew.py +++ b/contrib/brew/brew/brew.py @@ -53,7 +53,13 @@ def build_library(repository=None, branch=None, namespace=None, push=False, logger.error('Source repository could not be fetched. Check ' 'that the address is correct and the branch exists.') return - for buildfile in os.listdir(os.path.join(dst_folder, 'library')): + try: + dirlist = os.listdir(os.path.join(dst_folder, 'library')) + except OSError as e: + logger.error('The path provided ({0}) could not be found or didn\'t' + 'contain a library/ folder.'.format(dst_folder)) + return + for buildfile in dirlist: if buildfile == 'MAINTAINERS': continue f = open(os.path.join(dst_folder, 'library', buildfile))