diff options
author | Damien George <damien.p.george@gmail.com> | 2015-05-30 23:11:16 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-05-30 23:11:16 +0100 |
commit | 26b512ea1bcc8035f8f5312b2065c85a639c02ae (patch) | |
tree | e7f84cafb196d6885f07bfd5a16c0603cd2cbb6f /py/makeqstrdata.py | |
parent | 7d8edeff4e81e89ed8833d9933effd1e2431f7f1 (diff) |
py: Get makeqstrdata.py and makeversionhdr.py running under Python 2.6.
These scripts should run under as wide a range of Python versions as
possible.
Diffstat (limited to 'py/makeqstrdata.py')
-rw-r--r-- | py/makeqstrdata.py | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py index 3abf638e2..6b7df39cb 100644 --- a/py/makeqstrdata.py +++ b/py/makeqstrdata.py @@ -1,6 +1,11 @@ +""" +Process raw qstr file and output qstr data with length, hash and data bytes. + +This script works with Python 2.6, 2.7, 3.3 and 3.4. +""" + from __future__ import print_function -import argparse import re import sys @@ -97,17 +102,5 @@ def do_work(infiles): qlen_str = ('\\x%02x' * cfg_bytes_len) % tuple(((qlen >> (8 * i)) & 0xff) for i in range(cfg_bytes_len)) print('QDEF(MP_QSTR_%s, (const byte*)"\\x%02x\\x%02x%s" "%s")' % (ident, qhash & 0xff, (qhash >> 8) & 0xff, qlen_str, qdata)) - return True - -def main(): - arg_parser = argparse.ArgumentParser(description='Process raw qstr file and output qstr data with length, hash and data bytes') - arg_parser.add_argument('files', nargs='+', help='input file(s)') - args = arg_parser.parse_args() - - result = do_work(args.files) - if not result: - print('exiting with error code', file=sys.stderr) - exit(1) - if __name__ == "__main__": - main() + do_work(sys.argv[1:]) |