Skip update check for system-wide (AUR) installs
Co-authored-by: wheaney <42350981+wheaney@users.noreply.github.com>
This commit is contained in:
parent
1a729ac98f
commit
35c552ef6d
|
|
@ -595,6 +595,14 @@ void BreezyDesktopEffectConfig::checkEffectLoaded() {
|
||||||
|
|
||||||
void BreezyDesktopEffectConfig::checkForUpdates() {
|
void BreezyDesktopEffectConfig::checkForUpdates() {
|
||||||
#ifdef BREEZY_DESKTOP_VERSION_STR
|
#ifdef BREEZY_DESKTOP_VERSION_STR
|
||||||
|
// Skip update check for system-wide installs (e.g. AUR) — the package
|
||||||
|
// manager handles updates there. Scripted installs put the plugin under
|
||||||
|
// the user's home directory, so we use that as the heuristic.
|
||||||
|
const QString pluginPath = metaData().fileName();
|
||||||
|
const QString home = QDir::homePath();
|
||||||
|
if (!pluginPath.startsWith(home + QLatin1Char('/')))
|
||||||
|
return;
|
||||||
|
|
||||||
if (!m_networkManager)
|
if (!m_networkManager)
|
||||||
m_networkManager = new QNetworkAccessManager(this);
|
m_networkManager = new QNetworkAccessManager(this);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
import threading
|
import threading
|
||||||
from urllib.request import urlopen, Request
|
from urllib.request import urlopen, Request
|
||||||
from urllib.error import URLError
|
from urllib.error import URLError
|
||||||
|
|
@ -28,6 +30,19 @@ logger = logging.getLogger('breezy_ui')
|
||||||
GITHUB_RELEASES_URL = 'https://api.github.com/repos/wheaney/breezy-desktop/releases/latest'
|
GITHUB_RELEASES_URL = 'https://api.github.com/repos/wheaney/breezy-desktop/releases/latest'
|
||||||
|
|
||||||
|
|
||||||
|
def _is_user_local_install():
|
||||||
|
"""Return True if the app is running from a user-local installation.
|
||||||
|
|
||||||
|
Scripted installs put the binary under the user's home directory (e.g.
|
||||||
|
~/.local/bin/breezydesktop). System-wide package manager installs (e.g.
|
||||||
|
AUR) put the binary in a system path like /usr/bin and don't need a
|
||||||
|
version-update prompt because the package manager handles updates.
|
||||||
|
"""
|
||||||
|
home = os.path.expanduser('~')
|
||||||
|
script_path = os.path.realpath(sys.argv[0])
|
||||||
|
return script_path.startswith(home + os.sep)
|
||||||
|
|
||||||
|
|
||||||
def _parse_version(version_str):
|
def _parse_version(version_str):
|
||||||
"""Parse a version string like '2.8.10' or 'v2.8.9' into a tuple of ints."""
|
"""Parse a version string like '2.8.10' or 'v2.8.9' into a tuple of ints."""
|
||||||
v = version_str.strip().lstrip('v')
|
v = version_str.strip().lstrip('v')
|
||||||
|
|
@ -43,8 +58,12 @@ def check_for_update(current_version, callback):
|
||||||
|
|
||||||
Calls callback(latest_version_str) on the calling thread's GLib main loop
|
Calls callback(latest_version_str) on the calling thread's GLib main loop
|
||||||
if a newer version is found, or callback(None) if no update is available
|
if a newer version is found, or callback(None) if no update is available
|
||||||
or if the check fails.
|
or if the check fails. Does nothing (no callback) when not running from a
|
||||||
|
user-local installation (e.g. installed via AUR).
|
||||||
"""
|
"""
|
||||||
|
if not _is_user_local_install():
|
||||||
|
return
|
||||||
|
|
||||||
def _check():
|
def _check():
|
||||||
latest_version = None
|
latest_version = None
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue