Skip to content

Commit

Permalink
Fix cleaning bytecode for nzbToMedia as submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
labrys committed Dec 29, 2018
1 parent a490595 commit cc06cb8
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,29 +106,26 @@ def clean_folders(*paths):

def clean(*paths):
"""Clean up bytecode and obsolete folders."""
def _clean(*paths):
with WorkingDirectory(module_path()) as cwd:
if cwd.working_directory != cwd.original_directory:
print('Changing to directory:', cwd.working_directory)

print('\n-- Cleaning bytecode --')
try:
result = clean_bytecode()
except SystemExit as error:
print(error)
else:
print(result or 'No bytecode to clean')
if paths:

if paths and os.path.exists('.git'):
print('\n-- Cleaning folders: {} --'.format(paths))
try:
result = clean_folders(*paths)
except SystemExit as error:
print(error)
else:
print(result or 'No folders to clean\n')

with WorkingDirectory(module_path()) as cwd:
if cwd.working_directory != cwd.original_directory:
print('Changing to directory:', cwd.working_directory)

if os.path.exists('.git'):
_clean(*paths)
else:
print('Directory is not a git repository')

Expand Down

0 comments on commit cc06cb8

Please sign in to comment.