/usr/share/pyshared/plasTeX/Packages/graphics.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 62 63 64 65 66 67 68 69 70 71 72 73 74 | import os
from plasTeX import Command
class includegraphics(Command):
args = '* [ ll ] [ ur ] file:str'
packageName = 'graphics'
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
self.imageoverride = img
return res
class graphicspath(Command):
args = 'paths'
packageName = 'graphics'
def invoke(self, tex):
res = Command.invoke(self, tex)
output = [x.textContent.strip() for x in self.attributes['paths']]
output = [x for x in output if x]
self.ownerDocument.userdata.setPath(
'packages/%s/paths' % self.packageName, output)
return res
class DeclareGraphicsExtensions(Command):
packageName = 'graphics'
args = 'ext:list'
def invoke(self, tex):
res = Command.invoke(self, tex)
ext = [x for x in self.attributes['ext'] if x]
self.ownerDocument.userdata.setPath(
'packages/%s/extensions' % self.packageName, ext)
return res
class rotatebox(Command):
args = 'angle:float self'
class scalebox(Command):
args = 'hscale:float [ vscale:float ] self'
class reflectbox(Command):
args = 'self'
class resizebox(Command):
args = 'hlength:dimen vlength:dimen self'
|