diff --git a/changes/1669.misc.rst b/changes/1669.misc.rst new file mode 100644 index 000000000..35a7c7a89 --- /dev/null +++ b/changes/1669.misc.rst @@ -0,0 +1 @@ +Warnings regarding outdated Python versions will now be shown. diff --git a/src/briefcase/commands/base.py b/src/briefcase/commands/base.py index 160108308..91c258180 100644 --- a/src/briefcase/commands/base.py +++ b/src/briefcase/commands/base.py @@ -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 @@ -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) @@ -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 + if today.month > 10: + EOL_year += 1 + if python_version[0] < 3 or ( + 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.