aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/py_compile.py
blob: b1f6e0b7dbfa964133c01f4a03f01b3a7012e45e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import print_function, absolute_import, division

import marshal
import sys


def main():
    srcpathx, in_fname, out_fname = sys.argv[1:] 
    srcpath = srcpathx[:-1] 
 
    with open(in_fname, 'r') as in_file:
        source = in_file.read()
 
    code = compile(source, srcpath, 'exec', dont_inherit=True) 
 
    with open(out_fname, 'wb') as out_file: 
        marshal.dump(code, out_file)


if __name__ == "__main__":
    main()