This file is indexed.

/usr/lib/python/tulipplugins.py is in tulip 4.4.0dfsg2-2.

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
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
"""
This module provides utility functions to register Tulip plugins written in Python in the plugins database.
"""

import sys
import traceback
if sys.version_info[0] == 3:
    from imp import reload
from tulip import *
pluginFactory = {}
pluginModules = {}
testMode = False

def setTestMode(mode):
    global testMode
    testMode = mode

def getCallingModuleName():
    import sys
    if sys.version_info[0] == 3:
        f = list(sys._current_frames().values())[0]
    else:
        f = sys._current_frames().values()[0]
    while f.f_globals['__name__'] == "tulipplugins":
        f = f.f_back
    return f.f_globals['__name__']
   
def reloadTulipPythonPlugin(pluginName):
    if pluginName in pluginModules:
        module = pluginModules[pluginName]
        code = ""
        code += "import " + module + "\n"
        code += "reload(" + module + ")\n"
        exec(code)
   
def reloadTulipPythonPlugins():
    for plugin in pluginModules.keys():
        reloadTulipPythonPlugin(plugin)

def removePlugin(pluginName):
    tulipUtilsOk = True
    try:
        import tuliputils
    except ImportError:
        tulipUtilsOk = False
    if tulipUtilsOk:
        tuliputils.removePlugin(pluginName)

def setProcessQtEvents(processEvents):
    tulipUtilsOk = True
    try:
        import tuliputils
    except ImportError:
        tulipUtilsOk = False
    if tulipUtilsOk:
        tuliputils.setProcessQtEvents(processEvents)

def initFactory(self):
    tlp.FactoryInterface.__init__(self)
    self.registerPlugin()

def runPlugin(plugin):
    setProcessQtEvents(True)
    ret = False
    try:
        ret = plugin.real_run()
    except:
        if plugin.pluginProgress:
            plugin.pluginProgress.setError(traceback.format_exc())
    setProcessQtEvents(False)
    return ret

def importGraph(plugin):
    ret = False
    setProcessQtEvents(True)
    try:
        ret = plugin.real_importGraph()
    except:
        if plugin.pluginProgress:
            plugin.pluginProgress.setError(traceback.format_exc())
    setProcessQtEvents(False)
    return ret

def exportGraph(plugin, os):
    ret = False
    setProcessQtEvents(True)
    try:
        ret = plugin.real_exportGraph(os)
    except:
        if plugin.pluginProgress:
            plugin.pluginProgress.setError(traceback.format_exc())
    setProcessQtEvents(False)
    return ret

def createPlugin(context, pluginModule, pluginClassName, pluginName, author, date, info, release, group):
    globals()[pluginModule] = __import__(pluginModule, globals(), locals(), [], 0)

    plugin = eval(pluginModule + "." + pluginClassName + "(context)", globals(), locals())
    if hasattr(plugin, "run"):
        plugin.real_run = plugin.run
        plugin.run = lambda : runPlugin(plugin)
    elif hasattr(plugin, "importGraph"):
        plugin.real_importGraph = plugin.importGraph
        plugin.importGraph = lambda : importGraph(plugin)
    elif hasattr(plugin, "exportGraph"):
        plugin.real_exportGraph = plugin.exportGraph
        plugin.exportGraph = lambda os : exportGraph(plugin, os)
    plugin.name = lambda : pluginName
    plugin.group = lambda : group
    plugin.date = lambda : date
    plugin.info = lambda : info
    plugin.release = lambda : release
    plugin.tulipRelease = lambda : tlp.getTulipRelease()
    plugin.programmingLanguage = lambda : "Python"
    return plugin

def registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, group):

    """
    tulipplugins.registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, group)

    Registers a Tulip plugin written in Python in the plugins database and inserts it in a specific group.

    :param pluginClassName: the name of the Python class implementing the plugin
    :type pluginClassName: string
    :param pluginName: the name of the plugin as it will appear in the interface and that will be used to call it
    :type pluginName: string
    :param author: the name of the plugin's author
    :type author: string
    :param date: the date of creation of the plugin
    :type date: string
    :param info: some information relative to the plugin
    :type info: string
    :param release: the version number of the plugin in the form X.Y
    :type release: string
    :param group: the name of the group in which the plugin will be inserted
    :type group: string
    """

    global pluginFactory
    removePlugin(pluginName)
    if testMode:
        return
    pluginModule = getCallingModuleName()
    pluginModules[pluginName] = pluginModule
    pluginFactory[pluginName] = type(pluginClassName + "Factory", (tlp.FactoryInterface,), { \
                                     "__init__": (lambda self: initFactory(self)), \
                                     "createPluginObject" : (lambda self, context: createPlugin(context, pluginModule, pluginClassName, pluginName, author, date, info, release, group))} \
                                     )()

def registerPlugin(pluginClassName, pluginName, author, date, info, release):

    """
    tulipplugins.registerPlugin(pluginClassName, pluginName, author, date, info, release)

    Registers a Tulip plugin written in Python in the plugins database.

    :param pluginClassName: the name of the Python class implementing the plugin
    :type pluginClassName: string
    :param pluginName: the name of the plugin as it will appear in the interface and that will be used to call it
    :type pluginName: string
    :param author: the name of the plugin's author
    :type author: string
    :param date: the date of creation of the plugin
    :type date: string
    :param info: some information relative to the plugin
    :type info: string
    :param release: the version number of the plugin in the form X.Y
    :type release: string
    """

    registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, "")

# For backward compatibility with Tulip 3.x

def registerAlgorithmPlugin(pluginClassName, pluginName, author, date, info, release):

    registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, "")

def registerAlgorithmPluginOfGroup(pluginClassName, pluginName, author, date, info, release, group):

    registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, group)

def registerLayoutPlugin(pluginClassName, pluginName, author, date, info, release):

    registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, "")

def registerLayoutPluginOfGroup(pluginClassName, pluginName, author, date, info, release, group):

    registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, group)

def registerDoublePlugin(pluginClassName, pluginName, author, date, info, release):

    registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, "")

def registerDoublePluginOfGroup(pluginClassName, pluginName, author, date, info, release, group):

    registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, group)

def registerIntegerPlugin(pluginClassName, pluginName, author, date, info, release):

    registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, "")

def registerIntegerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, group):

    registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, group)

def registerBooleanPlugin(pluginClassName, pluginName, author, date, info, release):

    registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, "")

def registerBooleanPluginOfGroup(pluginClassName, pluginName, author, date, info, release, group):

    registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, group)

def registerSizePlugin(pluginClassName, pluginName, author, date, info, release):

    registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, "")

def registerSizePluginOfGroup(pluginClassName, pluginName, author, date, info, release, group):

    registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, group)

def registerColorPlugin(pluginClassName, pluginName, author, date, info, release):

    registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, "")

def registerColorPluginOfGroup(pluginClassName, pluginName, author, date, info, release, group):

    registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, group)

def registerImportPlugin(pluginClassName, pluginName, author, date, info, release):

    registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, "")

def registerImportPluginOfGroup(pluginClassName, pluginName, author, date, info, release, group):

    registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, group)

def registerExportPlugin(pluginClassName, pluginName, author, date, info, release):

    registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, "")

def registerExportPluginOfGroup(pluginClassName, pluginName, author, date, info, release, group):

    registerPluginOfGroup(pluginClassName, pluginName, author, date, info, release, group)