mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 21:03:14 -07:00
Fix cleanup script output
This commit is contained in:
parent
7185e0b31b
commit
844c1d15e9
1 changed files with 8 additions and 3 deletions
11
cleanup.py
11
cleanup.py
|
@ -151,6 +151,11 @@ def force_clean_folder(path, required):
|
||||||
|
|
||||||
def clean(paths):
|
def clean(paths):
|
||||||
"""Clean up bytecode and obsolete folders."""
|
"""Clean up bytecode and obsolete folders."""
|
||||||
|
def _report_error(msg):
|
||||||
|
print('WARNING: Automatic cleanup could not be executed.')
|
||||||
|
print(' If errors occur, manual cleanup may be required.')
|
||||||
|
print('REASON : {}'.format(msg))
|
||||||
|
|
||||||
with WorkingDirectory(module_path()) as cwd:
|
with WorkingDirectory(module_path()) as cwd:
|
||||||
if cwd.working_directory != cwd.original_directory:
|
if cwd.working_directory != cwd.original_directory:
|
||||||
print('Changing to directory:', cwd.working_directory)
|
print('Changing to directory:', cwd.working_directory)
|
||||||
|
@ -159,7 +164,7 @@ def clean(paths):
|
||||||
try:
|
try:
|
||||||
result = clean_bytecode()
|
result = clean_bytecode()
|
||||||
except SystemExit as error:
|
except SystemExit as error:
|
||||||
print(error)
|
_report_error(error)
|
||||||
else:
|
else:
|
||||||
print(result or 'No bytecode to clean')
|
print(result or 'No bytecode to clean')
|
||||||
|
|
||||||
|
@ -168,7 +173,7 @@ def clean(paths):
|
||||||
try:
|
try:
|
||||||
result = clean_folders(*paths)
|
result = clean_folders(*paths)
|
||||||
except SystemExit as error:
|
except SystemExit as error:
|
||||||
print(error)
|
_report_error(error)
|
||||||
else:
|
else:
|
||||||
print(result or 'No folders to clean\n')
|
print(result or 'No folders to clean\n')
|
||||||
else:
|
else:
|
||||||
|
@ -176,7 +181,7 @@ def clean(paths):
|
||||||
try:
|
try:
|
||||||
items = paths.items()
|
items = paths.items()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
print('Failed to clean, no subfolder structure given')
|
_report_error('Failed to clean, no subfolder structure given')
|
||||||
else:
|
else:
|
||||||
for folder, subfolders in items:
|
for folder, subfolders in items:
|
||||||
print('\nForce cleaning folder:', folder)
|
print('\nForce cleaning folder:', folder)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue