# Compress src/boringssl/boringssl_prefix_symbols.h with gzip then encode
# with Base64. The result is put in variable prefix_gz_b64.
#
# Note that gRPC's template parser is still using Python 2, whose gzip
# module does not support directly compressing bytes into bytes. Instead,
# we have to write the compressed bytes into a intermediate file
# (src/boringssl/boringssl_prefix_symbols.h.gz), read the compressed
# bytes from this file, then delete the intermediate file.
#
# TODO(mxyan): move to python3 style gzip compression when possible
with open('src/boringssl/boringssl_prefix_symbols.h', 'rb') as f_in, gzip.GzipFile('src/boringssl/boringssl_prefix_symbols.h.gz', 'w', mtime=0.0) as f_out:
shutil.copyfileobj(f_in, f_out)
with open('src/boringssl/boringssl_prefix_symbols.h.gz', 'rb') as f_in:
with open('src/boringssl/boringssl_prefix_symbols.h', 'rb') as f_in, gzip.GzipFile('src/boringssl/boringssl_prefix_symbols.h.gz', 'w', mtime=0.0) as f_out:
shutil.copyfileobj(f_in, f_out)
with open('src/boringssl/boringssl_prefix_symbols.h.gz', 'rb') as f_in: