/usr/share/pyshared/dbtexmf/xslt/xslt.py is in dblatex 0.3.4-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 | #
# Very simple plugin loader for Xslt classes
#
import os
import imp
import glob
def load(modname):
try:
file, path, descr = imp.find_module(modname, [""])
except ImportError:
try:
file, path, descr = imp.find_module(modname, [os.path.dirname(__file__)])
except ImportError:
raise ValueError("Xslt '%s' not found" % modname)
mod = imp.load_module(modname, file, path, descr)
file.close()
o = mod.Xslt()
return o
def get_deplists():
"""
Return the dependency list to check for each XSLT plugin. The returned
list also gives the available plugins.
"""
ps = glob.glob(os.path.join(os.path.dirname(__file__), "*.py"))
selfmod = os.path.splitext(os.path.basename(__file__))[0]
ps = [os.path.splitext(os.path.basename(p))[0] for p in ps]
if selfmod in ps:
ps.remove(selfmod)
if "__init__" in ps:
ps.remove("__init__")
deplists = []
for p in ps:
try:
x = load(p)
deplists.append((p, x.get_deplist()))
except:
# The module cannot be loaded, but don't panic yet
pass
return deplists
|