~ed.so/duplicity/reuse-passphrase-for-signing-fix

« back to all changes in this revision

Viewing changes to duplicity/backend.py

  • Committer: loafman
  • Date: 2008-12-22 17:22:44 UTC
  • Revision ID: vcs-imports@canonical.com-20081222172244-cjurdc0mt5d41n6d
patch #6700: Make duplicity translatable
https://savannah.nongnu.org/patch/?6700

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
import time
29
29
import re
30
30
import getpass
 
31
import gettext
31
32
 
32
33
import duplicity.dup_temp as dup_temp
33
34
import duplicity.dup_threading as dup_threading
242
243
        raise a BackendException.
243
244
        """
244
245
        private = self.munge_password(commandline)
245
 
        log.Log("Running '%s'" % private, 5)
 
246
        log.Log(_("Running '%s'") % private, 5)
246
247
        if os.system(commandline):
247
248
            raise BackendException("Error running '%s'" % private)
248
249
 
253
254
        """
254
255
        private = self.munge_password(commandline)
255
256
        for n in range(1, globals.num_retries+1):
256
 
            log.Log("Running '%s' (attempt #%d)" % (private, n), 5)
 
257
            log.Log(gettext.ngettext("Running '%s' (attempt #%d)",
 
258
                                     "Running '%s' (attempt #%d)", n) %
 
259
                                     (private, n), 5)
257
260
            if not os.system(commandline):
258
261
                return
259
 
            log.Log("Running '%s' failed (attempt #%d)" % (private, n), 1)
 
262
            log.Log(gettext.ngettext("Running '%s' failed (attempt #%d)",
 
263
                                     "Running '%s' failed (attempt #%d)", n) %
 
264
                                     (private, n), 1)
260
265
            time.sleep(30)
261
 
        log.Log("Giving up trying to execute '%s' after %d attempts" % (private, globals.num_retries), 1)
 
266
        log.Log(gettext.ngettext("Giving up trying to execute '%s' after %d attempt",
 
267
                                 "Giving up trying to execute '%s' after %d attempts",
 
268
                                 globals.num_retries) % (private, globals.num_retries),
 
269
                1)
262
270
        raise BackendException("Error running '%s'" % private)
263
271
 
264
272
    def popen(self, commandline):
267
275
        contents read from stdout) as a string.
268
276
        """
269
277
        private = self.munge_password(commandline)
270
 
        log.Log("Reading results of '%s'" % private, 5)
 
278
        log.Log(_("Reading results of '%s'") % private, 5)
271
279
        fout = os.popen(commandline)
272
280
        results = fout.read()
273
281
        if fout.close():
281
289
        """
282
290
        private = self.munge_password(commandline)
283
291
        for n in range(1, globals.num_retries+1):
284
 
            log.Log("Reading results of '%s'" % private, 5)
 
292
            log.Log(_("Reading results of '%s'") % private, 5)
285
293
            fout = os.popen(commandline)
286
294
            results = fout.read()
287
295
            result_status = fout.close()
291
299
                # This squelches the "file not found" result fromm ncftpls when
292
300
                # the ftp backend looks for a collection that does not exist.
293
301
                return ''
294
 
            log.Log("Running '%s' failed (attempt #%d)" % (private, n), 1)
 
302
            log.Log(gettext.ngettext("Running '%s' failed (attempt #%d)",
 
303
                                     "Running '%s' failed (attempt #%d)", n) %
 
304
                                     (private, n), 1)
295
305
            time.sleep(30)
296
 
        log.Log("Giving up trying to execute '%s' after %d attempts" % (private, globals.num_retries), 1)
 
306
        log.Log(gettext.ngettext("Giving up trying to execute '%s' after %d attempt",
 
307
                                 "Giving up trying to execute '%s' after %d attempts",
 
308
                                 globals.num_retries) % (private, globals.num_retries),
 
309
                1)
297
310
        raise BackendException("Error running '%s'" % private)
298
311
 
299
312
    def get_fileobj_read(self, filename, parseresults = None):