import os
import re
from threading import Event
-from urlparse import urlparse
from django.utils.timezone import localtime, UTC
from gridftp import FTPClient, Buffer, HandleAttr, OperationAttr
data = self.listing(url).next()
if data['name'] == '.':
- data['name'] = os.path.basename(urlparse(url).path.rstrip('/')) or u'/'
+ data['name'] = os.path.basename(os.path.normpath(url))
return data
def compress(self, server, path, files, archive):
if self.match_ext(archive, '.tar.gz', '.tgz'):
- cmd, args = 'tar', ['cvzf', os.path.join(path, archive), '-C', path] + files
+ cmd, args = 'tar', ['cvzf', archive, '-C', path] + files
elif self.match_ext(archive, '.tar.bz2', '.tbz'):
- cmd, args = 'tar', ['cvjf', os.path.join(path, archive), '-C', path] + files
+ cmd, args = 'tar', ['cvjf', archive, '-C', path] + files
elif self.match_ext(archive, '.zip'):
- cmd, args = 'jar', (['cvMf', os.path.join(path, archive)] +
- list(chain.from_iterable(('-C', path, f) for f in files)))
+ cmd, args = 'jar', (['cvMf', archive] + list(chain.from_iterable(('-C', path, f) for f in files)))
else:
raise ValueError('Unknown archive type: {}'.format(archive))
- # FIXME handling filename with #
self.op_attr.set_disk_stack('#'.join(["popen:argv=", cmd] + args))
return self.get(server)
else:
raise ValueError('Unknown archive type: {}'.format(archive))
- # FIXME handling filename with #
self.op_attr.set_disk_stack('#'.join(("popen:argv=", cmd) + args))
return self.get(server)