https://github.com/EasyCrypt/easycrypt
Raw File
Tip revision: a79f9aeb6de046ca12210d26317fab59c175d0dd authored by Pierre-Yves Strub on 08 July 2014, 09:43:21 UTC
Fix bug w.r.t. _tools presence detection.
Tip revision: a79f9ae
str2ml.py
#! /usr/bin/env python

# --------------------------------------------------------------------
import sys, os, re, base64

# --------------------------------------------------------------------
def _main():
    if len(sys.argv)-1 != 1:
        print >>sys.stderr, 'Usage: %s [filename]' % (sys.argv[0],)
        exit(1)

    with open(sys.argv[1], 'r') as stream:
        contents = [x.strip() for x in stream.readlines()]
        contents = [x for x in contents if x]

    print 'let value = ['
    for x in contents:
        print '  "%s";' % (base64.b64encode(x),)
    print ']'

# --------------------------------------------------------------------
if __name__ == '__main__':
    _main()
back to top