diff options
Diffstat (limited to 'util/util_precompile.py')
-rwxr-xr-x | util/util_precompile.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/util/util_precompile.py b/util/util_precompile.py index c58b811913..bc8ad0320f 100755 --- a/util/util_precompile.py +++ b/util/util_precompile.py @@ -521,6 +521,27 @@ def generate_blob(): print('dump size %d, compressed size %d' % (len(dump), len(zipped))) return zipped +def seed_blob(outfile): + """Read string data from a previously saved blob + + This function is invoked only if the blob file exists. + """ + global FMT_DICT + if outfile.endswith('Ep'): + print('invoked with', ' '.join(sys.argv)) + assert False + with open(outfile, 'rb') as blob: + try: + zipped = blob.read() + pickled = zlib.decompress(zipped) + dump = pickle.loads(pickled) + except (zlib.error, pickle.UnpicklingError): + print('%s does not seem to be a proper blob, ignored' % outfile) + return + strings = dump.split('\0') + for i in range(len(strings)): + FMT_DICT[strings[i]] = i + def main(argv): """Main function. @@ -546,6 +567,7 @@ def main(argv): else: # Output file is newer than all inputs. return + seed_blob(flags.output) for e_file in files[1:]: preobj_process(e_file, flags.ext) |