From 4c2cfc06f8588ede3a7191859020e01895f2d200 Mon Sep 17 00:00:00 2001 From: Christian Geier Date: Tue, 17 Jul 2018 23:38:48 +0200 Subject: [PATCH 1/5] Dirty fix for dateutil 2.7 --- khal/utils.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/khal/utils.py b/khal/utils.py index cbb493497..a26048d51 100644 --- a/khal/utils.py +++ b/khal/utils.py @@ -322,10 +322,23 @@ def sanitize_datetime(date): dtstart = vevent['DTSTART'].dt if events_tz: dtstart = dtstart.replace(tzinfo=None) + if events_tz and 'Z' not in rrule_param.to_ical().decode(): + logger.warning( + "In event {}, DTSTART has a timezone, but UNTIL does not. This " + "might lead to errenous repeating instances (like missing the " + "last intended instance or adding an extra one)." + "".format(href)) + elif not events_tz and 'Z' in rrule_param.to_ical().decode(): + logger.warning( + "In event {}, DTSTART has no timezone, but UNTIL has one. This " + "might lead to errenous repeating instances (like missing the " + "last intended instance or adding an extra one)." + "".format(href)) rrule = dateutil.rrule.rrulestr( rrule_param.to_ical().decode(), - dtstart=dtstart + dtstart=dtstart, + ignoretz=True, ) if rrule._until is None: @@ -334,10 +347,9 @@ def sanitize_datetime(date): # if python can deal with larger datetime values yet and b) pytz # doesn't know any larger transition times rrule._until = dt.datetime(2037, 12, 31) - elif getattr(rrule._until, 'tzinfo', None): - rrule._until = rrule._until \ - .astimezone(events_tz) \ - .replace(tzinfo=None) + elif events_tz and 'Z' in rrule_param.to_ical().decode(): + rrule._until = pytz.UTC.localize( + rrule._until).astimezone(events_tz).replace(tzinfo=None) rrule = map(sanitize_datetime, rrule) From aee96a7f2925c97513fd89d417251cca7fc52a97 Mon Sep 17 00:00:00 2001 From: Christian Geier Date: Thu, 2 Aug 2018 21:01:59 +0200 Subject: [PATCH 2/5] Test with latest dateutil as well as dateutil<2.7 --- .travis.yml | 4 ++++ tox.ini | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f49b46578..47bd8ac57 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,10 @@ matrix: env: BUILD=pytz201702 - python: 3.6 env: BUILD=pytz_latest + - python: 3.6 + env: BUILD=dateutil26 + - python: 3.6 + env: BUILD=dateutil_latest - python: 3.7 dist: xenial sudo: true diff --git a/tox.ini b/tox.ini index 764ac6dbc..f3e83b455 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = {py34,py35,py36}-{tests,style,mypy}-{pytz201702,pytz201610,pytz_latest} +envlist = {py34,py35,py36}-{tests,style,mypy}-{pytz201702,pytz201610,pytz_latest}-{dateutil26,dateutil_latest} skip_missing_interpreters = True [testenv] @@ -22,6 +22,8 @@ deps = pytz201610: pytz==2016.10 pytz_latest: pytz py34: typing + dateutil26: python-dateutil<2.7 + dateutil_latest: python-dateutil commands = py.test {posargs} From 985fd5c13f63111c0a9f265c8de06b2e5a8427ad Mon Sep 17 00:00:00 2001 From: Christian Geier Date: Mon, 13 Aug 2018 23:16:02 +0200 Subject: [PATCH 3/5] unpinning dateutil <= 2.6.1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d9d1bd45b..309f13357 100755 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ 'urwid', 'pyxdg', 'pytz', - 'python-dateutil<=2.6.1', + 'python-dateutil', 'configobj', # https://github.com/untitaker/python-atomicwrites/commit/4d12f23227b6a944ab1d99c507a69fdbc7c9ed6d # noqa 'atomicwrites>=0.1.7', From 06bbf0a7e9b5d84a7ca0589a106e3e6692bed19a Mon Sep 17 00:00:00 2001 From: Christian Geier Date: Mon, 13 Aug 2018 23:21:26 +0200 Subject: [PATCH 4/5] mark test_repeating as xfail --- tests/cli_test.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/cli_test.py b/tests/cli_test.py index 90d4558d1..105714985 100644 --- a/tests/cli_test.py +++ b/tests/cli_test.py @@ -357,6 +357,8 @@ def test_printformats(runner): assert not result.exception +# "see #810" +@pytest.mark.xfail def test_repeating(runner): runner = runner(days=2) now = dt.datetime.now().strftime('%d.%m.%Y') From e3a83acc9736d3b5f4a02aa318cf47295377dbe5 Mon Sep 17 00:00:00 2001 From: Christian Geier Date: Wed, 19 Sep 2018 20:53:23 +0200 Subject: [PATCH 5/5] Remove note from README about flattr --- README.rst | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.rst b/README.rst index d804e2b22..36b027717 100644 --- a/README.rst +++ b/README.rst @@ -64,13 +64,7 @@ You want to contribute to *khal*? Awesome! The most appreciated way of contributing is by supplying code or documentation, reporting bugs, creating packages for your favorite operating system, making -khal better known by telling your friends about it, etc. If you don't have -the time or the means to contribute in any of the above mentioned ways, -donations are appreciated, too. - -.. image:: https://api.flattr.com/button/flattr-badge-large.png - :alt: flattr button - :target: http://flattr.com/thing/2475065/geierkhal-on-GitHub/ +khal better known by telling your friends about it, etc. License -------