~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to upstream_import.py

  • Committer: Aaron Bentley
  • Date: 2008-05-30 02:30:22 UTC
  • Revision ID: aaron@aaronbentley.com-20080530023022-l2fzmlvuzkotwnhv
Remove baz-import

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
19
20
 
20
21
class ZipFileWrapper(object):
21
22
 
108
109
    def isdir(self):
109
110
        return stat.S_ISDIR(self.mode)
110
111
 
 
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
 
111
119
 
112
120
def top_directory(path):
113
121
    """Return the top directory given in a path."""
260
268
        if (source.endswith('.tar') or source.endswith('.tar.gz') or
261
269
            source.endswith('.tar.bz2')) or source.endswith('.tgz'):
262
270
            try:
 
271
                tar_input = open_from_url(source)
263
272
                if source.endswith('.bz2'):
264
 
                    tar_input = BZ2File(source, 'r')
265
 
                    tar_input = StringIO(tar_input.read())
266
 
                else:
267
 
                    tar_input = file(source, 'rb')
 
273
                    tar_input = StringIO(tar_input.read().decode('bz2'))
268
274
            except IOError, e:
269
275
                if e.errno == errno.ENOENT:
270
276
                    raise NoSuchFile(source)
273
279
            finally:
274
280
                tar_input.close()
275
281
        elif source.endswith('.zip'):
276
 
            import_zip(tree, open(source, 'rb'))
 
282
            import_zip(tree, open_from_url(source))
277
283
        elif file_kind(source) == 'directory':
278
284
            s = StringIO(source)
279
285
            s.seek(0)