~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to upstream_import.py

  • Committer: Charlie Shepherd
  • Date: 2007-04-04 18:12:00 UTC
  • mto: This revision was merged to the branch mainline in revision 538.
  • Revision ID: masterdriverz@gentoo.org-20070404181200-wqiwytdor9srux2v
Remove all trailing whitespace

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
from bzrlib.trace import warning
17
17
from bzrlib.transform import TreeTransform, resolve_conflicts, cook_conflicts
18
18
from bzrlib.workingtree import WorkingTree
19
 
from bzrlib.plugins.bzrtools.bzrtools import open_from_url
20
19
 
21
20
class ZipFileWrapper(object):
22
21
 
109
108
    def isdir(self):
110
109
        return stat.S_ISDIR(self.mode)
111
110
 
112
 
    def issym(self):
113
 
        if stat.S_ISLNK(self.mode):
114
 
            self.linkname = os.readlink(self.fullpath)
115
 
            return True
116
 
        else:
117
 
            return False
118
 
 
119
111
 
120
112
def top_directory(path):
121
113
    """Return the top directory given in a path."""
268
260
        if (source.endswith('.tar') or source.endswith('.tar.gz') or
269
261
            source.endswith('.tar.bz2')) or source.endswith('.tgz'):
270
262
            try:
271
 
                tar_input = open_from_url(source)
272
263
                if source.endswith('.bz2'):
273
 
                    tar_input = StringIO(tar_input.read().decode('bz2'))
 
264
                    tar_input = BZ2File(source, 'r')
 
265
                    tar_input = StringIO(tar_input.read())
 
266
                else:
 
267
                    tar_input = file(source, 'rb')
274
268
            except IOError, e:
275
269
                if e.errno == errno.ENOENT:
276
270
                    raise NoSuchFile(source)
279
273
            finally:
280
274
                tar_input.close()
281
275
        elif source.endswith('.zip'):
282
 
            import_zip(tree, open_from_url(source))
 
276
            import_zip(tree, open(source, 'rb'))
283
277
        elif file_kind(source) == 'directory':
284
278
            s = StringIO(source)
285
279
            s.seek(0)