Skip to content

Commit

Permalink
Merge pull request #1480 from clinton-hall/hotfix/submodule
Browse files Browse the repository at this point in the history
Fix cleaning bytecode for nzbToMedia as submodule
  • Loading branch information
labrys authored Dec 29, 2018
2 parents 0f495a2 + cc06cb8 commit 7244f87
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 7244f87

Please sign in to comment.