forked from pool/python-caldav
- Add drop-python2-support.patch to remove python-six dependency
gh#python-caldav/caldav#228
- Remove python_module macro definition
- Update to 0.10.0
## Quick summary
* Work on a universal search method
* Refactoring, consolidated lots of slightly duplicated code into one
method to rule them all
* Support for things needed by the calendar-cli utility, like search by
categories
* Support for completion of recurring tasks
* More utilities for tasks
* Uncomplete-method ... for undoing the complete (recurrences not supported
though)
* get/set duration/dtstart/dtend (arguably this belongs to vobject and/or
icalendar)
* Other improvements:
* picklable URLs
* display_name convenience method
* possible to set child/parent relationships
* Potential bugfix: sequence number may need to be increased when saving
something to the calendar (not backported, this may have side effects)
## Search method
Calendar now has a method search. Here is some information from the
docstring:
Parameters supported:
* xml - use this search query, and ignore other filter parameters
* comp_class - set to event, todo or journal to restrict search to this
resource type. Some server implementations require this to be set.
* todo - sets comp_class to Todo, and restricts search to pending tasks,
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-caldav?expand=0&rev=24
This commit is contained in:
274
drop-python2-support.patch
Normal file
274
drop-python2-support.patch
Normal file
@@ -0,0 +1,274 @@
|
||||
Index: caldav-0.10.0/caldav/davclient.py
|
||||
===================================================================
|
||||
--- caldav-0.10.0.orig/caldav/davclient.py
|
||||
+++ caldav-0.10.0/caldav/davclient.py
|
||||
@@ -4,7 +4,6 @@ import logging
|
||||
import re
|
||||
|
||||
import requests
|
||||
-import six
|
||||
from caldav.elements import cdav
|
||||
from caldav.elements import dav
|
||||
from caldav.elements import ical
|
||||
@@ -21,10 +20,7 @@ from caldav.objects import ScheduleInbox
|
||||
from caldav.objects import ScheduleOutbox
|
||||
from lxml import etree
|
||||
|
||||
-if six.PY3:
|
||||
- from urllib.parse import unquote
|
||||
-else:
|
||||
- from urlparse import unquote
|
||||
+from urllib.parse import unquote
|
||||
|
||||
|
||||
class DAVResponse:
|
||||
Index: caldav-0.10.0/caldav/elements/base.py
|
||||
===================================================================
|
||||
--- caldav-0.10.0.orig/caldav/elements/base.py
|
||||
+++ caldav-0.10.0/caldav/elements/base.py
|
||||
@@ -3,7 +3,6 @@
|
||||
from caldav.lib.namespace import nsmap
|
||||
from caldav.lib.python_utilities import to_unicode
|
||||
from lxml import etree
|
||||
-from six import PY3
|
||||
|
||||
|
||||
class BaseElement(object):
|
||||
@@ -30,9 +29,7 @@ class BaseElement(object):
|
||||
utf8 = etree.tostring(
|
||||
self.xmlelement(), encoding="utf-8", xml_declaration=True, pretty_print=True
|
||||
)
|
||||
- if PY3:
|
||||
- return str(utf8, "utf-8")
|
||||
- return utf8
|
||||
+ return str(utf8, "utf-8")
|
||||
|
||||
def xmlelement(self):
|
||||
root = etree.Element(self.tag, nsmap=nsmap)
|
||||
Index: caldav-0.10.0/caldav/lib/python_utilities.py
|
||||
===================================================================
|
||||
--- caldav-0.10.0.orig/caldav/lib/python_utilities.py
|
||||
+++ caldav-0.10.0/caldav/lib/python_utilities.py
|
||||
@@ -1,53 +1,31 @@
|
||||
-from six import PY3
|
||||
-from six import string_types
|
||||
-
|
||||
-
|
||||
-def isPython3():
|
||||
- """Deprecated. Use six.PY3"""
|
||||
- return PY3
|
||||
-
|
||||
-
|
||||
def to_wire(text):
|
||||
- if text is not None and isinstance(text, string_types) and PY3:
|
||||
+ if text is not None and isinstance(text, str):
|
||||
text = bytes(text, "utf-8")
|
||||
- elif not PY3:
|
||||
- text = to_unicode(text).encode("utf-8")
|
||||
return text
|
||||
|
||||
|
||||
def to_local(text):
|
||||
- if text is not None and not isinstance(text, string_types):
|
||||
+ if text is not None and not isinstance(text, str):
|
||||
text = text.decode("utf-8")
|
||||
return text
|
||||
|
||||
|
||||
def to_str(text):
|
||||
- if text and not isinstance(text, string_types):
|
||||
+ if text and not isinstance(text, str):
|
||||
text = text.decode("utf-8")
|
||||
return text
|
||||
|
||||
|
||||
def to_normal_str(text):
|
||||
"""
|
||||
- A str object is a unicode on python3 and a byte string on python2.
|
||||
- Make sure we return a normal string, no matter what version of
|
||||
- python ...
|
||||
+ Make sure we return a normal string
|
||||
"""
|
||||
- if PY3 and text and not isinstance(text, str):
|
||||
+ if text and not isinstance(text, str):
|
||||
text = text.decode("utf-8")
|
||||
- elif not PY3 and text and not isinstance(text, str):
|
||||
- text = text.encode("utf-8")
|
||||
return text
|
||||
|
||||
|
||||
def to_unicode(text):
|
||||
- if (
|
||||
- text
|
||||
- and isinstance(text, string_types)
|
||||
- and not PY3
|
||||
- and not isinstance(text, unicode)
|
||||
- ):
|
||||
- return unicode(text, "utf-8")
|
||||
- if PY3 and text and isinstance(text, bytes):
|
||||
+ if text and isinstance(text, bytes):
|
||||
return text.decode("utf-8")
|
||||
return text
|
||||
Index: caldav-0.10.0/caldav/lib/url.py
|
||||
===================================================================
|
||||
--- caldav-0.10.0.orig/caldav/lib/url.py
|
||||
+++ caldav-0.10.0/caldav/lib/url.py
|
||||
@@ -2,29 +2,15 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
from caldav.lib.python_utilities import to_normal_str
|
||||
from caldav.lib.python_utilities import to_unicode
|
||||
-from six import PY3
|
||||
|
||||
-if PY3:
|
||||
- from urllib.parse import (
|
||||
- ParseResult,
|
||||
- SplitResult,
|
||||
- urlparse,
|
||||
- unquote,
|
||||
- quote,
|
||||
- urlunparse,
|
||||
- )
|
||||
-else:
|
||||
- from urlparse import ParseResult, SplitResult
|
||||
- from urlparse import urlparse, urlunparse
|
||||
- from urllib import unquote, quote
|
||||
-
|
||||
-
|
||||
-def uc2utf8(input):
|
||||
- # argh! this feels wrong, but seems to be needed.
|
||||
- if not PY3 and type(input) == unicode:
|
||||
- return input.encode("utf-8")
|
||||
- else:
|
||||
- return input
|
||||
+from urllib.parse import (
|
||||
+ ParseResult,
|
||||
+ SplitResult,
|
||||
+ urlparse,
|
||||
+ unquote,
|
||||
+ quote,
|
||||
+ urlunparse,
|
||||
+)
|
||||
|
||||
|
||||
class URL:
|
||||
@@ -195,12 +181,12 @@ class URL:
|
||||
raise ValueError("%s can't be joined with %s" % (self, path))
|
||||
|
||||
if path.path[0] == "/":
|
||||
- ret_path = uc2utf8(path.path)
|
||||
+ ret_path = path.path
|
||||
else:
|
||||
sep = "/"
|
||||
if self.path.endswith("/"):
|
||||
sep = ""
|
||||
- ret_path = "%s%s%s" % (self.path, sep, uc2utf8(path.path))
|
||||
+ ret_path = "%s%s%s" % (self.path, sep, path.path)
|
||||
return URL(
|
||||
ParseResult(
|
||||
self.scheme or path.scheme,
|
||||
Index: caldav-0.10.0/setup.py
|
||||
===================================================================
|
||||
--- caldav-0.10.0.orig/setup.py
|
||||
+++ caldav-0.10.0/setup.py
|
||||
@@ -66,7 +66,7 @@ if __name__ == "__main__":
|
||||
packages=find_packages(exclude=["tests"]),
|
||||
include_package_data=True,
|
||||
zip_safe=False,
|
||||
- install_requires=["vobject", "lxml", "requests", "six", "icalendar"]
|
||||
+ install_requires=["vobject", "lxml", "requests", "icalendar"]
|
||||
+ extra_packages,
|
||||
tests_require=test_packages + extra_test_packages,
|
||||
extras_require={
|
||||
Index: caldav-0.10.0/tests/proxy.py
|
||||
===================================================================
|
||||
--- caldav-0.10.0.orig/tests/proxy.py
|
||||
+++ caldav-0.10.0/tests/proxy.py
|
||||
@@ -28,18 +28,11 @@ from types import FrameType
|
||||
|
||||
from caldav.lib.python_utilities import to_local
|
||||
from caldav.lib.python_utilities import to_wire
|
||||
-from six import PY3
|
||||
|
||||
-if PY3:
|
||||
- from urllib import parse
|
||||
- from urllib.parse import urlparse, urlunparse
|
||||
- from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
- from socketserver import ThreadingMixIn
|
||||
-else:
|
||||
- from urlparse import urlparse as parse
|
||||
- from urlparse import urlparse, urlunparse
|
||||
- from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
|
||||
- from SocketServer import ThreadingMixIn
|
||||
+from urllib import parse
|
||||
+from urllib.parse import urlparse, urlunparse
|
||||
+from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
+from socketserver import ThreadingMixIn
|
||||
|
||||
__version__ = "0.3.1"
|
||||
|
||||
Index: caldav-0.10.0/tests/test_caldav.py
|
||||
===================================================================
|
||||
--- caldav-0.10.0.orig/tests/test_caldav.py
|
||||
+++ caldav-0.10.0/tests/test_caldav.py
|
||||
@@ -41,7 +41,6 @@ from caldav.objects import Principal
|
||||
from caldav.objects import Todo
|
||||
from nose.plugins.skip import SkipTest
|
||||
from requests.packages import urllib3
|
||||
-from six import PY3
|
||||
|
||||
from . import compatibility_issues
|
||||
from .conf import caldav_servers
|
||||
@@ -70,10 +69,7 @@ if test_radicale:
|
||||
import radicale.server
|
||||
import socket
|
||||
|
||||
-if PY3:
|
||||
- from urllib.parse import urlparse
|
||||
-else:
|
||||
- from urlparse import urlparse
|
||||
+from urllib.parse import urlparse
|
||||
|
||||
log = logging.getLogger("caldav")
|
||||
|
||||
Index: caldav-0.10.0/tests/test_caldav_unit.py
|
||||
===================================================================
|
||||
--- caldav-0.10.0.orig/tests/test_caldav_unit.py
|
||||
+++ caldav-0.10.0/tests/test_caldav_unit.py
|
||||
@@ -37,15 +37,10 @@ from caldav.objects import FreeBusy
|
||||
from caldav.objects import Journal
|
||||
from caldav.objects import Principal
|
||||
from caldav.objects import Todo
|
||||
-from six import PY3
|
||||
|
||||
|
||||
-if PY3:
|
||||
- from urllib.parse import urlparse
|
||||
- from unittest import mock
|
||||
-else:
|
||||
- from urlparse import urlparse
|
||||
- import mock
|
||||
+from urllib.parse import urlparse
|
||||
+from unittest import mock
|
||||
|
||||
## Some example icalendar data copied from test_caldav.py
|
||||
ev1 = """BEGIN:VCALENDAR
|
||||
@@ -165,14 +160,11 @@ class TestCalDAV:
|
||||
assert response.status == 200
|
||||
assert response.tree is None
|
||||
|
||||
- if PY3:
|
||||
- response = client.put(
|
||||
- "/foo/møøh/bar".encode("utf-8"),
|
||||
- "bringebærsyltetøy 北京 пиво".encode("utf-8"),
|
||||
- {},
|
||||
- )
|
||||
- else:
|
||||
- response = client.put(u"/foo/møøh/bar", "bringebærsyltetøy 北京 пиво", {}) # fmt: skip
|
||||
+ response = client.put(
|
||||
+ "/foo/møøh/bar".encode("utf-8"),
|
||||
+ "bringebærsyltetøy 北京 пиво".encode("utf-8"),
|
||||
+ {},
|
||||
+ )
|
||||
assert response.status == 200
|
||||
assert response.tree is None
|
||||
|
||||
Reference in New Issue
Block a user