/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tuned_gzip.py

  • Committer: Jelmer Vernooij
  • Date: 2018-02-18 21:42:57 UTC
  • mto: This revision was merged to the branch mainline in revision 6859.
  • Revision ID: jelmer@jelmer.uk-20180218214257-jpevutp1wa30tz3v
Update TODO to reference Breezy, not Bazaar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Legacy breezy specific gzip tunings."""
19
19
 
 
20
from __future__ import absolute_import
 
21
 
20
22
import struct
21
23
import zlib
22
24
 
39
41
 
40
42
 
41
43
def chunks_to_gzip(chunks, factory=zlib.compressobj,
42
 
                   level=zlib.Z_DEFAULT_COMPRESSION, method=zlib.DEFLATED,
43
 
                   width=-zlib.MAX_WBITS, mem=zlib.DEF_MEM_LEVEL,
44
 
                   crc32=zlib.crc32):
 
44
    level=zlib.Z_DEFAULT_COMPRESSION, method=zlib.DEFLATED,
 
45
    width=-zlib.MAX_WBITS, mem=zlib.DEF_MEM_LEVEL,
 
46
    crc32=zlib.crc32):
45
47
    """Create a gzip file containing chunks and return its content.
46
48
 
47
49
    :param chunks: An iterable of strings. Each string can have arbitrary
59
61
        b'\002'      # self.fileobj.write('\002')
60
62
        b'\377'      # self.fileobj.write('\377')
61
63
                     # if fname:
62
 
        b''  # self.fileobj.write(fname + '\000')
 
64
        b''          #     self.fileobj.write(fname + '\000')
63
65
        ]
64
66
    # using a compressobj avoids a small header and trailer that the compress()
65
67
    # utility function adds.
75
77
    result.append(compress.flush())
76
78
    # size may exceed 2GB, or even 4GB
77
79
    result.append(struct.pack("<LL", LOWU32(crc), LOWU32(total_len)))
78
 
    return result
 
80
    return b''.join(result)