Files
pkgsrc-ng/sysutils/duplicity/patches/patch-ab
2014-11-05 12:41:07 +01:00

46 lines
1.6 KiB
Plaintext

$NetBSD: patch-ab,v 1.1 2013/11/26 20:36:22 drochner Exp $
avoid noise if dropbox-api is not installed
--- duplicity/backends/dpbxbackend.py.orig 2013-08-22 13:30:08.000000000 +0000
+++ duplicity/backends/dpbxbackend.py
@@ -41,7 +41,11 @@ from duplicity import tempdir
from duplicity.backend import retry_fatal
-from dropbox import client, rest, session
+try:
+ from dropbox.session import DropboxSession
+except:
+ class DropboxSession:
+ pass
# This application key is registered in my name (jno at pisem dot net).
# You can register your own developer account with Dropbox and
@@ -100,6 +104,7 @@ def command(login_required=True):
class DPBXBackend(duplicity.backend.Backend):
"""Connect to remote store using Dr*pB*x service"""
def __init__(self, parsed_url):
+ from dropbox import client, rest
duplicity.backend.Backend.__init__(self, parsed_url)
self.sess = StoredSession(etacsufbo(APP_KEY)
@@ -213,7 +218,7 @@ class DPBXBackend(duplicity.backend.Back
resp = self.api_client.file_create_folder(path)
log.Debug('dpbx._mkdir(%s): %s'%(path,resp))
-class StoredSession(session.DropboxSession):
+class StoredSession(DropboxSession):
"""a wrapper around DropboxSession that stores a token to a file on disk"""
TOKEN_FILE = _TOKEN_CACHE_FILE
@@ -254,7 +259,7 @@ class StoredSession(session.DropboxSessi
def unlink(self):
self.delete_creds()
- session.DropboxSession.unlink(self)
+ DropboxSession.unlink(self)
def etacsufbo(s):
return ''.join(reduce(lambda x,y:(x and len(x[-1])==1)and(x.append(y+