Skip to content

Commit

Permalink
Merge pull request #1452 from clinton-hall/hotfix/gitless
Browse files Browse the repository at this point in the history
Hotfix: not a git repository
  • Loading branch information
labrys committed Dec 26, 2018
2 parents 5907321 + 73f1b19 commit c428b57
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -66,20 +67,28 @@ 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


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__':
Expand Down

0 comments on commit c428b57

Please sign in to comment.