~ubuntu-branches/ubuntu/karmic/calibre/karmic

« back to all changes in this revision

Viewing changes to src/calibre/libunzip.py

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-30 12:49:41 UTC
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20090730124941-kviipg9ypwgppulc
Tags: upstream-0.6.3+dfsg
ImportĀ upstreamĀ versionĀ 0.6.3+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
4
4
__docformat__ = 'restructuredtext en'
5
5
 
6
 
import os, re
 
6
import re
7
7
from calibre.utils import zipfile
8
8
 
9
9
def update(pathtozip, patterns, filepaths, names, compression=zipfile.ZIP_DEFLATED, verbose=True):
10
10
    '''
11
 
    Update files in the zip file at `pathtozip` matching the given 
 
11
    Update files in the zip file at `pathtozip` matching the given
12
12
    `patterns` with the given `filepaths`. If more than
13
 
    one file matches, all of the files are replaced. 
14
 
    
 
13
    one file matches, all of the files are replaced.
 
14
 
15
15
    :param patterns:    A list of compiled regular expressions
16
16
    :param filepaths:   A list of paths to the replacement files. Must have the
17
17
                        same length as `patterns`.
18
 
    :param names:       A list of archive names for each file in filepaths. 
 
18
    :param names:       A list of archive names for each file in filepaths.
19
19
                        A name can be `None` in which case the name of the existing
20
20
                        file in the archive is used.
21
21
    :param compression: The compression to use when replacing files. Can be
48
48
    names = zf.namelist()
49
49
    for name in names:
50
50
        if match.search(name):
51
 
            return name, zf.read(name)
 
 
b'\\ No newline at end of file'
 
51
            return name, zf.read(name)