Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add eol python warnings #1822

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/1669.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Warnings regarding outdated Python versions will now be shown.
17 changes: 16 additions & 1 deletion src/briefcase/commands/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import sys
from abc import ABC, abstractmethod
from argparse import RawDescriptionHelpFormatter
from datetime import date
from pathlib import Path
from typing import Any

Expand Down Expand Up @@ -178,12 +179,12 @@ def __init__(
self.data_path = self.validate_data_path(data_path)
self.apps = {} if apps is None else apps
self.is_clone = is_clone

self.tools = tools or ToolCache(
logger=logger,
console=console,
base_path=self.data_path / "tools",
)
self.validate_python_version()

# Immediately add tools that must be always available
Subprocess.verify(tools=self.tools)
Expand Down Expand Up @@ -305,6 +306,20 @@ def validate_locale(self):
"""
)

def validate_python_version(self):
"""Validate the system's python version is not past its EOL date."""
python_version = sys.version_info
today = date.today()
EOL_year = today.year - 2024 # increment this each year past 10-2024
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A short description of the math being used here would be helpful - why is 2024 important? Should this number be updated every year? Also, in any description, it's more helpful to say "October" than "10" because it's clear we're referring to a month.

if today.month > 10:
EOL_year += 1
if python_version[0] < 3 or (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version < 3 can't ever happen; Briefcase can't be installed on Python 2.

python_version[0] == 3 and python_version[1] < 8 + EOL_year
):
self.logger.warning(
f"WARNING: Python version is past its EOL date. Update Python to at least Python 3.{EOL_year+8}."
)

def _command_factory(self, command_name: str):
"""Command factory for the current platform and format.

Expand Down
Loading