9
Return general information about the plugin.
11
The information returned is a dict with various keywords:
14
the last modified timestamp of this data source. This will be used
15
to see if we need to update the database or not. A timestamp of 0
16
means that this data source is either missing or always up to date.
18
an array of dicts { name: name, desc: description }, one for every
19
numeric value indexed by this data source.
21
Note that this method can be called before init. The idea is that, if
22
the timestamp shows that this plugin is currently not needed, then the
23
long initialisation can just be skipped.
25
file = apt_pkg.config.find_file("Dir::Cache::pkgcache")
26
if not os.path.exists(file):
27
return dict(timestamp=0)
29
timestamp=os.path.getmtime(file),
31
dict(name="display_name", desc="display name"),
32
dict(name="pkgname", desc="Pkgname as value"),
37
Return documentation information for this data source.
39
The documentation information is a dictionary with these keys:
40
name: the name for this data source
41
shortDesc: a short description
42
fullDoc: the full description as a chapter in ReST format
46
shortDesc="pkgname and package display names indexed as values",
48
The DisplayNames data source indexes the display name as the
49
``display_name`` Xapian value.
50
``pkgname`` Xapian value.
53
def init(self, info, progress):
55
If needed, perform long initialisation tasks here.
57
info is a dictionary with useful information. Currently it contains
60
"values": a dict mapping index mnemonics to index numbers
62
The progress indicator can be used to report progress.
64
# Read the value indexes we will use
65
values = info['values']
66
self.val_display_name = values.get("display_name", -1)
67
self.val_pkgname = values.get("pkgname", -1)
69
def index(self, document, pkg):
71
Update the document with the information from this data source.
73
document is the document to update
74
pkg is the python-apt Package object for this package
79
if self.val_display_name != -1:
81
document.add_value(self.val_display_name, name)
82
if self.val_pkgname != -1:
83
document.add_value(self.val_pkgname, pkg.name)
85
def indexDeb822(self, document, pkg):
87
Update the document with the information from this data source.
89
This is alternative to index, and it is used when indexing with package
90
data taken from a custom Packages file.
92
document is the document to update
93
pkg is the Deb822 object for this package
100
Create and return the plugin object.
102
return DisplayNames()