Your IP : 172.28.240.42


Current Path : /usr/share/apt-xapian-index/plugins/
Upload File :
Current File : //usr/share/apt-xapian-index/plugins/app-install.pyc


b3Rc@sy*ddlmZddlmZeZWnek
rEZeZnXddl	Z
ddlZddlZddl
ZdZdd
dYZdefdYZddd	ZdS(i(tDesktopEntry(tLocaleNs/usr/share/app-install/desktop/tIndexercBseZddZdZRS(cCs||_||_|dkr'd}n||_|jdd|_tj||_t	j
|_y,t	j|j|_
|jj|j
Wnt	jk
rnXdS(Ntent_i(t
val_popcontprogresstNonetlangtsplittxlangRtexpand_languagestxdglangstxapiant
TermGeneratortindexertStemtstemmertset_stemmertInvalidArgumentError(tselfRRR((s2/usr/share/apt-xapian-index/plugins/app-install.pyt__init__s				cCsQ|jd|jd||jj|tj}zR|jt_|jj|j|jj|j|jj|j	Wd|t_Xx%|j
D]}|jd|qWyt|jd}WnEt
k
r}|jr|jjd|t|fnd}nX|jdkrM|j|jtj|ndS(NtXDtXDFtXDTsX-AppInstall-Popcons#%s: parsing X-AppInstall-Popcon: %si(tadd_termRtset_documentRtlangsRtindex_text_without_positionstgetNametgetGenericNamet
getCommentt
getCategoriestinttgett
ValueErrorRtverbosetstrRt	add_valueR
tsortable_serialise(Rtdocumenttfnametentrytoldlangstcattpopconte((s2/usr/share/apt-xapian-index/plugins/app-install.pytindexs(
	
	#
N(t__name__t
__module__RRR/(((s2/usr/share/apt-xapian-index/plugins/app-install.pyRst
AppInstallcBsJeZdZdZdZddZdZdZdZ	RS(cCs||_||_dS(N(RR(RRR((s2/usr/share/apt-xapian-index/plugins/app-install.pyRBs	cCsgd}xtjtD]z}|ddks|jdrBqny:tjjtjjt|}||kr{|}nWqtk
rqXqWtd|dtdddd	gd
tdtddgd
tddddddddddtddddddddddtddddddddddtddddddddddgS( s
        Return general information about the plugin.

        The information returned is a dict with various keywords:
         
         timestamp (required)
           the last modified timestamp of this data source.  This will be used
           to see if we need to update the database or not.  A timestamp of 0
           means that this data source is either missing or always up to date.
         values (optional)
           an array of dicts { name: name, desc: description }, one for every
           numeric value indexed by this data source.

        Note that this method can be called before init.  The idea is that, if
        the timestamp shows that this plugin is currently not needed, then the
        long initialisation can just be skipped.
        it.s.desktopt	timestamptvaluestnames
app-popcontdescs app-install .desktop popcon ranktsourcestpaths+.desktop files provided by app-install-datatprefixestidxRtqpttypes;Marker to indicate that the package contains .desktop filestldescsiOnly 'XD' can present in the index. This is used to efficiently filter packages that have a .desktop fileRsFile name of the .desktop filesZThis is the name of a .desktop file contained in the package. There could be more than oneRtboolsCategories from .desktop filessPThis is similar to a tag, but filled with the categories found in .desktop filestZsStemmed forms of keywordssdThis contains the stemmed forms of keywords as generated by TermGenerator and matched by QueryParserN(
tostlistdirt
APPINSTALLDIRtendswithR9tgetmtimetjointOSErrortdictR(Rtmaxtstftts((s2/usr/share/apt-xapian-index/plugins/app-install.pytinfoFs4 !

cCs|d}|jdd|_gd	gt|jD]}t||j|^q6|_i|_|jdt	xt
jt	D]x}|ddks|jdrqnt
t
jjt	|}|jd}|jj|gj||fqW|jd	S(
s5
        If needed, perform long initialisation tasks here.

        info is a dictionary with useful information.  Currently it contains
        the following values:

          "values": a dict mapping index mnemonics to index numbers

        The progress indicator can be used to report progress.
        R5s
app-popconisReading .desktop files from %siR3s.desktopsX-AppInstall-PackageN(R"RRtlistRRtindexerstentriestbeginRCRARBRDRR9RFt
setdefaulttappendtend(RRLRR5RRJR*tpkg((s2/usr/share/apt-xapian-index/plugins/app-install.pytinit{s
;	 &cKsM|dk	rIx:|jD],}|jjtjj|jj|qWndS(s
        Receive extra parameters from the indexer.

        This may be called more than once, but after init().

        We are using this to get the database instance
        N(RRNRt	set_flagsR
Rt
FLAG_SPELLINGtset_database(Rtdbtkwti((s2/usr/share/apt-xapian-index/plugins/app-install.pytsend_extra_infoscCstddddddtS(s+
        Return documentation information for this data source.

        The documentation information is a dictionary with these keys:
          name: the name for this data source
          shortDesc: a short description
          fullDoc: the full description as a chapter in ReST format
        R6sapp-install informationt	shortDescsQterms, categories and popcon values extracted from the app-install .desktop filestfullDocs<
            The AppInstall data source reads .desktop files from %s
            and adds the following terms:

             * keywords from the .desktop descriptions, via Xapian's
               TermGenerator, in all requested locales;
             * .desktop categories, with prefix XDT;
             * name of .desktop file, with prefix XDF;
             * a single term "XD", marking that the package contains .desktop
               files.

            It also adds an "app-popcon" value with popcon ranks from the
            app-install .desktop files.
            (RHRC(R((s2/usr/share/apt-xapian-index/plugins/app-install.pytdocs	cCsc|j}xP|jj|gD]9}|\}}x$|jD]}|j|||q>Wq"WdS(s
        Update the document with the information from this data source.

        document  is the document to update
        pkg       is the python-apt Package object for this package
        N(tget_dataROR"RNR/(RR(RTR6R.R)R*R[((s2/usr/share/apt-xapian-index/plugins/app-install.pyR/s
cCsc|j}xP|jj|gD]9}|\}}x$|jD]}|j|||q>Wq"WdS(s7
        Update the document with the information from this data source.

        This is alternative to index, and it is used when indexing with package
        data taken from a custom Packages file.

        document  is the document to update
        pkg       is the Deb822 object for this package
        N(R`ROR"RNR/(RR(RTR6R.R)R*R[((s2/usr/share/apt-xapian-index/plugins/app-install.pytindexDeb822s

N(
R0R1RRLRURR\R_R/Ra(((s2/usr/share/apt-xapian-index/plugins/app-install.pyR2As		5	
		
cKsItjjtsdSts6|r2|jdndStd|d|S(s.
    Create and return the plugin object.
    sEplease install python-xdg if you want to index app-install-data filesRRN(RAR9tisdirRCRtHAS_XDGR$R2(RRRZ((s2/usr/share/apt-xapian-index/plugins/app-install.pyRUs((txdg.DesktopEntryRtxdgRtTrueRctImportErrorR.tFalsetaxi.indexertaxiR
RAtos.pathRCRtobjectR2RRU(((s2/usr/share/apt-xapian-index/plugins/app-install.pyt<module>s

3