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

« back to all changes in this revision

Viewing changes to duplicity/tempdir.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:
114
114
        """
115
115
        self.__dir = tempfile.mkdtemp("-tempdir", "duplicity-", temproot)
116
116
 
117
 
        log.Log("Using temporary directory %s" % (self.__dir,), 5)
 
117
        log.Log(_("Using temporary directory %s") % (self.__dir,), 5)
118
118
 
119
119
        # number of mktemp()/mkstemp() calls served so far
120
120
        self.__tempcount = 0
150
150
            suffix = "-%d" % (self.__tempcount,)
151
151
            filename = tempfile.mktemp(suffix, "mktemp-", self.__dir)
152
152
 
153
 
            log.Log("Registering (mktemp) temporary file %s" % (filename,), 9)
 
153
            log.Log(_("Registering (mktemp) temporary file %s") % (filename,), 9)
154
154
            self.__pending[filename] = None
155
155
        finally:
156
156
            self.__lock.release()
172
172
            suffix = "-%d" % (self.__tempcount,)
173
173
            fd, filename = tempfile.mkstemp(suffix, "mkstemp-", self.__dir)
174
174
 
175
 
            log.Log("Registering (mkstemp) temporary file %s" % (filename,), 9)
 
175
            log.Log(_("Registering (mkstemp) temporary file %s") % (filename,), 9)
176
176
            self.__pending[filename] = None
177
177
        finally:
178
178
            self.__lock.release()
204
204
        self.__lock.acquire()
205
205
        try:
206
206
            if self.__pending.has_key(fname):
207
 
                log.Log("Forgetting temporary file %s" % (fname, ), 9)
 
207
                log.Log(_("Forgetting temporary file %s") % (fname, ), 9)
208
208
                del(self.__pending[fname])
209
209
            else:
210
 
                log.Log("Attempt to forget unknown tempfile %s - this is probably a bug." % (fname,), 1)
 
210
                log.Log(_("Attempt to forget unknown tempfile %s - this is probably a bug.") % (fname,), 1)
211
211
                pass
212
212
        finally:
213
213
            self.__lock.release()
226
226
            if not self.__dir is None:
227
227
                for file in self.__pending.keys():
228
228
                    try:
229
 
                        log.Log("Removing still remembered temporary file %s" % (file,), 9)
 
229
                        log.Log(_("Removing still remembered temporary file %s") % (file,), 9)
230
230
                        os.unlink(file)
231
231
                    except:
232
 
                        log.Log("Cleanup of temporary file %s failed" % (file,), 7)
 
232
                        log.Log(_("Cleanup of temporary file %s failed") % (file,), 7)
233
233
                        pass
234
234
                try:
235
235
                    os.rmdir(self.__dir)
236
236
                except:
237
 
                    log.Log("Cleanup of temporary directory %s failed - this is probably a bug." % (self.__dir,), 1)
 
237
                    log.Log(_("Cleanup of temporary directory %s failed - this is probably a bug.") % (self.__dir,), 1)
238
238
                    pass
239
239
                self.__pending = None
240
240
                self.__dir = None