mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 13:23:18 -07:00
Add Python End-of-Life detection
This commit is contained in:
parent
de86259bb0
commit
f6e620a3fd
4 changed files with 211 additions and 0 deletions
|
@ -13,6 +13,7 @@ import time
|
|||
|
||||
import libs.autoload
|
||||
import libs.util
|
||||
import eol
|
||||
|
||||
if not libs.autoload.completed:
|
||||
sys.exit('Could not load vendored libraries.')
|
||||
|
@ -1085,6 +1086,28 @@ def configure_utility_locations():
|
|||
logger.warning('Install ffmpeg with x264 support to enable this feature ...')
|
||||
|
||||
|
||||
def check_python():
|
||||
"""Check End-of-Life status for Python version."""
|
||||
# Raise if end of life
|
||||
eol.check()
|
||||
|
||||
# Warn if within grace period
|
||||
grace_period = 365 # days
|
||||
eol.warn_for_status(grace_period=-grace_period)
|
||||
|
||||
# Log warning if within grace period
|
||||
days_left = eol.lifetime()
|
||||
logger.info(
|
||||
'Python v{major}.{minor} will reach end of life in {x} days.'.format(
|
||||
major=sys.version_info[0],
|
||||
minor=sys.version_info[1],
|
||||
x=days_left,
|
||||
)
|
||||
)
|
||||
if days_left <= grace_period:
|
||||
logger.warning('Please upgrade to a more recent Python version.')
|
||||
|
||||
|
||||
def initialize(section=None):
|
||||
global __INITIALIZED__
|
||||
|
||||
|
@ -1101,6 +1124,9 @@ def initialize(section=None):
|
|||
configure_migration()
|
||||
configure_logging_part_2()
|
||||
|
||||
# check python version
|
||||
check_python()
|
||||
|
||||
# initialize the main SB database
|
||||
main_db.upgrade_database(main_db.DBConnection(), databases.InitialSchema)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue