示例#1
0
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()
    if days_left > 0:
        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,
            ), )
    else:
        logger.info(
            'Python v{major}.{minor} reached end of life {x} days ago.'.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.')
示例#2
0
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.')