public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [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
@ 2010-04-25 17:58 Joe Sapp (nixphoeni)
  0 siblings, 0 replies; only message in thread
From: Joe Sapp (nixphoeni) @ 2010-04-25 17:58 UTC (permalink / raw
  To: gentoo-commits

nixphoeni    10/04/25 17:58:12

  Added:                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
  Log:
  Added an ebuild to include additional bugfixes from the mailing list
  (Portage version: 2.1.8.3/cvs/Linux x86_64)

Revision  Changes    Path
1.1                  dev-python/icalendar/files/01_all_UIDGenerator-fix.patch

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/icalendar/files/01_all_UIDGenerator-fix.patch?rev=1.1&view=markup
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

Index: 01_all_UIDGenerator-fix.patch
===================================================================
--- src/icalendar/tools.py
+++ src/icalendar/tools.py
@@ -1,5 +1,6 @@
 from string import ascii_letters, digits
 import random
+from datetime import datetime

 """
 This module contains non-essential tools for iCalendar. Pretty thin so far eh?
@@ -42,9 +43,9 @@
         datetime-uniquevalue at host. Like:
         20050105T225746Z-HKtJMqUgdO0jDUwm at example.com
         """
-        from PropertyValues import vText, vDatetime
+        from icalendar.prop import vText, vDatetime
         unique = unique or self.rnd_string()
-        return vText('%s-%s@%s' % (vDatetime.today().ical(), unique, host_name))
+        return vText('%s-%s@%s' % (vDatetime(datetime.today()).ical(), unique, host_name))


 if __name__ == "__main__":




1.1                  dev-python/icalendar/files/06_all_test.py-use-set.patch

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
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

Index: 06_all_test.py-use-set.patch
===================================================================
--- test.py.orig	2010-04-25 09:19:36.000000000 -0400
+++ test.py	2010-04-25 09:26:23.000000000 -0400
@@ -77,7 +77,6 @@
 import traceback
 import linecache
 import pdb
-from sets import Set
 
 __metaclass__ = type
 
@@ -261,7 +260,7 @@
     """Returns a set of test case classes used in a test suite."""
     if not isinstance(suite, unittest.TestSuite):
         raise TypeError('not a TestSuite', suite)
-    results = Set()
+    results = set()
     for test in suite._tests:
         if isinstance(test, unittest.TestCase):
             results.add(test.__class__)
@@ -293,7 +292,7 @@
         if test_suite is None:
             continue
         if cfg.warn_omitted:
-            all_classes = Set(get_all_test_cases(module))
+            all_classes = set(get_all_test_cases(module))
             classes_in_suite = get_test_classes_from_testsuite(test_suite)
             difference = all_classes - classes_in_suite
             for test_class in difference:
@@ -320,7 +319,7 @@
 def get_test_hooks(test_files, cfg, tracer=None):
     """Returns a list of test hooks from a given list of test modules."""
     results = []
-    dirs = Set(map(os.path.dirname, test_files))
+    dirs = set(map(os.path.dirname, test_files))
     for dir in list(dirs):
         if os.path.basename(dir) == 'ftests':
             dirs.add(os.path.join(os.path.dirname(dir), 'tests'))



1.1                  dev-python/icalendar/files/03_all_duration-fix.patch

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/icalendar/files/03_all_duration-fix.patch?rev=1.1&view=markup
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

Index: 03_all_duration-fix.patch
===================================================================
--- src/icalendar/prop.py.old	Mon Dec 14 13:43:50 2009
+++ src/icalendar/prop.py	Tue Jan 19 15:09:58 2010
@@ -57,7 +57,7 @@
 TIME_PART = r'T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?'
 DATETIME_PART = '(?:%s)?(?:%s)?' % (DATE_PART, TIME_PART)
 WEEKS_PART = r'(\d+)W'
-DURATION_REGEX = re.compile(r'([-+]?)P(?:%s|%s)$'
+DURATION_REGEX = re.compile(r'([-+]?)P(?:%s)?(?:%s)?$'
                             % (WEEKS_PART, DATETIME_PART))
 WEEKDAY_RULE = re.compile('(?P<signal>[+-]?)(?P<relative>[\d]?)'
                           '(?P<weekday>[\w]{2})$')
@@ -467,14 +467,14 @@
         """
         try:
             match = DURATION_REGEX.match(ical)
+            if not any(match.groups()):
+                raise ValueError()
             sign, weeks, days, hours, minutes, seconds = match.groups()
-            if weeks:
-                value = timedelta(weeks=int(weeks))
-            else:
-                value = timedelta(days=int(days or 0),
-                                  hours=int(hours or 0),
-                                  minutes=int(minutes or 0),
-                                  seconds=int(seconds or 0))
+            value = timedelta(weeks=int(weeks or 0),
+                              days=int(days or 0),
+                              hours=int(hours or 0),
+                              minutes=int(minutes or 0),
+                              seconds=int(seconds or 0))
             if sign == '-':
                 value = -value
             return value



1.1                  dev-python/icalendar/files/05_all_utf8-multi-octet-fix.patch

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
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

Index: 05_all_utf8-multi-octet-fix.patch
===================================================================
From http://codespeak.net/pipermail/icalendar-dev/2010-April/000152.html:

Lines get folded in the middle of multi-octet sequences (checked out
code from svn today). Consider this case:
import icalendar
ical = icalendar.Calendar()
ical.add('summary', u'a' + u'ą'*100)
ical.as_string().decode('utf-8')
...
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 90-91:
invalid data

I have attached a diff of a simple one-line fix.

As I see in the code you actually try not to split a multi-octet
character but you don't recalculate the slice after finding the new
end position. Could you confirm this?

Submitted by Rimvydas Naktinis.
===================================================================
--- src/icalendar/parser.py (revision 73587)
+++ src/icalendar/parser.py (working copy)
@@ -456,6 +456,7 @@
                     else:
                         end -= 1
 
+            slice = self[start:end]
             new_lines.append(slice)
             if end == l_line:
                 # Done



1.1                  dev-python/icalendar/files/04_all_date-type-test-in-vDDDTypes.patch

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
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

Index: 04_all_date-type-test-in-vDDDTypes.patch
===================================================================
--- src/icalendar/prop.py.orig	2010-03-29 21:05:47.000000000 -0400
+++ src/icalendar/prop.py	2010-03-29 21:01:47.000000000 -0400
@@ -585,7 +585,7 @@
                 wrong_type_used = 0
         if wrong_type_used:
             raise ValueError ('You must use datetime, date or timedelta')
-        if isinstance(dt, date):
+        if type(dt) is date:
             self.params = Parameters(dict(value='DATE'))
 
         self.dt = dt
--- src/icalendar/cal.py.orig	2009-12-14 08:43:50.000000000 -0500
+++ src/icalendar/cal.py	2010-04-25 09:11:44.000000000 -0400
@@ -520,7 +520,7 @@
     >>> event.set('dtstart', datetime(2005,4,4,8,0,0))
     >>> cal.add_component(event)
     >>> cal.subcomponents[0].as_string()
-    'BEGIN:VEVENT\\r\\nDTSTART;VALUE=DATE:20050404T080000\\r\\nSUMMARY:Python meeting about calendaring\\r\\nUID:42\\r\\nEND:VEVENT\\r\\n'
+    'BEGIN:VEVENT\\r\\nDTSTART:20050404T080000\\r\\nSUMMARY:Python meeting about calendaring\\r\\nUID:42\\r\\nEND:VEVENT\\r\\n'
 
     Write to disc
     >>> import tempfile, os



1.1                  dev-python/icalendar/files/02_all_vDatetime-tzinfo-fix.patch

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/icalendar/files/02_all_vDatetime-tzinfo-fix.patch?rev=1.1&view=markup
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

Index: 02_all_vDatetime-tzinfo-fix.patch
===================================================================
From http://codespeak.net/pipermail/icalendar-dev/2009-July/000139.html:

SUMMARY: The encoding mechanism of vDatetime handles tzinfo fields
incorrectly (specifically with respect to daylight savings time).
Attached is a simple patch that makes it work.

DETAILS: Currently vDatetime.ical() tries to compute the utcoffset of
the tzinfo, and then subtract that offset.  This approach is valid,
but the computation of the utcoffset is wrong, because it's done relative
to datetime.now() instead of the actual datetime object (self.dt)
to be converted.  This is an issue for timezones whose utcoffset varies
throughout the year, e.g., from daylight savings time.
Replacing datetime.now() with self.dt would fix the code,
but I opted to use the builtin 'asttimezone' method
because it's slightly simpler.

Submitted by Erik Demaine.
===================================================================
--- src/icalendar/prop.py.orig	2009-12-14 08:43:50.000000000 -0500
+++ src/icalendar/prop.py	2009-12-20 12:41:28.000000000 -0500
@@ -309,8 +309,7 @@
 
     def ical(self):
         if self.dt.tzinfo:
-            utc_time = self.dt - self.dt.tzinfo.utcoffset(datetime.now())
-            return utc_time.strftime("%Y%m%dT%H%M%SZ")
+            return self.dt.astimezone (UTC).strftime("%Y%m%dT%H%M%SZ")
         return self.dt.strftime("%Y%m%dT%H%M%S")
 
     def from_ical(ical):






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-04-25 17:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-25 17:58 [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 Joe Sapp (nixphoeni)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox