summaryrefslogtreecommitdiffstats
path: root/tools/py2cc/__main__.py
blob: 54f87baa5eac8a4e23765b87ca098dac78970713 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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()