root/galaxy-central/eggs/Mako-0.2.5-py2.6.egg/EGG-INFO/scripts/mako-render

リビジョン 3, 0.9 KB (コミッタ: kohda, 14 年 前)

Install Unix tools  http://hannonlab.cshl.edu/galaxy_unix_tools/galaxy.html

行番号 
1#!/afs/bx.psu.edu/project/pythons/linux-x86_64-ucs4/bin/python2.6
2
3def render(data):
4    from mako.template import Template
5    from mako.lookup import TemplateLookup
6
7    lookup = TemplateLookup(["."])
8    return Template(data, lookup=lookup).render()
9
10def main(argv=None):
11    from os.path import isfile
12    from sys import stdin
13
14    if argv is None:
15        import sys
16        argv = sys.argv
17
18    from optparse import OptionParser
19
20    parser = OptionParser("usage: %prog [FILENAME]")
21
22    opts, args = parser.parse_args(argv[1:])
23    if len(args) not in (0, 1):
24        parser.error("wrong number of arguments") # Will exit
25
26    if (len(args) == 0) or (args[0] == "-"):
27        fo = stdin
28    else:
29        filename = args[0]
30        if not isfile(filename):
31            raise SystemExit("error: can't find %s" % filename)
32        fo = open(filename)
33
34    data = fo.read()
35    print render(data)
36
37if __name__ == "__main__":
38    main()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。