From c7019c31899d535f6f8dce3d7cf270cd57c951f3 Mon Sep 17 00:00:00 2001 From: kaleJohn <49548239+kaleJohn@users.noreply.github.com> Date: Mon, 20 May 2024 16:19:47 -0400 Subject: [PATCH 1/3] Adding warnings about Python versions past EOL date. --- src/briefcase/commands/base.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/briefcase/commands/base.py b/src/briefcase/commands/base.py index 160108308..983cdf672 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) @@ -1038,3 +1039,17 @@ def generate_template( output_path=output_path, extra_context=extra_context, ) + + def validate_python_version(self): + """Log a warning if the python version in use is past the 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}." + ) From 940e766b895b320b07a49884fda70ea4fe4f764a Mon Sep 17 00:00:00 2001 From: kaleJohn <49548239+kaleJohn@users.noreply.github.com> Date: Mon, 20 May 2024 16:27:37 -0400 Subject: [PATCH 2/3] Adding the changes file for the Python EOL warning. --- changes/1669.misc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/1669.misc.rst 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. From 36f3fa82bbb5fe78b1f8628d01c3ae1804ce6774 Mon Sep 17 00:00:00 2001 From: kaleJohn <49548239+kaleJohn@users.noreply.github.com> Date: Tue, 21 May 2024 10:05:32 -0400 Subject: [PATCH 3/3] moved the function to be grouped with other validation functions and reworded doc string --- src/briefcase/commands/base.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/briefcase/commands/base.py b/src/briefcase/commands/base.py index 983cdf672..91c258180 100644 --- a/src/briefcase/commands/base.py +++ b/src/briefcase/commands/base.py @@ -306,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. @@ -1039,17 +1053,3 @@ def generate_template( output_path=output_path, extra_context=extra_context, ) - - def validate_python_version(self): - """Log a warning if the python version in use is past the 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}." - )