Change if old scandir binary module is installed, inform user to upgrade it.

This commit is contained in:
JackDandy 2018-09-08 17:50:30 +01:00
parent cec00f41fc
commit 53e0ee379e
5 changed files with 31 additions and 6 deletions

View file

@ -8,7 +8,9 @@
* Update profilehooks module 1.10.0 (0ce1e29) to 1.10.1 (fdbf19d) * Update profilehooks module 1.10.0 (0ce1e29) to 1.10.1 (fdbf19d)
* Update PySocks 1.6.8 (524ceb4) to 1.6.8 (b687a34) * Update PySocks 1.6.8 (524ceb4) to 1.6.8 (b687a34)
* Update Requests library 2.15.1 (282b01a) to 2.19.1 (33b41c7) * Update Requests library 2.15.1 (282b01a) to 2.19.1 (33b41c7)
* Update scandir module 1.6 (c3592ee) to 1.9.0 (9ab3d1f)
* Add urllib3 release 1.23 (7c216f4) * Add urllib3 release 1.23 (7c216f4)
* Change if old scandir binary module is installed, fallback to slow Python module and inform user to upgrade binary
[develop changelog] [develop changelog]

View file

@ -10,6 +10,7 @@ Libs with customisations...
/lib/hachoir_parser/guess.py /lib/hachoir_parser/guess.py
/lib/hachoir_parser/misc/torrent.py /lib/hachoir_parser/misc/torrent.py
/lib/lockfile/mkdirlockfile.py /lib/lockfile/mkdirlockfile.py
/lib/scandir/scandir.py
/lib/tmdb_api/tmdb_api.py /lib/tmdb_api/tmdb_api.py
/lib/tornado /lib/tornado
/lib/tvdb_api/tvdb_api.py /lib/tvdb_api/tvdb_api.py

View file

@ -265,6 +265,11 @@
<span>$sg_str('NEWEST_VERSION_STRING')</span> <span>$sg_str('NEWEST_VERSION_STRING')</span>
</div> </div>
#end if #end if
#if $sg_str('MODULE_UPDATE_STRING')
<div class="alert alert-success upgrade-notification" role="alert">
<span>$sg_str('MODULE_UPDATE_STRING')</span>
</div>
#end if
## ##
#set $items = [] #set $items = []
#try #try

View file

@ -35,15 +35,14 @@ try:
except ImportError: except ImportError:
ctypes = None ctypes = None
if not getattr(_scandir, 'DirEntry', None):
if None is not _scandir and None is not ctypes and not getattr(_scandir, 'DirEntry', None):
import warnings import warnings
warnings.warn("scandir compiled _scandir C module is too old" warnings.warn("scandir compiled _scandir C module is too old, using slow generic fallback")
", using slow generic fallback")
_scandir = None _scandir = None
elif _scandir is None and ctypes is None: elif _scandir is None and ctypes is None:
import warnings import warnings
warnings.warn("scandir can't find the compiled _scandir C module " warnings.warn("scandir can't find the compiled _scandir C module or ctypes, using slow generic fallback")
"or ctypes, using slow generic fallback")
__version__ = '1.9.0' __version__ = '1.9.0'
__all__ = ['scandir', 'walk'] __all__ = ['scandir', 'walk']

View file

@ -108,6 +108,7 @@ newznabProviderList = []
torrentRssProviderList = [] torrentRssProviderList = []
metadata_provider_dict = {} metadata_provider_dict = {}
MODULE_UPDATE_STRING = None
NEWEST_VERSION_STRING = None NEWEST_VERSION_STRING = None
VERSION_NOTIFY = False VERSION_NOTIFY = False
AUTO_UPDATE = False AUTO_UPDATE = False
@ -572,7 +573,7 @@ def initialize(console_logging=True):
global __INITIALIZED__, showList, providerList, newznabProviderList, torrentRssProviderList, \ global __INITIALIZED__, showList, providerList, newznabProviderList, torrentRssProviderList, \
WEB_HOST, WEB_ROOT, ACTUAL_CACHE_DIR, CACHE_DIR, ZONEINFO_DIR, ADD_SHOWS_WO_DIR, CREATE_MISSING_SHOW_DIRS, \ WEB_HOST, WEB_ROOT, ACTUAL_CACHE_DIR, CACHE_DIR, ZONEINFO_DIR, ADD_SHOWS_WO_DIR, CREATE_MISSING_SHOW_DIRS, \
RECENTSEARCH_STARTUP, NAMING_FORCE_FOLDERS, SOCKET_TIMEOUT, DEBUG, INDEXER_DEFAULT, CONFIG_FILE, \ RECENTSEARCH_STARTUP, NAMING_FORCE_FOLDERS, SOCKET_TIMEOUT, DEBUG, INDEXER_DEFAULT, CONFIG_FILE, \
REMOVE_FILENAME_CHARS, IMPORT_DEFAULT_CHECKED_SHOWS, WANTEDLIST_CACHE REMOVE_FILENAME_CHARS, IMPORT_DEFAULT_CHECKED_SHOWS, WANTEDLIST_CACHE, MODULE_UPDATE_STRING
# Schedulers # Schedulers
# global traktCheckerScheduler # global traktCheckerScheduler
global recentSearchScheduler, backlogSearchScheduler, showUpdateScheduler, \ global recentSearchScheduler, backlogSearchScheduler, showUpdateScheduler, \
@ -1460,6 +1461,23 @@ def initialize(console_logging=True):
run_delay=datetime.timedelta(minutes=5), run_delay=datetime.timedelta(minutes=5),
threadName='PLEXWATCHEDSTATE') threadName='PLEXWATCHEDSTATE')
try:
import _scandir
except ImportError:
_scandir = None
try:
import ctypes
except ImportError:
ctypes = None
if None is not _scandir and None is not ctypes and not getattr(_scandir, 'DirEntry', None):
MODULE_UPDATE_STRING = \
'Your scandir binary module is outdated, using the slow but newer Python module.' \
'<br>Upgrade the binary at a command prompt with' \
' # <span class="boldest">python -m pip install -U scandir</span>' \
'<br>Important: You <span class="boldest">must</span> Shutdown SickGear before upgrading'
__INITIALIZED__ = True __INITIALIZED__ = True
return True return True