projects
/
qcg-portal.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
273c054
)
fix handling zip archives
author
Maciej Tronowski
<mtro@man.poznan.pl>
Tue, 14 Apr 2015 09:51:32 +0000
(11:51 +0200)
committer
Maciej Tronowski
<mtro@man.poznan.pl>
Tue, 14 Apr 2015 09:51:32 +0000
(11:51 +0200)
filex/ftp.py
patch
|
blob
|
history
diff --git
a/filex/ftp.py
b/filex/ftp.py
index
39ee807
..
49f470f
100644
(file)
--- a/
filex/ftp.py
+++ b/
filex/ftp.py
@@
-1,5
+1,6
@@
from datetime import datetime
from Queue import Queue, Empty
from datetime import datetime
from Queue import Queue, Empty
+from itertools import chain
import os
import re
from threading import Event
import os
import re
from threading import Event
@@
-167,7
+168,8
@@
class FTPOperation:
elif self.match_ext(archive, '.tar.bz2', '.tbz'):
cmd, args = 'tar', ['cvjf', os.path.join(path, archive), '-C', path] + files
elif self.match_ext(archive, '.zip'):
elif self.match_ext(archive, '.tar.bz2', '.tbz'):
cmd, args = 'tar', ['cvjf', os.path.join(path, archive), '-C', path] + files
elif self.match_ext(archive, '.zip'):
- cmd, args = 'zip', ['-r', os.path.join(path, archive)] + [os.path.join(path, f) for f in files]
+ cmd, args = 'jar', (['cvMf', os.path.join(path, archive)] +
+ list(chain.from_iterable(('-C', path, f) for f in files)))
else:
raise ValueError('Unknown archive type: {}'.format(archive))
else:
raise ValueError('Unknown archive type: {}'.format(archive))
@@
-178,15
+180,15
@@
class FTPOperation:
def extract(self, server, archive, dst):
if self.match_ext(archive, '.tar.gz', '.tgz'):
def extract(self, server, archive, dst):
if self.match_ext(archive, '.tar.gz', '.tgz'):
- cmd, args = 'tar', ['xvzf', archive, '-C', dst]
+ cmd, args = 'tar', ('xvzf', archive, '-C', dst)
elif self.match_ext(archive, '.tar.bz2', '.tbz'):
elif self.match_ext(archive, '.tar.bz2', '.tbz'):
- cmd, args = 'tar', ['xvjf', archive, '-C', dst]
+ cmd, args = 'tar', ('xvjf', archive, '-C', dst)
elif self.match_ext(archive, '.zip'):
elif self.match_ext(archive, '.zip'):
- cmd, args = 'unzip', [archive, '-d', dst]
+ cmd, args = 'unzip', (archive, '-d', dst)
else:
raise ValueError('Unknown archive type: {}'.format(archive))
# FIXME handling filename with #
else:
raise ValueError('Unknown archive type: {}'.format(archive))
# FIXME handling filename with #
- self.op_attr.set_disk_stack('#'.join(["popen:argv=", cmd] + args))
+ self.op_attr.set_disk_stack('#'.join(("popen:argv=", cmd) + args))
return self.get(server)
return self.get(server)