[khal] Initial import (#1197445)

Michele Baldessari mbaldessari at fedoraproject.org
Mon Mar 2 19:55:26 UTC 2015


commit b6388c96b6d9a8b26786f2bfdedb56c6d7f444e6
Author: Michele Baldessari <michele at acksyn.org>
Date:   Mon Mar 2 20:55:19 2015 +0100

    Initial import (#1197445)

 .gitignore                                         |   1 +
 ...with-unknow-timezone-but-UNTIL-in-zulu-ti.patch | 102 +++++++++++++++++++
 ...-EXDATEs-with-TZ-info-and-DTSTART-without.patch |  94 +++++++++++++++++
 doc-typo.patch                                     |   9 ++
 fix-man-build.patch                                |  21 ++++
 khal.spec                                          | 113 +++++++++++++++++++++
 sources                                            |   1 +
 sphinx-python3.patch                               |   9 ++
 8 files changed, 350 insertions(+)
---
diff --git a/.gitignore b/.gitignore
index e69de29..c3da797 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/khal-0.4.0.tar.gz
diff --git a/0001-fix-events-with-unknow-timezone-but-UNTIL-in-zulu-ti.patch b/0001-fix-events-with-unknow-timezone-but-UNTIL-in-zulu-ti.patch
new file mode 100644
index 0000000..e8c4f45
--- /dev/null
+++ b/0001-fix-events-with-unknow-timezone-but-UNTIL-in-zulu-ti.patch
@@ -0,0 +1,102 @@
+From 8d6d023891493ecfce5fb3c269bed5420e300646 Mon Sep 17 00:00:00 2001
+From: Christian Geier <geier at lostpackets.de>
+Date: Sun, 15 Feb 2015 01:18:09 +0100
+Subject: [PATCH] fix: events with unknow timezone but UNTIL in zulu time
+
+---
+ CHANGELOG.rst                       |  9 +++++++++
+ khal/khalendar/aux.py               |  2 +-
+ tests/ics/event_dtr_notz_untilz.ics | 11 +++++++++++
+ tests/khalendar_aux_test.py         | 18 ++++++++++++++++++
+ 4 files changed, 39 insertions(+), 1 deletion(-)
+ create mode 100644 tests/ics/event_dtr_notz_untilz.ics
+
+diff --git a/CHANGELOG.rst b/CHANGELOG.rst
+index cd12a88a6680..595a68b7d62b 100644
+--- a/CHANGELOG.rst
++++ b/CHANGELOG.rst
+@@ -7,6 +7,15 @@ Package maintainers and users who have to manually update their installation
+ may want to subscribe to `GitHub's tag feed
+ <https://github.com/geier/khal/tags.atom>`_.
+ 
++0.5.0
++=====
++not yet released
++
++* fixed several bugs relating to events with unknown timezones but UNTIL, RDATE
++  or EXDATE properties that are in Zulu time (thanks to Michele Baldessari for
++  reporting those)
++
++
+ 0.4.0
+ =====
+ released on 2015-02-02
+diff --git a/khal/khalendar/aux.py b/khal/khalendar/aux.py
+index 6a8b050c25b3..42e92610b5f5 100644
+--- a/khal/khalendar/aux.py
++++ b/khal/khalendar/aux.py
+@@ -69,7 +69,7 @@ def expand(vevent, default_tz, href=''):
+             rrule._until = datetime(2037, 12, 31)
+ 
+         if getattr(rrule._until, 'tzinfo', False):
+-            rrule._until = rrule._until.astimezone(events_tz)
++            rrule._until = rrule._until.astimezone(events_tz or default_tz)
+             rrule._until = rrule._until.replace(tzinfo=None)
+ 
+         logger.debug('calculating recurrence dates for {0}, '
+diff --git a/tests/ics/event_dtr_notz_untilz.ics b/tests/ics/event_dtr_notz_untilz.ics
+new file mode 100644
+index 000000000000..b3379deff096
+--- /dev/null
++++ b/tests/ics/event_dtr_notz_untilz.ics
+@@ -0,0 +1,11 @@
++BEGIN:VCALENDAR
++VERSION:2.0
++BEGIN:VEVENT
++UID:273A4F5B7
++RRULE:FREQ=WEEKLY;UNTIL=20121101T035959Z;INTERVAL=2;BYDAY=TH
++SUMMARY:Storage Meeting
++DESCRIPTION:Meeting every other week
++DTSTART;TZID="GMT-05.00/-04.00":20120726T130000
++DTEND;TZID="GMT-05.00/-04.00":20120726T140000
++END:VEVENT
++END:VCALENDAR
+diff --git a/tests/khalendar_aux_test.py b/tests/khalendar_aux_test.py
+index 8b56d7967a74..4796d1d1aa6e 100644
+--- a/tests/khalendar_aux_test.py
++++ b/tests/khalendar_aux_test.py
+@@ -216,6 +216,7 @@ END:VCALENDAR
+ """
+ 
+ berlin = pytz.timezone('Europe/Berlin')
++new_york = pytz.timezone('America/New_York')
+ 
+ 
+ def _get_vevent(event):
+@@ -446,6 +447,23 @@ class TestExpandNoRR(object):
+             berlin.localize(datetime.datetime(2012, 9, 3, 10, 0)),
+         ]
+ 
++    def test_expand_rrule_notz_until_z(self):
++        """event with not understood timezone for dtstart and zulu time form
++        exdate
++        """
++        vevent = _get_vevent_file('event_dtr_notz_untilz')
++        dtstart = aux.expand(vevent, new_york)
++        assert len(dtstart) == 7
++        dtstarts = [start for start, end in dtstart]
++        assert dtstarts == [
++            new_york.localize(datetime.datetime(2012, 7, 26, 13, 0)),
++            new_york.localize(datetime.datetime(2012, 8, 9, 13, 0)),
++            new_york.localize(datetime.datetime(2012, 8, 23, 13, 0)),
++            new_york.localize(datetime.datetime(2012, 9, 6, 13, 0)),
++            new_york.localize(datetime.datetime(2012, 9, 20, 13, 0)),
++            new_york.localize(datetime.datetime(2012, 10, 4, 13, 0)),
++            new_york.localize(datetime.datetime(2012, 10, 18, 13, 0)),
++        ]
+ 
+ vevent_until_notz = """BEGIN:VEVENT
+ SUMMARY:until 20. Februar
+-- 
+2.1.0
+
diff --git a/0001-fix-for-EXDATEs-with-TZ-info-and-DTSTART-without.patch b/0001-fix-for-EXDATEs-with-TZ-info-and-DTSTART-without.patch
new file mode 100644
index 0000000..2272372
--- /dev/null
+++ b/0001-fix-for-EXDATEs-with-TZ-info-and-DTSTART-without.patch
@@ -0,0 +1,94 @@
+From aeb85f69a089bcb08ae7989f96abf89a89cdf9a9 Mon Sep 17 00:00:00 2001
+From: Christian Geier <geier at lostpackets.de>
+Date: Fri, 13 Feb 2015 23:59:49 +0100
+Subject: [PATCH] fix for EXDATEs with TZ info and DTSTART without
+
+The was a problem when DTSTART was localized, but EXDATEs are not (but
+in Zulu time). This is easy to fix, but a problem may arise. If khal
+does not understand the timezone (because icalendar does not yet support
+it) it therefore applies the configured default_timezone. If
+default_timezone is not the proper timezone for this event, the EXDATEs
+will not be removed (but I guess the wrong offset is the bigger problem
+anyway).
+
+The same applies for RDATEs.
+
+this should close #158 on github
+---
+ khal/khalendar/aux.py                 |  5 ++---
+ tests/ics/event_dtr_no_tz_exdatez.ics | 12 ++++++++++++
+ tests/khalendar_aux_test.py           | 16 ++++++++++++++++
+ 3 files changed, 30 insertions(+), 3 deletions(-)
+ create mode 100644 tests/ics/event_dtr_no_tz_exdatez.ics
+
+diff --git a/khal/khalendar/aux.py b/khal/khalendar/aux.py
+index 9875cc9deb93..e5f4d657dabd 100644
+--- a/khal/khalendar/aux.py
++++ b/khal/khalendar/aux.py
+@@ -87,7 +87,7 @@ def expand(vevent, default_tz, href=''):
+         else:
+             rdates = vevent['RDATE']
+         rdates = [leaf.dt for tree in rdates for leaf in tree.dts]
+-        rdates = localize_strip_tz(rdates, events_tz)
++        rdates = localize_strip_tz(rdates, events_tz or default_tz)
+         dtstartl += rdates
+ 
+     # remove excluded dates
+@@ -97,8 +97,7 @@ def expand(vevent, default_tz, href=''):
+         else:
+             exdates = vevent['EXDATE']
+         exdates = [leaf.dt for tree in exdates for leaf in tree.dts]
+-
+-        exdates = localize_strip_tz(exdates, events_tz)
++        exdates = localize_strip_tz(exdates, events_tz or default_tz)
+         dtstartl = [start for start in dtstartl if start not in exdates]
+ 
+     if events_tz is not None:
+diff --git a/tests/ics/event_dtr_no_tz_exdatez.ics b/tests/ics/event_dtr_no_tz_exdatez.ics
+new file mode 100644
+index 000000000000..c5d446e27988
+--- /dev/null
++++ b/tests/ics/event_dtr_no_tz_exdatez.ics
+@@ -0,0 +1,12 @@
++BEGIN:VCALENDAR
++VERSION:2.0
++BEGIN:VEVENT
++UID:5624b646-ba12-4dbd-ba9f-8d66319b0776
++RRULE:FREQ=MONTHLY;COUNT=6
++SUMMARY:Conf Call
++DESCRIPTION:event with not understood timezone for dtstart and zulu time form exdate
++DTSTART;TZID="LOLOLOL":20120403T100000
++DTEND;TZID="LOLOLOL":20120403T103000
++EXDATE:20120603T080000Z
++END:VEVENT
++END:VCALENDAR
+diff --git a/tests/khalendar_aux_test.py b/tests/khalendar_aux_test.py
+index 1984e36c5892..8b56d7967a74 100644
+--- a/tests/khalendar_aux_test.py
++++ b/tests/khalendar_aux_test.py
+@@ -430,6 +430,22 @@ class TestExpandNoRR(object):
+         dtstart = aux.expand(vevent, berlin)
+         assert len(dtstart) == 3
+ 
++    def test_expand_rrule_exdate_z(self):
++        """event with not understood timezone for dtstart and zulu time form
++        exdate
++        """
++        vevent = _get_vevent_file('event_dtr_no_tz_exdatez')
++        dtstart = aux.expand(vevent, berlin)
++        assert len(dtstart) == 5
++        dtstarts = [start for start, end in dtstart]
++        assert dtstarts == [
++            berlin.localize(datetime.datetime(2012, 4, 3, 10, 0)),
++            berlin.localize(datetime.datetime(2012, 5, 3, 10, 0)),
++            berlin.localize(datetime.datetime(2012, 7, 3, 10, 0)),
++            berlin.localize(datetime.datetime(2012, 8, 3, 10, 0)),
++            berlin.localize(datetime.datetime(2012, 9, 3, 10, 0)),
++        ]
++
+ 
+ vevent_until_notz = """BEGIN:VEVENT
+ SUMMARY:until 20. Februar
+-- 
+2.1.0
+
diff --git a/doc-typo.patch b/doc-typo.patch
new file mode 100644
index 0000000..68f8a85
--- /dev/null
+++ b/doc-typo.patch
@@ -0,0 +1,9 @@
+diff -up khal-0.4.0/doc/source/Makefile.typo khal-0.4.0/doc/source/Makefile
+--- khal-0.4.0/doc/source/Makefile.typo	2015-02-04 11:49:30.381208456 +0100
++++ khal-0.4.0/doc/source/Makefile	2015-02-04 11:49:41.646045997 +0100
+@@ -1,4 +1,4 @@
+-configspec.rst: ../../../khal-0.3.1/khal/settings/khal.spec
++configspec.rst: ../../../khal-0.4.0/khal/settings/khal.spec
+ 	python generate_config.py > configspec.rst
+ 
+ .PHONY: configspec.rst
diff --git a/fix-man-build.patch b/fix-man-build.patch
new file mode 100644
index 0000000..f55e2e2
--- /dev/null
+++ b/fix-man-build.patch
@@ -0,0 +1,21 @@
+diff -up khal-0.3.1/doc/source/conf.py.orig khal-0.3.1/doc/source/conf.py
+--- khal-0.3.1/doc/source/conf.py.orig	2014-10-01 22:29:06.509888367 +0200
++++ khal-0.3.1/doc/source/conf.py	2014-10-01 22:29:13.013927679 +0200
+@@ -32,7 +32,7 @@ extensions = [
+     'sphinx.ext.autodoc',
+     'sphinx.ext.intersphinx',
+     'sphinx.ext.todo',
+-    'sphinxcontrib.newsfeed',
++#    'sphinxcontrib.newsfeed',
+ ]
+ 
+ # Add any paths that contain templates here, relative to this directory.
+diff -up khal-0.3.1/doc/source/Makefile.orig khal-0.3.1/doc/source/Makefile
+--- khal-0.3.1/doc/source/Makefile.orig	2014-10-01 22:24:12.093095652 +0200
++++ khal-0.3.1/doc/source/Makefile	2014-10-01 22:24:20.971149734 +0200
+@@ -1,4 +1,4 @@
+-configspec.rst: ../../../khal/khal/settings/khal.spec
++configspec.rst: ../../../khal-0.3.1/khal/settings/khal.spec
+ 	python generate_config.py > configspec.rst
+ 
+ .PHONY: configspec.rst
diff --git a/khal.spec b/khal.spec
new file mode 100644
index 0000000..3253ad5
--- /dev/null
+++ b/khal.spec
@@ -0,0 +1,113 @@
+# Invoke with "--with tests" to enable tests
+# Currently disabled by default as it requires network by default
+%bcond_with tests
+
+Name:       khal
+Version:    0.4.0
+Release:    10%{?git_tag}%{?dist}
+Summary:    CLI calendar application
+
+License:    MIT
+URL:        https://github.com/geier/%{name}
+Source0:    https://github.com/geier/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
+# In theory documentation requires sphinxcontrib.newsfeed to generate
+# a blog of the changelog. We only need the manpage. We also fix a Makefile error
+# which happens when using .tar.gz
+Patch0:     fix-man-build.patch
+Patch1:     doc-typo.patch
+Patch2:     0001-fix-for-EXDATEs-with-TZ-info-and-DTSTART-without.patch
+Patch3:     0001-fix-events-with-unknow-timezone-but-UNTIL-in-zulu-ti.patch
+Patch4:     sphinx-python3.patch
+BuildArch:  noarch
+
+BuildRequires:  python-devel
+BuildRequires:  python-configobj
+BuildRequires:  python-setuptools
+BuildRequires:  python-sphinx
+
+Requires:       python-click >= 3.2
+Requires:       python-dateutil
+Requires:       python-configobj
+Requires:       python-urwid
+Requires:       python-tzlocal
+Requires:       vdirsyncer >= 0.4.3-5
+
+%description
+Khal is a standards based CLI (console) calendar program. CalDAV compatibility
+is achieved by using vdir/vdirsyncer as a back-end, allowing syncing of
+calendars with a variety of other programs on a host of different platforms.
+
+%prep
+%setup -q
+%patch0 -p1 -b .man
+%patch1 -p1 -b .typo
+%patch2 -p1 -b .tzerror
+%patch3 -p1 -b .tzerror2
+#patch4 -p1 -b .py3
+
+%build
+%{__python} setup.py --quiet build
+cd doc
+# Not using _smp_flags as sphinx barfs with it from time to time
+make SPHINXBUILD=sphinx-build man html text
+cd ..
+
+%install
+%{__python} setup.py --quiet install -O1 --skip-build --root $RPM_BUILD_ROOT
+install -d "$RPM_BUILD_ROOT%{_mandir}/man1"
+cp -r doc/build/man/%{name}.1 "$RPM_BUILD_ROOT%{_mandir}/man1"
+# Remove extra copy of text docs
+rm -vrf doc/build/html/_sources
+rm -fv doc/build/html/{.buildinfo,objects.inv}
+
+%check
+# needs python3-tox bz #1010767
+%if %{with tests}
+tox -e py27
+%endif
+
+
+%files
+%doc COPYING AUTHORS.txt README.rst CONTRIBUTING.txt khal.conf.sample doc/build/html doc/build/text
+%{python_sitelib}/*
+%{_bindir}/ikhal
+%{_bindir}/khal
+%{_mandir}/man1/%{name}.1.*
+
+%changelog
+* Mon Mar 02 2015 Michele Baldessari <michele at redhat.com> - 0.4.0-10
+- Fix build
+
+* Mon Mar 02 2015 Michele Baldessari <michele at redhat.com> - 0.4.0-9
+- Disable python3 port until khal supports it fully
+
+* Sun Mar 01 2015 Michele Baldessari <michele at redhat.com> - 0.4.0-8
+- Fix broken build
+
+* Sun Mar 01 2015 Michele Baldessari <michele at redhat.com> - 0.4.0-7
+- Port to python3
+
+* Sun Mar 01 2015 Michele Baldessari <michele at redhat.com> - 0.4.0-6
+- Fix check section and make it work when run with tests enabled
+
+* Sun Feb 15 2015 Michele Baldessari <michele at redhat.com> - 0.4.0-5
+- Apply proper upstream fix for issue 159
+
+* Sat Feb 14 2015 Michele Baldessari <michele at redhat.com> - 0.4.0-4
+- Fix for issue https://github.com/geier/khal/issues/158
+- Temp fix for issue 159
+
+* Tue Feb 10 2015 Michele Baldessari <michele at redhat.com> - 0.4.0-3
+- Add documentation
+
+* Wed Feb 04 2015 Michele Baldessari <michele at redhat.com> - 0.4.0-2
+- Fix the doc build
+
+* Tue Feb 03 2015 Michele Baldessari <michele at redhat.com> - 0.4.0-1
+- New upstream
+
+* Mon Jan 05 2015 Michele Baldessari <michele at redhat.com> - 0.3.1-2
+- Fixed some missing requires
+
+* Wed Oct 01 2014 Michele Baldessari <michele at redhat.com> - 0.3.1-1
+- Initial packaging
diff --git a/sources b/sources
index e69de29..4bc5bea 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+724e67506fe71f8410a31746c8919e46  khal-0.4.0.tar.gz
diff --git a/sphinx-python3.patch b/sphinx-python3.patch
new file mode 100644
index 0000000..b09ebb7
--- /dev/null
+++ b/sphinx-python3.patch
@@ -0,0 +1,9 @@
+diff -up khal-0.4.0/doc/source/Makefile.py3 khal-0.4.0/doc/source/Makefile
+--- khal-0.4.0/doc/source/Makefile.py3	2015-03-01 23:42:23.725340262 +0100
++++ khal-0.4.0/doc/source/Makefile	2015-03-01 23:42:29.867383436 +0100
+@@ -1,4 +1,4 @@
+ configspec.rst: ../../../khal-0.4.0/khal/settings/khal.spec
+-	python generate_config.py > configspec.rst
++	python3 generate_config.py > configspec.rst
+ 
+ .PHONY: configspec.rst


More information about the scm-commits mailing list