/usr/bin/mako-render is in python-mako 0.5.0-1.
This file is owned by root:root, with mode 0o755.
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 | #!/usr/bin/python
def render(data):
from mako.template import Template
from mako.lookup import TemplateLookup
lookup = TemplateLookup(["."])
return Template(data, lookup=lookup).render()
def main(argv=None):
from os.path import isfile
from sys import stdin
if argv is None:
import sys
argv = sys.argv
from optparse import OptionParser
parser = OptionParser("usage: %prog [FILENAME]")
opts, args = parser.parse_args(argv[1:])
if len(args) not in (0, 1):
parser.error("wrong number of arguments") # Will exit
if (len(args) == 0) or (args[0] == "-"):
fo = stdin
else:
filename = args[0]
if not isfile(filename):
raise SystemExit("error: can't find %s" % filename)
fo = open(filename)
data = fo.read()
print render(data)
if __name__ == "__main__":
main()
|