1 # -*- coding: utf-8 -*-
3 jinja2._markupsafe._bundle
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~
6 This script pulls in markupsafe from a source folder and
7 bundles it with Jinja2. It does not pull in the speedups
10 :copyright: Copyright 2010 by the Jinja team, see AUTHORS.
11 :license: BSD, see LICENSE for details.
18 def rewrite_imports(lines):
19 for idx, line in enumerate(lines):
20 new_line = re.sub(r'(import|from)\s+markupsafe\b',
21 r'\1 jinja2._markupsafe', line)
27 if len(sys.argv) != 2:
28 print 'error: only argument is path to markupsafe'
30 basedir = os.path.dirname(__file__)
31 markupdir = sys.argv[1]
32 for filename in os.listdir(markupdir):
33 if filename.endswith('.py'):
34 f = open(os.path.join(markupdir, filename))
39 rewrite_imports(lines)
40 f = open(os.path.join(basedir, filename), 'w')
48 if __name__ == '__main__':