/usr/share/pyshared/desktopcouch/application/plugins/__init__.py is in python-desktopcouch-application 1.0.8-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | # Copyright 2010 Canonical Ltd.
#
# desktopcouch is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# as published by the Free Software Foundation.
#
# desktopcouch is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with desktopcouch. If not, see <http://www.gnu.org/licenses/>.
"""Desktopcouch application plugins."""
import logging
import os
DESKTOPCOUCH_PLUGIN_PATHS = [os.path.join(os.path.dirname(__file__))]
def load_plugins(couchdb_port, blocking_semaphores, gobject):
"""Load the desktopcouch application plug-ins.
The blocking_semaphores set is OPTIONALLY mutated by any plugin to signal
that the service is not ready until a plugin has finished its asynchronous
operations. Plugins may add a distinguishing object to the set, and it
must remove what it adds when it is finished.
couchdb -- the integer of the port number of the running couchdb
blocking_semaphores -- the set() of semaphores, which we will mutate
gobject -- the mainloop module. always 'gobject' except when testing.
"""
plugin_names = set()
for path in DESKTOPCOUCH_PLUGIN_PATHS:
try:
for _file in os.listdir(path):
if _file == '__init__':
continue
elif _file.endswith('.py') and _file != '__init__.py':
plugin_names.add(os.path.join(
'desktopcouch', 'application', 'plugins', _file))
except OSError:
continue
for name in plugin_names:
modpath = name.replace(os.path.sep, '.')[:-3]
try:
plugin = __import__(modpath, None, None, [''])
plugin.plugin_init(couchdb_port, blocking_semaphores, gobject)
except (ImportError, AttributeError):
logging.warning('Failed to load plug-in: %s', modpath)
|