Gentoo Archives: gentoo-commits

From: "Joe Sapp (nixphoeni)" <nixphoeni@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-python/icalendar/files: 01_all_UIDGenerator-fix.patch 06_all_test.py-use-set.patch 03_all_duration-fix.patch 05_all_utf8-multi-octet-fix.patch 04_all_date-type-test-in-vDDDTypes.patch 02_all_vDatetime-tzinfo-fix.patch
Date: Sun, 25 Apr 2010 17:58:15
Message-Id: 20100425175812.5F9B22C04C@corvid.gentoo.org
1 nixphoeni 10/04/25 17:58:12
2
3 Added: 01_all_UIDGenerator-fix.patch
4 06_all_test.py-use-set.patch
5 03_all_duration-fix.patch
6 05_all_utf8-multi-octet-fix.patch
7 04_all_date-type-test-in-vDDDTypes.patch
8 02_all_vDatetime-tzinfo-fix.patch
9 Log:
10 Added an ebuild to include additional bugfixes from the mailing list
11 (Portage version: 2.1.8.3/cvs/Linux x86_64)
12
13 Revision Changes Path
14 1.1 dev-python/icalendar/files/01_all_UIDGenerator-fix.patch
15
16 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/icalendar/files/01_all_UIDGenerator-fix.patch?rev=1.1&view=markup
17 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/icalendar/files/01_all_UIDGenerator-fix.patch?rev=1.1&content-type=text/plain
18
19 Index: 01_all_UIDGenerator-fix.patch
20 ===================================================================
21 --- src/icalendar/tools.py
22 +++ src/icalendar/tools.py
23 @@ -1,5 +1,6 @@
24 from string import ascii_letters, digits
25 import random
26 +from datetime import datetime
27
28 """
29 This module contains non-essential tools for iCalendar. Pretty thin so far eh?
30 @@ -42,9 +43,9 @@
31 datetime-uniquevalue at host. Like:
32 20050105T225746Z-HKtJMqUgdO0jDUwm at example.com
33 """
34 - from PropertyValues import vText, vDatetime
35 + from icalendar.prop import vText, vDatetime
36 unique = unique or self.rnd_string()
37 - return vText('%s-%s@%s' % (vDatetime.today().ical(), unique, host_name))
38 + return vText('%s-%s@%s' % (vDatetime(datetime.today()).ical(), unique, host_name))
39
40
41 if __name__ == "__main__":
42
43
44
45
46 1.1 dev-python/icalendar/files/06_all_test.py-use-set.patch
47
48 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/icalendar/files/06_all_test.py-use-set.patch?rev=1.1&view=markup
49 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/icalendar/files/06_all_test.py-use-set.patch?rev=1.1&content-type=text/plain
50
51 Index: 06_all_test.py-use-set.patch
52 ===================================================================
53 --- test.py.orig 2010-04-25 09:19:36.000000000 -0400
54 +++ test.py 2010-04-25 09:26:23.000000000 -0400
55 @@ -77,7 +77,6 @@
56 import traceback
57 import linecache
58 import pdb
59 -from sets import Set
60
61 __metaclass__ = type
62
63 @@ -261,7 +260,7 @@
64 """Returns a set of test case classes used in a test suite."""
65 if not isinstance(suite, unittest.TestSuite):
66 raise TypeError('not a TestSuite', suite)
67 - results = Set()
68 + results = set()
69 for test in suite._tests:
70 if isinstance(test, unittest.TestCase):
71 results.add(test.__class__)
72 @@ -293,7 +292,7 @@
73 if test_suite is None:
74 continue
75 if cfg.warn_omitted:
76 - all_classes = Set(get_all_test_cases(module))
77 + all_classes = set(get_all_test_cases(module))
78 classes_in_suite = get_test_classes_from_testsuite(test_suite)
79 difference = all_classes - classes_in_suite
80 for test_class in difference:
81 @@ -320,7 +319,7 @@
82 def get_test_hooks(test_files, cfg, tracer=None):
83 """Returns a list of test hooks from a given list of test modules."""
84 results = []
85 - dirs = Set(map(os.path.dirname, test_files))
86 + dirs = set(map(os.path.dirname, test_files))
87 for dir in list(dirs):
88 if os.path.basename(dir) == 'ftests':
89 dirs.add(os.path.join(os.path.dirname(dir), 'tests'))
90
91
92
93 1.1 dev-python/icalendar/files/03_all_duration-fix.patch
94
95 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/icalendar/files/03_all_duration-fix.patch?rev=1.1&view=markup
96 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/icalendar/files/03_all_duration-fix.patch?rev=1.1&content-type=text/plain
97
98 Index: 03_all_duration-fix.patch
99 ===================================================================
100 --- src/icalendar/prop.py.old Mon Dec 14 13:43:50 2009
101 +++ src/icalendar/prop.py Tue Jan 19 15:09:58 2010
102 @@ -57,7 +57,7 @@
103 TIME_PART = r'T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?'
104 DATETIME_PART = '(?:%s)?(?:%s)?' % (DATE_PART, TIME_PART)
105 WEEKS_PART = r'(\d+)W'
106 -DURATION_REGEX = re.compile(r'([-+]?)P(?:%s|%s)$'
107 +DURATION_REGEX = re.compile(r'([-+]?)P(?:%s)?(?:%s)?$'
108 % (WEEKS_PART, DATETIME_PART))
109 WEEKDAY_RULE = re.compile('(?P<signal>[+-]?)(?P<relative>[\d]?)'
110 '(?P<weekday>[\w]{2})$')
111 @@ -467,14 +467,14 @@
112 """
113 try:
114 match = DURATION_REGEX.match(ical)
115 + if not any(match.groups()):
116 + raise ValueError()
117 sign, weeks, days, hours, minutes, seconds = match.groups()
118 - if weeks:
119 - value = timedelta(weeks=int(weeks))
120 - else:
121 - value = timedelta(days=int(days or 0),
122 - hours=int(hours or 0),
123 - minutes=int(minutes or 0),
124 - seconds=int(seconds or 0))
125 + value = timedelta(weeks=int(weeks or 0),
126 + days=int(days or 0),
127 + hours=int(hours or 0),
128 + minutes=int(minutes or 0),
129 + seconds=int(seconds or 0))
130 if sign == '-':
131 value = -value
132 return value
133
134
135
136 1.1 dev-python/icalendar/files/05_all_utf8-multi-octet-fix.patch
137
138 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/icalendar/files/05_all_utf8-multi-octet-fix.patch?rev=1.1&view=markup
139 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/icalendar/files/05_all_utf8-multi-octet-fix.patch?rev=1.1&content-type=text/plain
140
141 Index: 05_all_utf8-multi-octet-fix.patch
142 ===================================================================
143 From http://codespeak.net/pipermail/icalendar-dev/2010-April/000152.html:
144
145 Lines get folded in the middle of multi-octet sequences (checked out
146 code from svn today). Consider this case:
147 import icalendar
148 ical = icalendar.Calendar()
149 ical.add('summary', u'a' + u'ą'*100)
150 ical.as_string().decode('utf-8')
151 ...
152 UnicodeDecodeError: 'utf8' codec can't decode bytes in position 90-91:
153 invalid data
154
155 I have attached a diff of a simple one-line fix.
156
157 As I see in the code you actually try not to split a multi-octet
158 character but you don't recalculate the slice after finding the new
159 end position. Could you confirm this?
160
161 Submitted by Rimvydas Naktinis.
162 ===================================================================
163 --- src/icalendar/parser.py (revision 73587)
164 +++ src/icalendar/parser.py (working copy)
165 @@ -456,6 +456,7 @@
166 else:
167 end -= 1
168
169 + slice = self[start:end]
170 new_lines.append(slice)
171 if end == l_line:
172 # Done
173
174
175
176 1.1 dev-python/icalendar/files/04_all_date-type-test-in-vDDDTypes.patch
177
178 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/icalendar/files/04_all_date-type-test-in-vDDDTypes.patch?rev=1.1&view=markup
179 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/icalendar/files/04_all_date-type-test-in-vDDDTypes.patch?rev=1.1&content-type=text/plain
180
181 Index: 04_all_date-type-test-in-vDDDTypes.patch
182 ===================================================================
183 --- src/icalendar/prop.py.orig 2010-03-29 21:05:47.000000000 -0400
184 +++ src/icalendar/prop.py 2010-03-29 21:01:47.000000000 -0400
185 @@ -585,7 +585,7 @@
186 wrong_type_used = 0
187 if wrong_type_used:
188 raise ValueError ('You must use datetime, date or timedelta')
189 - if isinstance(dt, date):
190 + if type(dt) is date:
191 self.params = Parameters(dict(value='DATE'))
192
193 self.dt = dt
194 --- src/icalendar/cal.py.orig 2009-12-14 08:43:50.000000000 -0500
195 +++ src/icalendar/cal.py 2010-04-25 09:11:44.000000000 -0400
196 @@ -520,7 +520,7 @@
197 >>> event.set('dtstart', datetime(2005,4,4,8,0,0))
198 >>> cal.add_component(event)
199 >>> cal.subcomponents[0].as_string()
200 - 'BEGIN:VEVENT\\r\\nDTSTART;VALUE=DATE:20050404T080000\\r\\nSUMMARY:Python meeting about calendaring\\r\\nUID:42\\r\\nEND:VEVENT\\r\\n'
201 + 'BEGIN:VEVENT\\r\\nDTSTART:20050404T080000\\r\\nSUMMARY:Python meeting about calendaring\\r\\nUID:42\\r\\nEND:VEVENT\\r\\n'
202
203 Write to disc
204 >>> import tempfile, os
205
206
207
208 1.1 dev-python/icalendar/files/02_all_vDatetime-tzinfo-fix.patch
209
210 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/icalendar/files/02_all_vDatetime-tzinfo-fix.patch?rev=1.1&view=markup
211 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/icalendar/files/02_all_vDatetime-tzinfo-fix.patch?rev=1.1&content-type=text/plain
212
213 Index: 02_all_vDatetime-tzinfo-fix.patch
214 ===================================================================
215 From http://codespeak.net/pipermail/icalendar-dev/2009-July/000139.html:
216
217 SUMMARY: The encoding mechanism of vDatetime handles tzinfo fields
218 incorrectly (specifically with respect to daylight savings time).
219 Attached is a simple patch that makes it work.
220
221 DETAILS: Currently vDatetime.ical() tries to compute the utcoffset of
222 the tzinfo, and then subtract that offset. This approach is valid,
223 but the computation of the utcoffset is wrong, because it's done relative
224 to datetime.now() instead of the actual datetime object (self.dt)
225 to be converted. This is an issue for timezones whose utcoffset varies
226 throughout the year, e.g., from daylight savings time.
227 Replacing datetime.now() with self.dt would fix the code,
228 but I opted to use the builtin 'asttimezone' method
229 because it's slightly simpler.
230
231 Submitted by Erik Demaine.
232 ===================================================================
233 --- src/icalendar/prop.py.orig 2009-12-14 08:43:50.000000000 -0500
234 +++ src/icalendar/prop.py 2009-12-20 12:41:28.000000000 -0500
235 @@ -309,8 +309,7 @@
236
237 def ical(self):
238 if self.dt.tzinfo:
239 - utc_time = self.dt - self.dt.tzinfo.utcoffset(datetime.now())
240 - return utc_time.strftime("%Y%m%dT%H%M%SZ")
241 + return self.dt.astimezone (UTC).strftime("%Y%m%dT%H%M%SZ")
242 return self.dt.strftime("%Y%m%dT%H%M%S")
243
244 def from_ical(ical):