Comment 3 for bug 1877885

Revision history for this message
José L. Domingo López (ubuntu-24x7linux) wrote :

Hi, attached "patch" has been created on top of Ubuntu 20.04 LTS "duplicity" 0.8.11.1612-1 package, and running Python 3.8.2.

But it has also been tested and is working in the same way on Ubuntu 19.10 x86_64 with Python 3.7.5, on top of Ubuntu's "duplicity 0.8.04-2ubuntu1" package.

Further to this, used the same backend on a Raspbian GNU/Linux 10 armhf with Python 2.7.16 , on top of Raspbian's "duplicity 0.7.18.2-1" package, and other than removing the reference to "subprocess.check_output / timeout" and "subprocess.TimeoutExpired" (which don't exist in Python earlier than 3.3) the backend also works.

Finally, since the time I submitted this Bug, I made a minor change to the code, to discard "mega-login" progress output, which looks as simple as this:
"""
--- megav2backend.py 2020-05-09 11:05:52.382811192 +0200
+++ megav2backend_v1.1.py 2020-05-17 19:36:23.891145593 +0200
@@ -150,7 +150,7 @@
         except Exception as e:
             cmd = ['mega-login', self._username, self._password]
             try:
- subprocess.check_output(cmd)
+ subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
             except Exception as e:
                 raise BackendException("Could not log in to MEGA, error : '%s'" % (e,))
"""

Other than that, the only "restriction" I have found in the submitted backend is, to workaround "mega-session" sometimes not returning at all, the "mega_login" function does a "subprocess.check_output" with a hardcoded 30 second timeout (timeout=30), which is only available for Python 3.3 and later as far as I know. But I guess at this time in history, Python 3.3 is not precisely bleeding edge and hence will not result in a problem for people resorting to this backend for storing duplicity backups. Can't remember if "stderr=subprocess.DEVNULL" is Python 3.3+ or Python 3.5+ though.