Daniel Brötzmann pushed to branch ms-store-no-update at gajim / gajim
Commits:
d1e1b3c6 by wurstsalat at 2024-06-30T16:05:11+02:00
imprv: Don't check for updates if running from MS Store
Fixes #11881
- - - - -
6 changed files:
- gajim/__init__.py
- gajim/common/app.py
- gajim/common/application.py
- pyproject.toml
- win/_base.sh
- win/dev_env.sh
Changes:
=====================================
gajim/__init__.py
=====================================
@@ -7,3 +7,15 @@
portable_path = Path(sys.executable).parent / 'is_portable'
IS_PORTABLE = portable_path.exists()
+
+# Check for Microsoft app identity by trying to query AppInfo.
+# If there is no AppInfo, it's no MS Store install.
+has_ms_appinfo = False
+try:
+ from winrt.windows.applicationmodel import AppInfo
+ _current_appinfo = AppInfo.current() # type: ignore
+ has_ms_appinfo = True
+except (ImportError, OSError):
+ pass
+
+IS_MS_STORE = has_ms_appinfo
=====================================
gajim/common/app.py
=====================================
@@ -155,6 +155,10 @@ def is_portable() -> bool:
return gajim.IS_PORTABLE
+def is_ms_store() -> bool:
+ return gajim.IS_MS_STORE
+
+
def is_display(display: Display) -> bool:
# XWayland reports as Display X11, so try with env var
is_wayland = os.environ.get('XDG_SESSION_TYPE') == 'wayland'
=====================================
gajim/common/application.py
=====================================
@@ -296,6 +296,10 @@ def _check_for_updates(self) -> None:
if not app.settings.get('check_for_update'):
return
+ if sys.platform == 'win32' and app.is_ms_store():
+ # Gajim updates are handled by MS Store directly
+ return
+
now = datetime.now()
last_check = app.settings.get('last_update_check')
if not last_check:
=====================================
pyproject.toml
=====================================
@@ -38,6 +38,7 @@ dependencies = [
"PyGObject>=3.42.0",
"qrcode>=7.3.1",
"SQLAlchemy>=2.0.0",
+ "winrt-Windows.ApplicationModel; platform_system == 'Windows'",
"winrt-Windows.Foundation; platform_system == 'Windows'",
"winrt-Windows.UI; platform_system == 'Windows'",
"winrt-Windows.UI.ViewManagement; platform_system == 'Windows'",
@@ -99,6 +100,7 @@ exclude = [
".git",
".venv",
"build",
+ "gajim/__init__.py",
"gajim/common/app.py",
"gajim/common/client.py",
"gajim/common/config.py",
=====================================
win/_base.sh
=====================================
@@ -109,6 +109,7 @@ qrcode
css_parser
sentry-sdk
emoji
+winrt-Windows.ApplicationModel
winrt-Windows.Foundation
winrt-Windows.UI
winrt-Windows.UI.ViewManagement
=====================================
win/dev_env.sh
=====================================
@@ -51,6 +51,7 @@ qrcode
css_parser
sentry-sdk
emoji
+winrt-Windows.ApplicationModel
winrt-Windows.Foundation
winrt-Windows.UI
winrt-Windows.UI.ViewManagement
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/d1e1b3c6af9ccbbe9a0e7e412b570f45cbd950db
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/d1e1b3c6af9ccbbe9a0e7e412b570f45cbd950db
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]