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

Notify users of new PyInstaller version #469

Merged
Show file tree
Hide file tree
Changes from 2 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
28 changes: 28 additions & 0 deletions auto_py_to_exe/utils.py
brentvollebregt marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import platform
import socket
import sys
import requests
from pathlib import Path

from PyInstaller import __version__ as pyinstaller_version_string
Expand Down Expand Up @@ -39,10 +40,37 @@ def open_output_in_explorer(output_directory, input_filename, is_one_file):
return False
return True

def check_latest_pyinstaller_version():
mcagriaksoy marked this conversation as resolved.
Show resolved Hide resolved
"""Check the latest version of PyInstaller"""
try:
response = requests.get("https://api.github.com/repos/pyinstaller/pyinstaller/releases/latest")
response.raise_for_status()
latest_version = response.json()["tag_name"]
if latest_version.startswith("v"):
latest_version = latest_version[1:]
return latest_version
mcagriaksoy marked this conversation as resolved.
Show resolved Hide resolved
except requests.exceptions.RequestException:
return None

def get_warnings():
warnings = []

# Check pyinstaller version is it latest
try:
latest_version = check_latest_pyinstaller_version()
mcagriaksoy marked this conversation as resolved.
Show resolved Hide resolved
if latest_version is None:
raise Exception("Unable to check for the latest version of PyInstaller.")
elif latest_version != pyinstaller_version_string:
message = "You are using an outdated version of PyInstaller."
message += f"\nLatest version: {latest_version}"
message += f"\nYour version: {pyinstaller_version_string}"
message += "\nPlease upgrade PyInstaller: python -m pip install pyinstaller --upgrade"
mcagriaksoy marked this conversation as resolved.
Show resolved Hide resolved
warnings.append({"message": message, "link": None})

except Exception as e:
message = f"\nError: {e}"
mcagriaksoy marked this conversation as resolved.
Show resolved Hide resolved
warnings.append({"message": message, "link": None})

try:
pyinstaller_version = parse_version_tuple(pyinstaller_version_string)
except ValueError:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Eel>=0.11.0
PyInstaller>=5.8.0
requests>=2.26.0
Loading