mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 21:33:13 -07:00
parent
c5dad74763
commit
b7081da7fa
1 changed files with 12 additions and 3 deletions
15
cleanup.py
15
cleanup.py
|
@ -106,9 +106,7 @@ def clean_folders(*paths):
|
||||||
|
|
||||||
def clean(*paths):
|
def clean(*paths):
|
||||||
"""Clean up bytecode and obsolete folders."""
|
"""Clean up bytecode and obsolete folders."""
|
||||||
with WorkingDirectory(module_path()) as cwd:
|
def _clean(*paths):
|
||||||
if cwd.working_directory != cwd.original_directory:
|
|
||||||
print('Changing to directory:', cwd.working_directory)
|
|
||||||
print('\n-- Cleaning bytecode --')
|
print('\n-- Cleaning bytecode --')
|
||||||
try:
|
try:
|
||||||
result = clean_bytecode()
|
result = clean_bytecode()
|
||||||
|
@ -124,8 +122,19 @@ def clean(*paths):
|
||||||
print(error)
|
print(error)
|
||||||
else:
|
else:
|
||||||
print(result or 'No folders to clean\n')
|
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')
|
||||||
|
|
||||||
if cwd.working_directory != cwd.original_directory:
|
if cwd.working_directory != cwd.original_directory:
|
||||||
print('Returning to directory: ', cwd.original_directory)
|
print('Returning to directory: ', cwd.original_directory)
|
||||||
|
|
||||||
print('\n-- Cleanup finished --\n')
|
print('\n-- Cleanup finished --\n')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue