From d250e45c7b4347d58f16dea2ee6f7b0401e3b34d Mon Sep 17 00:00:00 2001 From: Labrys of Knossos Date: Sat, 5 Jan 2019 21:26:56 -0500 Subject: [PATCH 1/2] Hotfix cleaning for source installs --- cleanup.py | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/cleanup.py b/cleanup.py index 213aca99..8c2d54d2 100644 --- a/cleanup.py +++ b/cleanup.py @@ -5,6 +5,20 @@ from __future__ import print_function import os import subprocess import sys +import shutil + +FOLDER_STRUCTURE = { + 'libs': [ + 'common', + 'custom', + 'py2', + 'win', + ], + 'core': [ + 'auto_process', + 'extractor', + ], +} class WorkingDirectory(object): @@ -106,7 +120,22 @@ def clean_folders(*paths): return result -def clean(*paths): +def force_clean_folder(path, required): + root, dirs, files = next(os.walk(path)) + required = sorted(required) + if required: + print('Skipping required subfolders', required) + remove = sorted(set(dirs).difference(required)) + missing = sorted(set(required).difference(dirs)) + for path in remove: + pathname = os.path.join(root, path) + print('Removing', pathname) + shutil.rmtree(pathname) + if missing: + raise Exception('Required subfolders missing:', missing) + + +def clean(paths): """Clean up bytecode and obsolete folders.""" with WorkingDirectory(module_path()) as cwd: if cwd.working_directory != cwd.original_directory: @@ -121,7 +150,7 @@ def clean(*paths): print(result or 'No bytecode to clean') if paths and os.path.exists('.git'): - print('\n-- Cleaning folders: {} --'.format(paths)) + print('\n-- Cleaning folders: {} --'.format(list(paths))) try: result = clean_folders(*paths) except SystemExit as error: @@ -129,7 +158,15 @@ def clean(*paths): else: print(result or 'No folders to clean\n') else: - print('Directory is not a git repository') + print('\nDirectory is not a git repository') + try: + items = paths.items() + except AttributeError: + print('Failed to clean, no subfolder structure given') + else: + for folder, subfolders in items: + print('\nForce cleaning folder:', folder) + force_clean_folder(folder, subfolders) if cwd.working_directory != cwd.original_directory: print('Returning to directory: ', cwd.original_directory) @@ -138,4 +175,4 @@ def clean(*paths): if __name__ == '__main__': - clean('libs', 'core') + clean(FOLDER_STRUCTURE) From 6616801c382f9c1f5cce0daba9d29966f7830d34 Mon Sep 17 00:00:00 2001 From: Labrys of Knossos Date: Sat, 5 Jan 2019 21:27:14 -0500 Subject: [PATCH 2/2] =?UTF-8?q?Bump=20version:=2012.0.2=20=E2=86=92=2012.0?= =?UTF-8?q?.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- README.md | 2 +- core/__init__.py | 2 +- setup.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index e5b82b40..e11b54a8 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 12.0.2 +current_version = 12.0.3 commit = True tag = False diff --git a/README.md b/README.md index db6b38a4..67f6c02e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -nzbToMedia v12.0.2 +nzbToMedia v12.0.3 ================== Provides an [efficient](https://github.com/clinton-hall/nzbToMedia/wiki/Efficient-on-demand-post-processing) way to handle postprocessing for [CouchPotatoServer](https://couchpota.to/ "CouchPotatoServer") and [SickBeard](http://sickbeard.com/ "SickBeard") (and its [forks](https://github.com/clinton-hall/nzbToMedia/wiki/Failed-Download-Handling-%28FDH%29#sick-beard-and-its-forks)) diff --git a/core/__init__.py b/core/__init__.py index 39611d06..9fa7c320 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -52,7 +52,7 @@ from core.utils import ( resume_torrent, remove_dir, remove_read_only, sanitize_name, update_download_info_status, ) -__version__ = '12.0.2' +__version__ = '12.0.3' # Client Agents NZB_CLIENTS = ['sabnzbd', 'nzbget', 'manual'] diff --git a/setup.py b/setup.py index 1307c1f4..ccd9786c 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ def read(*names, **kwargs): setup( name='nzbToMedia', - version='12.0.2', + version='12.0.3', license='GPLv3', description='Efficient on demand post processing', long_description="""