~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/export/zip_exporter.py

  • Committer: John Arbash Meinel
  • Date: 2005-12-01 17:53:57 UTC
  • mto: (1185.50.19 bzr-jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1532.
  • Revision ID: john@arbash-meinel.com-20051201175357-afaa3b6ded6cb81c
Couple small fixes, all tests pass on cygwin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
import os
21
21
from bzrlib.trace import mutter
22
 
from bzrlib.osutils import pathjoin
23
22
import zipfile
24
23
 
25
24
def zip_exporter(tree, dest, root):
44
43
            file_id = ie.file_id
45
44
            mutter("  export {%s} kind %s to %s", file_id, ie.kind, dest)
46
45
 
47
 
            # This may not require pathjoin, since we are doing
48
 
            # an export, but for consistency we will use it
49
46
            if ie.kind == "file": 
50
47
                zinfo = zipfile.ZipInfo(
51
 
                            filename=str(pathjoin(root, dp)),
 
48
                            filename=str(os.path.join(root, dp)),
52
49
                            date_time=now)
53
50
                zinfo.compress_type = compression
54
51
                zipf.writestr(zinfo, tree.get_file_text(file_id))
55
52
            elif ie.kind == "directory":
56
53
                zinfo = zipfile.ZipInfo(
57
 
                            filename=str(pathjoin(root, dp)+'/'),
 
54
                            filename=str(os.path.join(root, dp)+os.sep),
58
55
                            date_time=now)
59
56
                zinfo.compress_type = compression
60
57
                zipf.writestr(zinfo,'')
61
58
            elif ie.kind == "symlink":
62
59
                zinfo = zipfile.ZipInfo(
63
 
                            filename=str(pathjoin(root, dp+".lnk")),
 
60
                            filename=str(os.path.join(root, dp+".lnk")),
64
61
                            date_time=now)
65
62
                zinfo.compress_type = compression
66
63
                zipf.writestr(zinfo, ie.symlink_target)