main.py 395 B

12345678910111213141516171819
  1. import marshal
  2. import sys
  3. def main():
  4. srcpathx, in_fname, out_fname = sys.argv[1:]
  5. srcpath = srcpathx[:-1]
  6. with open(in_fname, 'r', encoding='utf-8') as in_file:
  7. source = in_file.read()
  8. code = compile(source, srcpath, 'exec', dont_inherit=True)
  9. with open(out_fname, 'wb') as out_file:
  10. marshal.dump(code, out_file)
  11. if __name__ == '__main__':
  12. main()