Refine dead actute meta-warning

This commit is contained in:
Florian Bruhin 2014-06-02 23:07:46 +02:00
parent b415773cc7
commit 8aff446a30

View File

@ -30,8 +30,9 @@ import os.path
import urllib.request import urllib.request
from urllib.parse import urljoin, urlencode from urllib.parse import urljoin, urlencode
from functools import reduce from functools import reduce
from distutils.version import StrictVersion as Version
from PyQt5.QtCore import QCoreApplication, QStandardPaths from PyQt5.QtCore import QCoreApplication, QStandardPaths, qVersion
from pkg_resources import resource_string from pkg_resources import resource_string
import qutebrowser import qutebrowser
@ -237,9 +238,18 @@ def get_standard_dir(typ):
def actute_warning(): def actute_warning():
"""Display a warning about the dead_actute issue if needed.""" """Display a warning about the dead_actute issue if needed."""
if not (sys.platform.startswith('linux') and # Non linux OS' aren't affected
os.path.exists('/usr/share/X11/locale/en_US.UTF-8/Compose')): if not sys.platform.startswith('linux'):
return return
# If no compose file exists for some reason, we're not affected
if not os.path.exists('/usr/share/X11/locale/en_US.UTF-8/Compose'):
return
# Qt >= 5.3 doesn't seem to be affected
try:
if Version(qVersion()) >= Version('5.3.0'):
return
except ValueError:
pass
with open('/usr/share/X11/locale/en_US.UTF-8/Compose', 'r') as f: with open('/usr/share/X11/locale/en_US.UTF-8/Compose', 'r') as f:
for line in f: for line in f:
if '<dead_actute>' in line: if '<dead_actute>' in line: