← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~mgorse/duplicity/0.8-series into lp:duplicity

 

Mgorse has proposed merging lp:~mgorse/duplicity/0.8-series into lp:duplicity.

Commit message:
Python3 fixes

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~mgorse/duplicity/0.8-series/+merge/363565
-- 
Your team duplicity-team is requested to review the proposed merge of lp:~mgorse/duplicity/0.8-series into lp:duplicity.
=== modified file 'duplicity/backends/lftpbackend.py'
--- duplicity/backends/lftpbackend.py	2018-11-29 19:00:15 +0000
+++ duplicity/backends/lftpbackend.py	2019-02-22 19:11:51 +0000
@@ -132,12 +132,12 @@
         self.tempfile.write(u"set net:max-retries %s\n" % globals.num_retries)
         self.tempfile.write(u"set ftp:passive-mode %s\n" % self.conn_opt)
         if log.getverbosity() >= log.DEBUG:
-            self.tempfd.write(u"debug\n")
+            self.tempfile.write(u"debug\n")
         if self.parsed_url.scheme == u'ftpes':
             self.tempfile.write(u"open %s %s\n" % (self.authflag, self.url_string.replace(u'ftpes', u'ftp')))
         else:
             self.tempfile.write(u"open %s %s\n" % (self.authflag, self.url_string))
-        os.close(self.tempfd)
+        self.tempfile.close()
         # print settings in debug mode
         if log.getverbosity() >= log.DEBUG:
             f = open(self.tempname, u'r')

=== modified file 'duplicity/lazy.py'
--- duplicity/lazy.py	2018-11-29 19:00:15 +0000
+++ duplicity/lazy.py	2019-02-22 19:11:51 +0000
@@ -206,7 +206,11 @@
 
         def make_iterator(fork_num):
             while(1):
-                yield get_next(fork_num)
+                try:
+                    ret = get_next(fork_num)
+                except StopIteration:
+                    return
+                yield ret
 
         return tuple(map(make_iterator, list(range(num_of_forks))))
 
@@ -230,7 +234,10 @@
         while(1):
             if self.a_leading_by >= 0:
                 # a is in front, add new element
-                elem = next(iter)  # exception will be passed
+                try:
+                    elem = next(iter)
+                except StopIteration:
+                    return
                 buf.append(elem)
             else:
                 # b is in front, subtract an element
@@ -244,7 +251,10 @@
         while(1):
             if self.a_leading_by <= 0:
                 # b is in front, add new element
-                elem = next(iter)  # exception will be passed
+                try:
+                    elem = next(iter)
+                except StopIteration:
+                    return
                 buf.append(elem)
             else:
                 # a is in front, subtract an element

=== modified file 'duplicity/patchdir.py'
--- duplicity/patchdir.py	2018-11-29 19:00:15 +0000
+++ duplicity/patchdir.py	2019-02-22 19:11:51 +0000
@@ -128,7 +128,7 @@
     while 1:
         # This section relevant when a multivol diff is last in tar
         if not tarinfo_list[0]:
-            raise StopIteration
+            return
         if multivol_fileobj and not multivol_fileobj.at_end:
             multivol_fileobj.close()  # aborting in middle of multivol
             continue
@@ -149,7 +149,10 @@
             else:
                 ropath.setfileobj(diff_tarfile.extractfile(tarinfo_list[0]))
         yield ropath
-        tarinfo_list[0] = next(tar_iter)
+        try:
+            tarinfo_list[0] = next(tar_iter)
+        except StopIteration:
+            return
 
 
 def get_index_from_tarinfo(tarinfo):

=== modified file 'duplicity/statistics.py'
--- duplicity/statistics.py	2018-11-29 19:00:15 +0000
+++ duplicity/statistics.py	2019-02-22 19:11:51 +0000
@@ -118,7 +118,7 @@
             if use_repr:
                 # use repr to quote newlines in relative filename, then
                 # take of leading and trailing quote and quote spaces.
-                filename = self.space_regex.sub(u"\\x20", repr(filename))
+                filename = self.space_regex.sub(u"\\\\x20", repr(filename))
                 n = 1
                 if filename[0] == u'u':
                     n = 2

=== modified file 'duplicity/tempdir.py'
--- duplicity/tempdir.py	2018-11-29 19:00:15 +0000
+++ duplicity/tempdir.py	2019-02-22 19:11:51 +0000
@@ -174,7 +174,7 @@
         try:
             self.__tempcount = self.__tempcount + 1
             suffix = u"-%d" % (self.__tempcount,)
-            filename = tempfile.mktemp(suffix, u"mktemp-", util.fsdecode(self.__dir))
+            filename = util.fsencode(tempfile.mktemp(suffix, u"mktemp-", self.__dir))
 
             log.Debug(_(u"Registering (mktemp) temporary file %s") % util.fsdecode(filename))
             self.__pending[filename] = None


Follow ups