Skip to content

Commit a16d498

Browse files
authored
Upgrade: download new release binary only in frozen mode (#266)
2 parents 352c5ef + dbd4c45 commit a16d498

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

qgis_deployment_toolbelt/commands/upgrade.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import argparse
1515
import json
1616
import logging
17+
import sys
1718
from os import getenv
1819
from pathlib import Path
1920
from sys import platform as opersys
@@ -25,6 +26,7 @@
2526

2627
# submodules
2728
from qgis_deployment_toolbelt.__about__ import (
29+
__package_name__,
2830
__title__,
2931
__title_clean__,
3032
__uri_repository__,
@@ -61,7 +63,7 @@ def get_download_url_for_os(
6163
to get a download URL for a specific OS. Defaults to None.
6264
6365
Returns:
64-
tuple[str, str]: tuple containgin asset download URL (browser_download_url) and
66+
tuple[str, str]: tuple containing asset download URL (browser_download_url) and
6567
content-type (barely defined)
6668
"""
6769
opersys_code = opersys
@@ -232,6 +234,15 @@ def run(args: argparse.Namespace):
232234
)
233235

234236
# -- DOWNLOAD ------------------------------------------------------------
237+
# check if we are in frozen mode (typically PyInstaller) or as "normal" Python
238+
if not (getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS")):
239+
logger.debug("Running in a normal Python process.")
240+
print(
241+
"\n\nTo get the latest version, run (adapt command to your environment):"
242+
f"\n\npython -m pip install -U {__package_name__}"
243+
)
244+
sys.exit(0)
245+
235246
print(f"Downloading newer version of executable for {opersys}: {latest_version}")
236247

237248
# select remote download URL

0 commit comments

Comments
 (0)