/usr/share/pyshared/plasTeX/Packages/graphicx.py is in python-plastex 0.9.2-1.
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 | import os
from plasTeX import Command
from graphics import DeclareGraphicsExtensions, graphicspath
class includegraphics(Command):
args = '* [ options:dict ] file:str'
packageName = 'graphicx'
captionable = True
def invoke(self, tex):
res = Command.invoke(self, tex)
f = self.attributes['file']
ext = self.ownerDocument.userdata.getPath(
'packages/%s/extensions' % self.packageName,
['.png','.jpg','.jpeg','.gif','.pdf','.ps','.eps'])
paths = self.ownerDocument.userdata.getPath(
'packages/%s/paths' % self.packageName, ['.'])
img = None
# Check for file using graphicspath
for p in paths:
for e in ['']+ext:
fname = os.path.join(p,f+e)
if os.path.isfile(fname):
img = os.path.abspath(fname)
break
if img is not None:
break
# Check for file using kpsewhich
if img is None:
for e in ['']+ext:
try:
img = os.path.abspath(tex.kpsewhich(f+e))
break
except (OSError, IOError):
pass
options = self.attributes['options']
if options is not None:
height = options.get('height')
if height is not None:
self.style['height'] = height
width = options.get('width')
if width is not None:
self.style['width'] = width
self.imageoverride = img
return res
class DeclareGraphicsExtensions(DeclareGraphicsExtensions):
packageName = 'graphicx'
class graphicspath(graphicspath):
packageName = 'graphicx'
|