validate_desktop_entry: handle emacs.desktop
authorZac Medico <zmedico@gentoo.org>
Sun, 2 Sep 2012 19:31:23 +0000 (12:31 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 2 Sep 2012 19:33:13 +0000 (12:33 -0700)
See <https://bugs.freedesktop.org/show_bug.cgi?id=35844#c6>.

pym/portage/util/_desktop_entry.py

index deb0a35e7d46f02852c1feb194c4857628b76142..bafac75d3214459694dad882c7b72b8013c63fd8 100644 (file)
@@ -52,6 +52,12 @@ _ignore_kde_types = frozenset(
 # sections in /usr/share/apps/akonadi/{plugins,accountwizard}
 _ignore_kde_sections = ("Currency Code", "Plugin", "Wizard")
 
+_ignored_errors = (
+               # Ignore error for emacs.desktop:
+               # https://bugs.freedesktop.org/show_bug.cgi?id=35844#c6
+               'error: (will be fatal in the future): value "TextEditor" in key "Categories" in group "Desktop Entry" requires another category to be present among the following categories: Utility',
+)
+
 def validate_desktop_entry(path):
        args = ["desktop-file-validate", path]
        if sys.hexversion < 0x3000000 or sys.hexversion >= 0x3020000:
@@ -99,6 +105,14 @@ def validate_desktop_entry(path):
                                if desktop_entry.has_section(section):
                                        del output_lines[:]
 
+       if output_lines:
+               filtered_output = []
+               for line in output_lines:
+                               if line[len(path)+2:] in _ignored_errors:
+                                       continue
+                               filtered_output.append(line)
+               output_lines = filtered_output
+
        if output_lines:
                output_lines = [line for line in output_lines
                        if _trivial_warnings.search(line) is None]