Fix #1950206 [Calibre missing private copy of kdialog on Fedora 35](https://bugs.launchpad.net/calibre/+bug/1950206)

This commit is contained in:
Kovid Goyal 2021-11-09 07:23:52 +05:30
parent 4d4f55a95d
commit 18dcc8734c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -122,9 +122,11 @@ def run(cmd):
def kdialog_supports_desktopfile():
ans = getattr(kdialog_supports_desktopfile, 'ans', None)
if ans is None:
from calibre.gui2 import sanitize_env_vars
try:
raw = subprocess.check_output(['kdialog', '--help'])
except OSError:
with sanitize_env_vars():
raw = subprocess.check_output(['kdialog', '--help'])
except (subprocess.CalledProcessError, FileNotFoundError, OSError):
raw = b'--desktopfile'
ans = kdialog_supports_desktopfile.ans = b'--desktopfile' in raw
return ans