~ubuntu-branches/ubuntu/oneiric/lightning-extension/oneiric-security

« back to all changes in this revision

Viewing changes to mozilla/testing/mozbase/mozinstall/mozinstall/mozinstall.py

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2012-11-08 10:00:06 UTC
  • mfrom: (1.3.8)
  • Revision ID: package-import@ubuntu.com-20121108100006-xpf89hktfitzuqc3
Tags: 1.9+build1-0ubuntu0.11.10.1
* New upstream stable release to support Thunderbird 17 (CALENDAR_1_9_BUILD1)
  - see LP: #1080212 for USN information

Show diffs side-by-side

added added

removed removed

Lines of Context:
218
218
    """
219
219
    if zipfile.is_zipfile(src):
220
220
        bundle = zipfile.ZipFile(src)
 
221
 
 
222
        # FIXME: replace with zip.extractall() when we require python 2.6
221
223
        namelist = bundle.namelist()
222
 
 
223
 
        if hasattr(bundle, 'extractall'):
224
 
            # zipfile.extractall doesn't exist in Python 2.5
225
 
            bundle.extractall(path=dest)
226
 
        else:
227
 
            for name in namelist:
228
 
                filename = os.path.realpath(os.path.join(dest, name))
229
 
                if name.endswith('/'):
230
 
                    os.makedirs(filename)
231
 
                else:
232
 
                    path = os.path.dirname(filename)
233
 
                    if not os.path.isdir(path):
234
 
                        os.makedirs(path)
235
 
                    dest = open(filename, 'wb')
236
 
                    dest.write(bundle.read(name))
237
 
                    dest.close()
 
224
        for name in bundle.namelist():
 
225
            filename = os.path.realpath(os.path.join(dest, name))
 
226
            if name.endswith('/'):
 
227
                os.makedirs(filename)
 
228
            else:
 
229
                path = os.path.dirname(filename)
 
230
                if not os.path.isdir(path):
 
231
                    os.makedirs(path)
 
232
                _dest = open(filename, 'wb')
 
233
                _dest.write(bundle.read(name))
 
234
                _dest.close()
238
235
 
239
236
    elif tarfile.is_tarfile(src):
240
237
        bundle = tarfile.open(src)