~ubuntu-branches/ubuntu/utopic/apt-xapian-index/utopic

« back to all changes in this revision

Viewing changes to plugins/app-install.py

  • Committer: Package Import Robot
  • Author(s): Michael Vogt
  • Date: 2014-06-03 21:29:13 UTC
  • mfrom: (15.1.6 sid)
  • Revision ID: package-import@ubuntu.com-20140603212913-bn64z737sz34w4p6
Tags: 0.46ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - prefer native packages over foreign packages 
  - do not crash if the DB is already locked (LP: #590998)
  - do not modify the DB "in-place" with --update
  - debian/patches/01_axi_cjk_support.patch:
    - Activate the CJK support when indexing the database
  - debian/patches/02_axi-pkgname-mangled-term.patch:
    - add XPM term that contains a mangled version of the pkgname
  - debian/patches/03_policykit_translations.patch: 
    - remove underscores from description
  - debian/patches/CVE-2013-1064.patch:
    + pass system-bus-name as a subject
  - debian/postinst:
    - do not build the DB in the postinst
  - debian/rules:
    - quilt with dh --with python2
  - plugins/app-install.py:
    - ignore file not found errors due to a race condition (LP: #752195)
* Drop:
  - debian/patches/04_catch_invalid_desktop_file.patch: no longer needed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
try:
2
2
    from xdg.DesktopEntry import DesktopEntry
 
3
    from xdg.Exceptions import ParsingError
3
4
    from xdg import Locale
4
5
    HAS_XDG=True
5
6
except ImportError, e:
19
20
            lang = "en"
20
21
        self.lang = lang
21
22
        self.xlang = lang.split("_")[0]
22
 
        self.xdglangs = Locale.expand_languages(lang)
 
23
        self.xdglangs = Locale.expand_languages([lang])
23
24
        self.indexer = xapian.TermGenerator()
24
25
        # Get a stemmer for this language, if available
25
26
        try:
72
73
        Return general information about the plugin.
73
74
 
74
75
        The information returned is a dict with various keywords:
75
 
         
 
76
 
76
77
         timestamp (required)
77
78
           the last modified timestamp of this data source.  This will be used
78
79
           to see if we need to update the database or not.  A timestamp of 0
142
143
        progress.begin("Reading .desktop files from %s" % APPINSTALLDIR)
143
144
        for f in os.listdir(APPINSTALLDIR):
144
145
            if f[0] == '.' or not f.endswith(".desktop"): continue
145
 
            entry = DesktopEntry(os.path.join(APPINSTALLDIR, f))
 
146
            try:
 
147
                entry = DesktopEntry(os.path.join(APPINSTALLDIR, f))
 
148
            except (ValueError, ParsingError, UnicodeDecodeError):
 
149
                # Invalid .desktop files can cause a ValueError. From PyXDG 0.25,
 
150
                # that case will be turned into a ParsingError.
 
151
                continue
146
152
            pkg = entry.get("X-AppInstall-Package")
147
153
            self.entries.setdefault(pkg, []).append((f, entry))
148
154
        progress.end()