-
-
Notifications
You must be signed in to change notification settings - Fork 372
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
kaleJohn
wants to merge
3
commits into
beeware:main
Choose a base branch
from
kaleJohn:add-EOL-python-warnings
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add eol python warnings #1822
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Warnings regarding outdated Python versions will now be shown. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.