From 73f1b19a7c1bbfd5990f51492db260b9c8f82e0f Mon Sep 17 00:00:00 2001 From: Lizband Date: Tue, 25 Dec 2018 19:31:36 -0500 Subject: [PATCH] Hotfix: not a git repository --- cleanup.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/cleanup.py b/cleanup.py index be13558d..54db13f0 100644 --- a/cleanup.py +++ b/cleanup.py @@ -50,8 +50,9 @@ def clean_bytecode(): '!**/__pycache__/', # and __pycache__ folders ], ) + print(result) except subprocess.CalledProcessError as error: - sys.exit(error.returncode) + sys.exit('Error Code: {}'.format(error.returncode)) else: return result @@ -66,7 +67,7 @@ def clean_folders(*paths): paths=paths, ) except subprocess.CalledProcessError as error: - sys.exit(error.returncode) + sys.exit('Error Code: {}'.format(error.returncode)) else: return result @@ -74,12 +75,20 @@ def clean_folders(*paths): def clean(*paths): """Clean up bytecode and obsolete folders.""" print('-- Cleaning bytecode --') - result = clean_bytecode() - print(result or 'No bytecode to clean\n') + try: + result = clean_bytecode() + except SystemExit as error: + print(error) + else: + print(result or 'No bytecode to clean\n') if paths: print('-- Cleaning folders: {} --'.format(paths)) - result = clean_folders(*paths) - print(result or 'No folders to clean\n') + try: + result = clean_folders(*paths) + except SystemExit as error: + print(error) + else: + print(result or 'No folders to clean\n') if __name__ == '__main__':