| Home | Trees | Indices | Help |
|
|---|
|
|
1 # -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- 2 # 3 # Copyright 2002 Ben Escoto <ben@emerose.org> 4 # Copyright 2007 Kenneth Loafman <kenneth@loafman.com> 5 # 6 # This file is part of duplicity. 7 # 8 # Duplicity is free software; you can redistribute it and/or modify it 9 # under the terms of the GNU General Public License as published by the 10 # Free Software Foundation; either version 2 of the License, or (at your 11 # option) any later version. 12 # 13 # Duplicity is distributed in the hope that it will be useful, but 14 # WITHOUT ANY WARRANTY; without even the implied warranty of 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 # General Public License for more details. 17 # 18 # You should have received a copy of the GNU General Public License 19 # along with duplicity; if not, write to the Free Software Foundation, 20 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 22 import os 23 24 import duplicity.backend 25 from duplicity.errors import * #@UnusedWildImport 26 27 hsi_command = "hsi"67 68 duplicity.backend.register_backend("hsi", HSIBackend) 6930 duplicity.backend.Backend.__init__(self, parsed_url) 31 self.host_string = parsed_url.hostname 32 self.remote_dir = parsed_url.path 33 if self.remote_dir: 34 self.remote_prefix = self.remote_dir + "/" 35 else: 36 self.remote_prefix = ""3739 if not remote_filename: 40 remote_filename = source_path.get_filename() 41 commandline = '%s "put %s : %s%s"' % (hsi_command,source_path.name,self.remote_prefix,remote_filename) 42 try: 43 self.run_command(commandline) 44 except Exception: 45 print commandline4648 commandline = '%s "get %s : %s%s"' % (hsi_command, local_path.name, self.remote_prefix, remote_filename) 49 self.run_command(commandline) 50 local_path.setdata() 51 if not local_path.exists(): 52 raise BackendException("File %s not found" % local_path.name)5355 commandline = '%s "ls -l %s"' % (hsi_command, self.remote_dir) 56 l = os.popen3(commandline)[2].readlines()[3:] 57 for i in range(0,len(l)): 58 l[i] = l[i].split()[-1] 59 print filter(lambda x: x, l) 60 return filter(lambda x: x, l)6163 assert len(filename_list) > 0 64 for fn in filename_list: 65 commandline = '%s "rm %s%s"' % (hsi_command, self.remote_prefix, fn) 66 self.run_command(commandline)
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Fri Nov 25 13:38:22 2011 | http://epydoc.sourceforge.net |