/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/archive/tar.py

  • Committer: Jelmer Vernooij
  • Date: 2020-04-05 19:11:34 UTC
  • mto: (7490.7.16 work)
  • mto: This revision was merged to the branch mainline in revision 7501.
  • Revision ID: jelmer@jelmer.uk-20200405191134-0aebh8ikiwygxma5
Populate the .gitignore file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Export a tree to a tarball."""
18
18
 
 
19
from __future__ import absolute_import
 
20
 
19
21
from contextlib import closing
20
 
from io import BytesIO
21
22
import os
22
23
import sys
23
24
import tarfile
27
28
    osutils,
28
29
    )
29
30
from ..export import _export_iter_entries
 
31
from ..sixish import (
 
32
    BytesIO,
 
33
    )
30
34
 
31
35
 
32
36
def prepare_tarball_item(tree, root, final_path, tree_path, entry, force_mtime=None):
181
185
    except ImportError as e:
182
186
        raise errors.DependencyNotPresent('lzma', e)
183
187
 
184
 
    compressor = lzma.LZMACompressor(
185
 
        format={
186
 
            'xz': lzma.FORMAT_XZ,
187
 
            'raw': lzma.FORMAT_RAW,
188
 
            'alone': lzma.FORMAT_ALONE,
189
 
            }[compression_format])
 
188
    if sys.version_info[0] == 2:
 
189
        compressor = lzma.LZMACompressor(
 
190
            options={"format": compression_format})
 
191
    else:
 
192
        compressor = lzma.LZMACompressor(
 
193
            format={
 
194
                'xz': lzma.FORMAT_XZ,
 
195
                'raw': lzma.FORMAT_RAW,
 
196
                'alone': lzma.FORMAT_ALONE,
 
197
                }[compression_format])
190
198
 
191
199
    for chunk in tarball_generator(
192
200
            tree, root, subdir, force_mtime=force_mtime):