~mwilck/duplicity/duplicity

« back to all changes in this revision

Viewing changes to duplicity/backends/par2backend.py

  • Committer: Aaron A Whitehouse
  • Date: 2016-07-02 17:12:58 UTC
  • mfrom: (1111 duplicity-src8)
  • mto: This revision was merged to the branch mainline in revision 1113.
  • Revision ID: lists@whitehouse.kiwi.nz-20160702171258-xhnf5v5g542fcfhq
Merge with trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
            if hasattr(self.wrapped_backend, attr):
54
54
                setattr(self, attr, getattr(self, attr[1:]))
55
55
 
 
56
        # always declare _delete_list support because _delete queries file
 
57
        # list for every call
 
58
        self._delete_list = self.delete_list
 
59
 
56
60
    def transfer(self, method, source_path, remote_filename):
57
61
        """create Par2 files and transfer the given file and the Par2 files
58
62
        with the wrapped backend.
113
117
            par2file = par2temp.append(remote_filename + '.par2')
114
118
            self.wrapped_backend._get(par2file.get_filename(), par2file)
115
119
 
116
 
            par2verify = 'par2 v %s %s %s' % (self.common_options, par2file.get_canonical(), local_path_temp.get_canonical())
 
120
            par2verify = 'par2 v %s %s %s' % (self.common_options,
 
121
                                              par2file.get_canonical(),
 
122
                                              local_path_temp.get_canonical())
117
123
            out, returncode = pexpect.run(par2verify, None, True)
118
124
 
119
125
            if returncode:
125
131
                    file = par2temp.append(filename)
126
132
                    self.wrapped_backend._get(filename, file)
127
133
 
128
 
                par2repair = 'par2 r %s %s %s' % (self.common_options, par2file.get_canonical(), local_path_temp.get_canonical())
 
134
                par2repair = 'par2 r %s %s %s' % (self.common_options,
 
135
                                                  par2file.get_canonical(),
 
136
                                                  local_path_temp.get_canonical())
129
137
                out, returncode = pexpect.run(par2repair, None, True)
130
138
 
131
139
                if returncode:
160
168
            c = re.compile(r'%s(?:\.vol[\d+]*)?\.par2' % filename)
161
169
            for remote_filename in remote_list:
162
170
                if c.match(remote_filename):
163
 
                    filename_list.append(remote_filename)
 
171
                    # insert here to make sure par2 files will be removed first
 
172
                    filename_list.insert(0, remote_filename)
164
173
 
165
 
        return self.wrapped_backend._delete_list(filename_list)
 
174
        if hasattr(self.wrapped_backend, '_delete_list'):
 
175
            return self.wrapped_backend._delete_list(filename_list)
 
176
        else:
 
177
            for filename in filename_list:
 
178
                self.wrapped_backend._delete(filename)
166
179
 
167
180
    def list(self):
168
181
        """