[Calypso-commits] [calypso] 01/05: Backport python-vobject compat

Guido Guenther agx at moszumanska.debian.org
Sat Dec 2 19:28:04 UTC 2017


This is an automated email from the git hooks/post-receive script.

agx pushed a commit to branch debian
in repository calypso.

commit 47e0fe08dbff71f65f6006bebf32e265cfb98b24
Author: Guido Günther <agx at sigxcpu.org>
Date:   Sat Dec 2 16:13:52 2017 +0100

    Backport python-vobject compat
    
    This is a3a397e05dca4d46bcaea237af6e5c69e5593059.
    
    Thanks: gregor herrmann for digging this out
    Closes: #861764
---
 .../Newer-python-vobject-return-bytestrings.patch  | 93 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 94 insertions(+)

diff --git a/debian/patches/Newer-python-vobject-return-bytestrings.patch b/debian/patches/Newer-python-vobject-return-bytestrings.patch
new file mode 100644
index 0000000..82dff94
--- /dev/null
+++ b/debian/patches/Newer-python-vobject-return-bytestrings.patch
@@ -0,0 +1,93 @@
+From: =?utf-8?q?Guido_G=C3=BCnther?= <agx at sigxcpu.org>
+Date: Sat, 8 Apr 2017 20:54:56 +0200
+Subject: Newer python-vobject return bytestrings
+
+so decode properly from utf-8.
+
+This unbreaks calypso with newer python-vobject:
+
+    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=841247
+---
+ calypso/webdav.py        | 23 ++++++++++++-----------
+ requirements.txt         |  2 +-
+ tests/test_collection.py |  2 +-
+ 3 files changed, 14 insertions(+), 13 deletions(-)
+
+diff --git a/calypso/webdav.py b/calypso/webdav.py
+index 1bcfecc..d23dfd8 100644
+--- a/calypso/webdav.py
++++ b/calypso/webdav.py
+@@ -376,9 +376,15 @@ class Collection(object):
+         self.log.debug('Wrote %s to %s', file, path)
+         return path
+ 
++    def _action_msg(self, action, item):
++        return u'%s %s' % (action, str(item).decode('utf-8'))
++
++    def _log_action(self, action, item):
++        self.log.debug("%s %s", action, item.name.decode('utf-8'))
++
+     def create_file(self, item, context):
+         # Create directory if necessary
+-        self.log.debug("Add %s", item.name)
++        self._log_action("Add", item)
+         if not os.path.exists(os.path.dirname(self.path)):
+             try:
+                 os.makedirs(os.path.dirname(self.path))
+@@ -386,8 +392,7 @@ class Collection(object):
+                 self.log.exception("Failed to make collection directory %s: %s", self.path, ose)
+                 raise
+ 
+-        context['action'] = u'Add %s'%item
+-
++        context['action'] = self._action_msg("Add", item)
+         try:
+             path = self.write_file(item)
+             self.git_add(path, context=context)
+@@ -401,10 +406,8 @@ class Collection(object):
+             raise
+ 
+     def destroy_file(self, item, context):
+-        self.log.debug("Remove %s", item.name)
+-
+-        context['action'] = u'Remove %s'%item
+-
++        self._log_action("Remove", item)
++        context['action'] = self._action_msg("Remove", item)
+         try:
+             os.unlink(item.path)
+             self.git_rm(item.path, context=context)
+@@ -414,10 +417,8 @@ class Collection(object):
+             raise
+ 
+     def rewrite_file(self, item, context):
+-        self.log.debug("Change %s", item.name)
+-
+-        context['action'] = u'Modify %s'%item
+-
++        self._log_action("Change", item)
++        context['action'] = self._action_msg("Modify", item)
+         try:
+             new_path = self.write_file(item)
+             os.rename(new_path, item.path)
+diff --git a/requirements.txt b/requirements.txt
+index c41513b..31d9cc7 100644
+--- a/requirements.txt
++++ b/requirements.txt
+@@ -1,2 +1,2 @@
+ daemon==1.5.5
+-vobject==0.8.1c
++vobject==0.9.4.1
+diff --git a/tests/test_collection.py b/tests/test_collection.py
+index baa49d9..dac6fd4 100644
+--- a/tests/test_collection.py
++++ b/tests/test_collection.py
+@@ -28,7 +28,7 @@ class TestCollection(unittest.TestCase):
+         collection = Collection("")
+         self.assertTrue(collection.import_file(self.test_vcard))
+         self.assertEqual(len(collection.items), 2)
+-        org = u'Universitetet i Tromsø'
++        org = u'Universitetet i Tromsø'.encode('utf-8')
+         self.assertTrue(org == collection.items[0].object.org.value[0])
+ 
+     def test_uid_with_slash(self):
diff --git a/debian/patches/series b/debian/patches/series
index ee0188f..1b31e89 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 Allow-to-override-calypso-s-config-dir.patch
+Newer-python-vobject-return-bytestrings.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/calypso/calypso.git



More information about the Calypso-commits mailing list