/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/pack.py

  • Committer: Breezy landing bot
  • Author(s): Martin
  • Date: 2017-06-11 01:56:34 UTC
  • mfrom: (6684.1.5 py3_bootstrap2)
  • Revision ID: breezy.the.bot@gmail.com-20170611015634-9eeh86thh073hcko
More progress towards Python 3 support

Merged from https://code.launchpad.net/~gz/brz/py3_bootstrap2/+merge/325452

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
 
74
74
    def begin(self):
75
75
        """Return the bytes to begin a container."""
76
 
        return FORMAT_ONE + "\n"
 
76
        return FORMAT_ONE.encode("ascii") + b"\n"
77
77
 
78
78
    def end(self):
79
79
        """Return the bytes to finish a container."""
80
 
        return "E"
 
80
        return b"E"
81
81
 
82
82
    def bytes_header(self, length, names):
83
83
        """Return the header for a Bytes record."""
84
84
        # Kind marker
85
 
        byte_sections = ["B"]
 
85
        byte_sections = [b"B"]
86
86
        # Length
87
 
        byte_sections.append(str(length) + "\n")
 
87
        byte_sections.append(b"%d\n" % (length,))
88
88
        # Names
89
89
        for name_tuple in names:
90
90
            # Make sure we're writing valid names.  Note that we will leave a
91
91
            # half-written record if a name is bad!
92
92
            for name in name_tuple:
93
93
                _check_name(name)
94
 
            byte_sections.append('\x00'.join(name_tuple) + "\n")
 
94
            byte_sections.append(b'\x00'.join(name_tuple) + b"\n")
95
95
        # End of headers
96
 
        byte_sections.append("\n")
97
 
        return ''.join(byte_sections)
 
96
        byte_sections.append(b"\n")
 
97
        return b''.join(byte_sections)
98
98
 
99
99
    def bytes_record(self, bytes, names):
100
100
        """Return the bytes for a Bytes record with the given name and