mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 12:59:36 -07:00
Fix cleaning bytecode for nzbToMedia as submodule
This commit is contained in:
parent
a490595c5b
commit
cc06cb8548
1 changed files with 6 additions and 9 deletions
15
cleanup.py
15
cleanup.py
|
@ -106,7 +106,10 @@ def clean_folders(*paths):
|
||||||
|
|
||||||
def clean(*paths):
|
def clean(*paths):
|
||||||
"""Clean up bytecode and obsolete folders."""
|
"""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 --')
|
print('\n-- Cleaning bytecode --')
|
||||||
try:
|
try:
|
||||||
result = clean_bytecode()
|
result = clean_bytecode()
|
||||||
|
@ -114,7 +117,8 @@ def clean(*paths):
|
||||||
print(error)
|
print(error)
|
||||||
else:
|
else:
|
||||||
print(result or 'No bytecode to clean')
|
print(result or 'No bytecode to clean')
|
||||||
if paths:
|
|
||||||
|
if paths and os.path.exists('.git'):
|
||||||
print('\n-- Cleaning folders: {} --'.format(paths))
|
print('\n-- Cleaning folders: {} --'.format(paths))
|
||||||
try:
|
try:
|
||||||
result = clean_folders(*paths)
|
result = clean_folders(*paths)
|
||||||
|
@ -122,13 +126,6 @@ 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:
|
else:
|
||||||
print('Directory is not a git repository')
|
print('Directory is not a git repository')
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue