summaryrefslogtreecommitdiff
path: root/src/python
diff options
context:
space:
mode:
Diffstat (limited to 'src/python')
-rw-r--r--src/python/CMakeLists.txt72
-rw-r--r--src/python/Collection.py10
-rw-r--r--src/python/Component.py32
-rw-r--r--src/python/Libical.py5
-rw-r--r--src/python/LibicalWrap.i562
-rw-r--r--src/python/LibicalWrap_icaltime.i204
-rw-r--r--src/python/LibicalWrap_icaltimezone.i216
-rw-r--r--src/python/Makefile.am67
-rw-r--r--src/python/Makefile.in527
-rw-r--r--src/python/Period.py34
-rw-r--r--src/python/Property.py33
-rw-r--r--src/python/Time.py59
-rw-r--r--src/python/__init__.py25
-rw-r--r--src/python/test.py39
14 files changed, 1120 insertions, 765 deletions
diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt
index 09ac348..a5a593c 100644
--- a/src/python/CMakeLists.txt
+++ b/src/python/CMakeLists.txt
@@ -1,72 +1,24 @@
-include_directories(${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/libical ${CMAKE_SOURCE_DIR}/src/libicalss )
-
+include_directories(
+ ${CMAKE_SOURCE_DIR}/src
+ ${CMAKE_SOURCE_DIR}/src/libical
+ ${CMAKE_SOURCE_DIR}/src/libicalss
+)
########### next target ###############
-SET(LibicalWrap_LIB_SRCS
- LibicalWrap.c
+set(LibicalWrap_LIB_SRCS
+ LibicalWrap.c
)
-add_library(LibicalWrap SHARED ${LibicalWrap_LIB_SRCS})
+add_library(LibicalWrap ${LIBRARY_TYPE} ${LibicalWrap_LIB_SRCS})
target_link_libraries(LibicalWrap)
-set_target_properties(LibicalWrap PROPERTIES VERSION ${LIBICAL_LIB_VERSION_STRING} SOVERSION ${LIBICAL_LIB_MAJOR_VERSION})
+set_target_properties(LibicalWrap PROPERTIES
+ VERSION ${LIBICAL_LIB_VERSION_STRING}
+ SOVERSION ${LIBICAL_LIB_MAJOR_VERSION}
+)
install(TARGETS LibicalWrap DESTINATION lib)
-
########### install files ###############
-
-
-
-#original Makefile.am contents follow:
-
-#
-#lib_LTLIBRARIES = libLibicalWrap.la
-#
-#libLibicalWrap_la_SOURCES = LibicalWrap.c
-#
-#INCLUDES = \
-# -I$(top_builddir) \
-# -I$(top_srcdir)/src \
-# -I$(top_builddir)/src \
-# -I$(top_srcdir)/src/libical \
-# -I$(top_builddir)/src/libical \
-# -I$(top_srcdir)/src/libicalss \
-# $(PY_CFLAGS)
-#
-#LDADD = ../libical/libical.la ../libicalss/libicalss.la
-#
-#all: LibicalWrap.so
-#
-#LibicalWrap.c: LibicalWrap.i
-# swig -python -o LibicalWrap.c LibicalWrap.i
-#
-## This part should be done with libtool, but I don't know how to do
-## it. Libtool needs to generate a shared library in this directory
-## regardless of the value of AM_DISABLE_SHARED
-#LibicalWrap.so: LibicalWrap.c
-# ld -shared -o LibicalWrap.so LibicalWrap.o ../libical/.libs/libical.a ../libicalss/.libs/libicalss.a
-#
-#CLEANFILES = LibicalWrap.c LibicalWrap_wrap.doc Libical.pyc LibicalWrap.so
-#
-#EXTRA_DIST = \
-#Libical.py \
-#LibicalWrap.i \
-#python-binding.txt \
-#test.py \
-#Attendee.py \
-#Collection.py \
-#Component.py \
-#DerivedProperties.py \
-#Duration.py \
-#Error.py \
-#Gauge.py \
-#Period.py \
-#Property.py \
-#Store.py \
-#Time.py \
-#ChangeLog
-#
-#
diff --git a/src/python/Collection.py b/src/python/Collection.py
index bf6503c..48c3652 100644
--- a/src/python/Collection.py
+++ b/src/python/Collection.py
@@ -100,7 +100,7 @@ class ComponentCollection:
oldComps = self._components[beg:end]
self._components.__setslice__(beg, end, sequence)
for c in sequence:
- self._components.addComponent(c)
+ self._parent.add_component(c)
for c in oldComps:
self._parent.remove_component(c)
@@ -118,7 +118,11 @@ class ComponentCollection:
def __len__(self):
return len(self._components)
-
+
+ def __add__(self, iterable):
+ for i in iterable:
+ self.append(i)
+
def append(self, property):
self._components.append(property)
- self._parent.addComponent(property)
+ self._parent.add_component(property)
diff --git a/src/python/Component.py b/src/python/Component.py
index 9cdcd0d..8f24f54 100644
--- a/src/python/Component.py
+++ b/src/python/Component.py
@@ -37,10 +37,25 @@ import string
WrapperNULL = None
-class Component:
+# Swig objects are natively unhashable, so we hash on the pointer val.
+class SwigRefHash(dict):
+ def __getitem__(self, k):
+ return dict.__getitem__(self, int(k))
+
+ def __setitem__(self, k, v):
+ return dict.__setitem__(self, int(k), v)
+
+ def __delitem__(self, k):
+ dict.__delitem__(self, int(k))
+
+ def has_key(self, k):
+ return dict.has_key(self, int(k))
+
+class Component(object):
def __init__(self,ref=None,kind=None):
+ self._ref = None
if ref != None:
self._ref = ref
elif kind != None:
@@ -54,8 +69,8 @@ class Component:
else:
raise "Could not construct component of kind" + kind
- self.cached_props = {}
- self.cached_comps = {}
+ self.cached_props = SwigRefHash()
+ self.cached_comps = SwigRefHash()
def __del__(self):
if self._ref != None and icalcomponent_get_parent(self._ref) != WrapperNULL:
@@ -73,7 +88,7 @@ class Component:
d = {}
d['value'] = icalproperty_get_value_as_string(p)
- d['name'] = icalproperty_get_name(p)
+ d['name'] = icalproperty_get_property_name(p)
propkind = icalproperty_string_to_kind(d['name'])
kind = icalproperty_kind_to_value_kind(propkind)
@@ -81,6 +96,7 @@ class Component:
d['ref'] = p
+ #~ print p, Property(ref=p).name()
if not self.cached_props.has_key(p):
if d['value_type'] == 'DATE-TIME' or d['value_type'] == 'DATE':
@@ -176,7 +192,7 @@ class Component:
comps.append(comp)
c = icalcomponent_get_next_component(self._ref,kind);
- return comps
+ return ComponentCollection(self, comps)
def inner_component(self):
@@ -213,6 +229,10 @@ class Component:
return icalcomponent_as_ical_string(self._ref)
+ def name(self):
+ k = icalcomponent_isa(self._ref)
+ return icalcomponent_kind_to_string(k)
+
def ref(self):
""" Return the internal reference to the libical icalproperty """
return self._ref
@@ -514,7 +534,7 @@ class GenericComponent(Component):
for alarm in values:
self.add_component(alarm)
else:
- return ComponentCollection(self, self.components('VALARM'))
+ return self.components('VALARM')
####
# Methods that deal with Properties that can occur multiple times are
diff --git a/src/python/Libical.py b/src/python/Libical.py
index 23e3820..5f4aae7 100644
--- a/src/python/Libical.py
+++ b/src/python/Libical.py
@@ -25,12 +25,15 @@
# the License at http://www.mozilla.org/MPL/
#======================================================================
+from LibicalWrap import ICAL_PACKAGE, ICAL_VERSION
from Component import Component, NewComponent, Event, Todo, Journal
from Property import Property, RecurrenceSet, test_enum
-from Time import Time
+from Time import Time, UTC
from Period import Period
from Duration import Duration
from Attendee import Attendee, Organizer
from DerivedProperties import RDate, Trigger,Recurrence_Id, Attach
from Store import Store, FileStore
from Gauge import Gauge
+
+version = ICAL_VERSION
diff --git a/src/python/LibicalWrap.i b/src/python/LibicalWrap.i
index bf3e19c..bc1f199 100644
--- a/src/python/LibicalWrap.i
+++ b/src/python/LibicalWrap.i
@@ -26,428 +26,168 @@
%{
-#include "ical.h"
-#include "icalss.h"
+#include "libical/ical.h"
+#include "libicalss/icalss.h"
#include <sys/types.h> /* for size_t */
#include <time.h>
%}
+%pythoncode %{
+import Error
-#include "fcntl.h" /* For Open flags */
-
-typedef void icalcomponent;
-typedef void icalproperty;
-
-icalcomponent* icalparser_parse_string(char* str);
-
-
-/* actually takes icalcomponent_kind */
-icalcomponent* icalcomponent_new(int kind);
-icalcomponent* icalcomponent_new_clone(icalcomponent* component);
-icalcomponent* icalcomponent_new_from_string(char* str);
-
-const char* icalcomponent_kind_to_string(int kind);
-int icalcomponent_string_to_kind(const char* string);
-
-
-char* icalcomponent_as_ical_string(icalcomponent* component);
-
-void icalcomponent_free(icalcomponent* component);
-int icalcomponent_count_errors(icalcomponent* component);
-void icalcomponent_strip_errors(icalcomponent* component);
-void icalcomponent_convert_errors(icalcomponent* component);
-
-icalproperty* icalcomponent_get_current_property(icalcomponent* component);
-
-icalproperty* icalcomponent_get_first_property(icalcomponent* component,
- int kind);
-icalproperty* icalcomponent_get_next_property(icalcomponent* component,
- int kind);
-
-icalcomponent* icalcomponent_get_current_component (icalcomponent* component);
-
-icalcomponent* icalcomponent_get_first_component(icalcomponent* component,
- int kind);
-icalcomponent* icalcomponent_get_next_component(icalcomponent* component,
- int kind);
-
-void icalcomponent_add_property(icalcomponent* component,
- icalproperty* property);
-
-void icalcomponent_remove_property(icalcomponent* component,
- icalproperty* property);
-
-
-void icalcomponent_add_component(icalcomponent* parent,
- icalcomponent* child);
-
-void icalcomponent_remove_component(icalcomponent* parent,
- icalcomponent* child);
-
-icalcomponent* icalcomponent_get_inner(icalcomponent* comp);
-
-icalcomponent* icalcomponent_get_parent(icalcomponent* component);
-int icalcomponent_isa(icalcomponent* component);
-
-int icalrestriction_check(icalcomponent* comp);
-
-/* actually takes icalproperty_kind */
-icalproperty* icalproperty_new(int kind);
-
-icalproperty* icalproperty_new_from_string(char* str);
-
-char* icalproperty_as_ical_string(icalproperty *prop);
-
-void icalproperty_set_parameter_from_string(icalproperty* prop,
- const char* name, const char* value);
-const char* icalproperty_get_parameter_as_string(icalproperty* prop,
- const char* name);
-void icalproperty_remove_parameter_by_name(icalproperty* prop,
- const char *name);
-
-void icalproperty_set_value_from_string(icalproperty* prop,const char* value, const char * kind);
-
-const char* icalproperty_get_value_as_string(icalproperty* prop);
-icalcomponent* icalproperty_get_parent(icalproperty* property);
-
-const char* icalproperty_kind_to_string(int kind);
-int icalproperty_string_to_kind(const char* string);
-int icalproperty_string_to_enum(const char* str);
-int icalproperty_enum_belongs_to_property(int kind, int e);
-int icalproperty_kind_to_value_kind(int kind);
-
-/* Deal with X properties */
-
-void icalproperty_set_x_name(icalproperty* prop, const char* name);
-const char* icalproperty_get_x_name(icalproperty* prop);
-
-/* Return the name of the property -- the type name converted to a
- string, or the value of _get_x_name if the type is and X property */
-const char* icalproperty_get_name (const icalproperty* prop);
-
-
-int icalerror_supress(const char* error);
-void icalerror_restore(const char* error, int es);
-char* icalerror_perror();
-void icalerror_clear_errno(void);
-
-
-const char* icalvalue_kind_to_string(int kind);
-int icalvalue_string_to_kind(const char* str);
-
-char* icalparameter_as_ical_string(icalparameter* parameter);
-
-const char* icalparameter_kind_to_string(int kind);
-int icalparameter_string_to_kind(const char* string);
-
-int* icallangbind_new_array(int size);
-void icallangbind_free_array(int* array);
-int icallangbind_access_array(int* array, int index);
-
-
-
-/* int icalrecur_expand_recurrence(char* rule, int start,
- int count, int* array);*/
-int icalrecur_expand_recurrence(char* rule, int start,
- int count, time_t* array);
-
-
-/* Iterate through properties, components and parameters using strings for the kind */
-icalproperty* icallangbind_get_first_property(icalcomponent *c,
- const char* prop);
-
-icalproperty* icallangbind_get_next_property(icalcomponent *c,
- const char* prop);
-
-icalcomponent* icallangbind_get_first_component(icalcomponent *c,
- const char* comp);
-
-icalcomponent* icallangbind_get_next_component(icalcomponent *c,
- const char* comp);
-
-icalparameter* icallangbind_get_first_parameter(icalproperty *prop);
-
-icalparameter* icallangbind_get_next_parameter(icalproperty *prop);
-
-
-/* Return a string that can be evaluated in perl or python to
- generated a hash that holds the property's name, value and
- parameters. Sep is the hash seperation string, "=>" for perl and
- ":" for python */
-const char* icallangbind_property_eval_string(icalproperty* prop, char* sep);
-
-int icallangbind_string_to_open_flag(const char* str);
-
-const char* icallangbind_quote_as_ical(const char* str);
-
-/***********************************************************************
- Time routines
-***********************************************************************/
-
-
-struct icaltimetype
-{
- int year;
- int month;
- int day;
- int hour;
- int minute;
- int second;
-};
-
-
-/* Convert seconds past UNIX epoch to a timetype*/
-struct icaltimetype icaltime_from_timet(int v, int is_date);
-
-/** Convert seconds past UNIX epoch to a timetype, using timezones. */
-struct icaltimetype icaltime_from_timet_with_zone(int tm,
- int is_date, icaltimezone *zone);
-
-/* Return the time as seconds past the UNIX epoch */
-/* Normally, this returns a time_t, but SWIG tries to turn that type
- into a pointer */
-int icaltime_as_timet(struct icaltimetype tt);
-
-/* Return a string represention of the time, in RFC2445 format. The
- string is owned by libical */
-char* icaltime_as_ical_string(struct icaltimetype tt);
-
-/* create a time from an ISO format string */
-struct icaltimetype icaltime_from_string(const char* str);
-
-/* Routines for handling timezones */
-/* Return a null time, which indicates no time has been set. This time represent the beginning of the epoch */
-struct icaltimetype icaltime_null_time(void);
-
-/* Return true of the time is null. */
-int icaltime_is_null_time(struct icaltimetype t);
-
-/* Returns false if the time is clearly invalid, but is not null. This
- is usually the result of creating a new time type buy not clearing
- it, or setting one of the flags to an illegal value. */
-int icaltime_is_valid_time(struct icaltimetype t);
-
-/** @brief Return the timezone */
-const icaltimezone *icaltime_get_timezone(const struct icaltimetype t);
-
-/** @brief Return the tzid, or NULL for a floating time */
-char *icaltime_get_tzid(const struct icaltimetype t);
-
-/** @brief Set the timezone */
-struct icaltimetype icaltime_set_timezone(struct icaltimetype *t,
- const icaltimezone *zone);
-
-/* Returns true if time is of DATE type, false if DATE-TIME */
-int icaltime_is_date(struct icaltimetype t);
-
-/* Returns true if time is relative to UTC zone */
-int icaltime_is_utc(struct icaltimetype t);
-
-/* Reset all of the time components to be in their normal ranges. For
- instance, given a time with minutes=70, the minutes will be reduces
- to 10, and the hour incremented. This allows the caller to do
- arithmetic on times without worrying about overflow or
- underflow. */
-struct icaltimetype icaltime_normalize(struct icaltimetype t);
-
-/* Return the day of the year of the given time */
-short icaltime_day_of_year(struct icaltimetype t);
-
-/* Create a new time, given a day of year and a year. */
-struct icaltimetype icaltime_from_day_of_year(short doy, short year);
-
-/* Return the day of the week of the given time. Sunday is 0 */
-short icaltime_day_of_week(struct icaltimetype t);
-
-/* Return the day of the year for the Sunday of the week that the
- given time is within. */
-short icaltime_start_doy_of_week(struct icaltimetype t);
-
-/* Return the week number for the week the given time is within */
-short icaltime_week_number(struct icaltimetype t);
-
-/* Return -1, 0, or 1 to indicate that a<b, a==b or a>b */
-int icaltime_compare(struct icaltimetype a,struct icaltimetype b);
-
-/* like icaltime_compare, but only use the date parts. */
-int icaltime_compare_date_only(struct icaltimetype a, struct icaltimetype b);
-
-/* Return the number of days in the given month */
-short icaltime_days_in_month(short month,short year);
-
-/** convert tt, of timezone tzid, into a utc time. Does nothing if the
- time is already UTC. */
-struct icaltimetype icaltime_convert_to_zone(struct icaltimetype tt,
- icaltimezone *zone);
-
-
-
-/***********************************************************************
- Duration Routines
-***********************************************************************/
-
-
-struct icaldurationtype
-{
- int is_neg;
- unsigned int days;
- unsigned int weeks;
- unsigned int hours;
- unsigned int minutes;
- unsigned int seconds;
-};
-
-struct icaldurationtype icaldurationtype_from_int(int t);
-struct icaldurationtype icaldurationtype_from_string(const char*);
-int icaldurationtype_as_int(struct icaldurationtype duration);
-char* icaldurationtype_as_ical_string(struct icaldurationtype d);
-struct icaldurationtype icaldurationtype_null_duration();
-int icaldurationtype_is_null_duration(struct icaldurationtype d);
-
-struct icaltimetype icaltime_add(struct icaltimetype t,
- struct icaldurationtype d);
-
-struct icaldurationtype icaltime_subtract(struct icaltimetype t1,
- struct icaltimetype t2);
-
-
-/***********************************************************************
- Period Routines
-***********************************************************************/
-
-
-struct icalperiodtype
-{
- struct icaltimetype start;
- struct icaltimetype end;
- struct icaldurationtype duration;
-};
-
-struct icalperiodtype icalperiodtype_from_string (const char* str);
-
-const char* icalperiodtype_as_ical_string(struct icalperiodtype p);
-struct icalperiodtype icalperiodtype_null_period();
-int icalperiodtype_is_null_period(struct icalperiodtype p);
-int icalperiodtype_is_valid_period(struct icalperiodtype p);
-
-/***********************************************************************
- * timezone handling routines
-***********************************************************************/
-
-/** Returns a single builtin timezone, given its Olson city name. */
-icaltimezone* icaltimezone_get_builtin_timezone (const char *location);
-
-/** Returns the UTC timezone. */
-icaltimezone* icaltimezone_get_utc_timezone (void);
-
-/***********************************************************************
- Storage Routines
-***********************************************************************/
-
-/**
- * @brief options for opening an icalfileset.
- *
- * These options should be passed to the icalset_new() function
- */
-
-struct icalfileset_options {
- int flags; /**< flags for open() O_RDONLY, etc */
- mode_t mode; /**< file mode */
- icalcluster *cluster; /**< use this cluster to initialize data */
-};
-
-icalset* icalfileset_new(const char* path);
-icalset* icalfileset_new_reader(const char* path);
-icalset* icalfileset_new_writer(const char* path);
-
-icalset* icalfileset_init(icalset *set, const char *dsn, void* options);
-
-/* icalfileset* icalfileset_new_from_cluster(const char* path, icalcluster *cluster); */
-
-icalcluster* icalfileset_produce_icalcluster(const char *path);
-
-void icalfileset_free(icalset* cluster);
-
-const char* icalfileset_path(icalset* cluster);
-
-/* Mark the cluster as changed, so it will be written to disk when it
- is freed. Commit writes to disk immediately. */
-void icalfileset_mark(icalset* set);
-icalerrorenum icalfileset_commit(icalset* set);
-
-icalerrorenum icalfileset_add_component(icalset* set,
- icalcomponent* child);
-
-icalerrorenum icalfileset_remove_component(icalset* set,
- icalcomponent* child);
-
-int icalfileset_count_components(icalset* set,
- int kind);
-
-/**
- * Restrict the component returned by icalfileset_first, _next to those
- * that pass the gauge. _clear removes the gauge
- */
-icalerrorenum icalfileset_select(icalset* set, icalgauge* gauge);
-
-/** clear the gauge **/
-void icalfileset_clear(icalset* set);
-
-/** Get and search for a component by uid **/
-icalcomponent* icalfileset_fetch(icalset* set, const char* uid);
-int icalfileset_has_uid(icalset* set, const char* uid);
-icalcomponent* icalfileset_fetch_match(icalset* set, icalcomponent *c);
-
-
-/**
- * Modify components according to the MODIFY method of CAP. Works on the
- * currently selected components.
- */
-icalerrorenum icalfileset_modify(icalset* set,
- icalcomponent *oldcomp,
- icalcomponent *newcomp);
-
-/* Iterate through components. If a gauge has been defined, these
- will skip over components that do not pass the gauge */
-
-icalcomponent* icalfileset_get_current_component (icalset* cluster);
-icalcomponent* icalfileset_get_first_component(icalset* cluster);
-icalcomponent* icalfileset_get_next_component(icalset* cluster);
-
-/* External iterator for thread safety */
-icalsetiter icalfileset_begin_component(icalset* set, int kind, icalgauge* gauge);
-icalcomponent * icalfilesetiter_to_next(icalset* set, icalsetiter *iter);
-icalcomponent* icalfileset_form_a_matched_recurrence_component(icalsetiter* itr);
-
-/***********************************************************************
- Gauge Routines
-***********************************************************************/
-
-icalgauge* icalgauge_new_from_sql(char* sql, int expand);
-
-int icalgauge_get_expand(icalgauge* gauge);
-
-void icalgauge_free(icalgauge* gauge);
+%}
-/* Pending Implementation */
-/* char* icalgauge_as_sql(icalcomponent* gauge); */
+%feature("autodoc", "1");
+
+typedef int time_t;
+
+
+// This is declared as an extern, but never used in the library.
+%ignore icalfileset_safe_saves;
+
+
+// Ignore these declarations because there does not exist a definition for them
+%ignore _icalerror_set_errno(icalerrorenum);
+%ignore icalattachtype_add_reference(struct icalattachtype* v);
+%ignore icalattachtype_get_binary(struct icalattachtype* v);
+%ignore icalattachtype_set_binary(struct icalattachtype* v, char* binary,
+ int owns);
+%ignore icalattachtype_get_url(struct icalattachtype* v);
+%ignore icalattachtype_set_url(struct icalattachtype* v, char* url);
+%ignore icalattachtype_free(struct icalattachtype* v);
+%ignore icalattachtype_get_base64(struct icalattachtype* v);
+%ignore icalattachtype_new(void);
+%ignore icalattachtype_set_base64(struct icalattachtype* v, char* base64,
+ int owns);
+%ignore icalclassify_class_to_string(icalproperty_xlicclass c);
+%ignore icalfileset_new_from_cluster(const char* path, icalcluster *cluster);
+%ignore icalgauge_as_sql(icalcomponent* gauge);
+%ignore icalgauge_new_clone(icalgauge* g, icalcomponent* comp);
+%ignore icallangbind_get_component(icalcomponent *c, const char* comp);
+%ignore icallangbind_get_parameter(icalproperty *p, const char* parameter);
+%ignore icallangbind_get_property(icalcomponent *c, int n, const char* prop);
+%ignore icallangbind_get_property_val(icalproperty* p);
+%ignore icalmessage_new_cancel_all(icalcomponent* c,
+ const char* user,
+ const char* msg);
+%ignore icalmessage_new_cancel_event(icalcomponent* c,
+ const char* user,
+ const char* msg);
+%ignore icalmessage_new_cancel_instance(icalcomponent* c,
+ const char* user,
+ const char* msg);
+%ignore icalmime_as_mime_string(char* icalcomponent);
+%ignore icalparameter_is_valid(icalparameter* parameter);
+%ignore icalparser_parse_value(icalvalue_kind kind,
+ const char* str, icalcomponent** errors);
+%ignore icalrecur_iterator_decrement_count(icalrecur_iterator*);
+%ignore icalrestriction_is_parameter_allowed(icalproperty_kind property,
+ icalparameter_kind parameter);
+%ignore icalset_clear_select(icalset* set);
+%ignore icalspanlist_make_free_list(icalspanlist* sl);
+%ignore icalspanlist_make_busy_list(icalspanlist* sl);
+%ignore icalspanlist_next_busy_time(icalspanlist* sl,
+ struct icaltimetype t);
+%ignore icaltime_compare_with_zone(const struct icaltimetype a,
+ const struct icaltimetype b);
+%ignore icaltime_days_in_year (const int year);
+%ignore icaltime_from_string_with_zone(const char* str,
+ const icaltimezone *zone);
+%ignore icaltime_from_week_number(const int week_number,
+ const int year);
+%ignore icaltime_is_floating(const struct icaltimetype t);
+%ignore icaltimezonetype_free(struct icaltimezonetype tzt);
+
+
+// Remove depreciated functions
+%ignore icalproperty_string_to_enum(const char* str);
+%ignore icaltimezone_get_utc_offset(icaltimezone *zone,
+ struct icaltimetype *tt,
+ int *is_daylight);
+%ignore icaltimezone_get_utc_offset_of_utc_time (icaltimezone *zone,
+ struct icaltimetype *tt,
+ int *is_daylight);
+%ignore icaltime_start_doy_of_week(const struct icaltimetype t);
+%ignore icalcomponent_get_span(icalcomponent* comp);
+%ignore icalproperty_remove_parameter(icalproperty* prop, icalparameter_kind kind);
+
+// Can't wrap va_list
+%ignore icalproperty_add_parameters(struct icalproperty_impl *prop, va_list args);
+
+#ifndef _DLOPEN_TEST
+%ignore icalset_register_class(icalset *set);
+#endif
+
+
+//#include "fcntl.h" /* For Open flags */
+%include "libical/ical.h"
+%include "libicalss/icalss.h"
+
+%inline %{
+/* declare some internal functions which are not in the header file. */
+void icalproperty_set_parent(icalproperty* property,
+ icalcomponent* component);
+icalcomponent* icalproperty_get_parent(const icalproperty* property);
+
+void icalvalue_set_parent(icalvalue* value,
+ icalproperty* property);
+icalproperty* icalvalue_get_parent(icalvalue* value);
+
+void icalparameter_set_parent(icalparameter* param,
+ icalproperty* property);
+icalproperty* icalparameter_get_parent(icalparameter* value);
-void icalgauge_dump(icalgauge* gauge);
+%}
-/** @brief Return true if comp matches the gauge.
- *
- * The component must be in
- * cannonical form -- a VCALENDAR with one VEVENT, VTODO or VJOURNAL
- * sub component
- */
-int icalgauge_compare(icalgauge* g, icalcomponent* comp);
+%pythoncode %{
+
+# Helper functions for overriding default swig property methods
+def _swig_set_properties(cls, properties={}):
+ for propname, props in properties.items():
+ if len(props) > 0:
+ cls.__swig_getmethods__[propname] = props[0]
+ if len(props) > 1:
+ cls.__swig_setmethods__[propname] = props[1]
+ # Currently not used by swig
+ if len(props) > 2:
+ cls.__swig_delmethods__[propname] = props[2]
+
+ if _newclass:
+ setattr(cls, propname, _swig_property(*props))
+
+def _swig_remove_private_properties(cls, properties=tuple()):
+ # By default remove all properties
+ if not properties:
+ props = cls.__swig_getmethods__.copy()
+ props.update(cls.__swig_setmethods__)
+ #props.update(cls.__swig_delmethods__)
+ properties = props.keys()
+
+ for propname in properties:
+ if cls.__swig_getmethods__.has_key(propname):
+ del cls.__swig_getmethods__[propname]
+ if cls.__swig_setmethods__.has_key(propname):
+ del cls.__swig_setmethods__[propname]
+ # Currently not used by swig
+ #if cls.__swig_delmethods__.has_key(propname):
+ # del cls.__swig_delmethods__[propname]
+
+ if _newclass and hasattr(cls, propname):
+ delattr(cls, propname)
+
+import new
+def _swig_add_instance_methods(klass, meth_dict={}):
+ for methname, func in meth_dict.items():
+ meth = new.instancemethod(func, None, klass)
+ if not methname: methname = func.__name__
+ func.__name__ = methname
+ setattr(klass, methname, meth)
+%}
-/* Pending Implementation */
-/** Clone the component, but only return the properties
- * specified in the gauge */
-/* icalcomponent* icalgauge_new_clone(icalgauge* g, icalcomponent* comp); */
+%include "LibicalWrap_icaltimezone.i"
+%include "LibicalWrap_icaltime.i"
diff --git a/src/python/LibicalWrap_icaltime.i b/src/python/LibicalWrap_icaltime.i
new file mode 100644
index 0000000..6b44691
--- /dev/null
+++ b/src/python/LibicalWrap_icaltime.i
@@ -0,0 +1,204 @@
+
+/*======================================================================
+ FILE: LibicalWrap_icaltime.i
+
+ (C) COPYRIGHT 2010 Glenn Washburn
+
+ The contents of this file are subject to the Mozilla Public License
+ Version 1.0 (the "License"); you may not use this file except in
+ compliance with the License. You may obtain a copy of the License at
+ http://www.mozilla.org/MPL/
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and
+ limitations under the License.
+
+ The original author is Glenn Washburn (crass@berlios.de)
+
+ Contributions from:
+
+ ======================================================================*/
+
+// Add some methods to the icaltimetype struct
+%extend icaltimetype {
+
+ /* ***** Special methods ***** */
+
+ int __cmp__(const icaltimetype b) { return icaltime_compare(*($self), b); }
+
+ /* ***** Conversion methods ***** */
+
+ const char* as_ical_string() { return icaltime_as_ical_string(*($self)); }
+ time_t as_timet(const icaltimezone *zone=NULL) {
+ return icaltime_as_timet_with_zone(*($self), zone);
+ }
+
+ /* ***** Accessor methods ***** */
+
+ const char *get_tzid() { return icaltime_get_tzid(*($self)); }
+ int day_of_year() { return icaltime_day_of_year(*($self)); }
+ int day_of_week() { return icaltime_day_of_week(*($self)); }
+
+ /** Return the day of the year for the Sunday of the week that the
+ given time is within. */
+ /* int start_doy_of_week() { return icaltime_start_doy_of_week(*($self)); } */
+
+ /** Return the day of the year for the first day of the week that the
+ given time is within. */
+ int start_doy_week(int fdow) {
+ return icaltime_start_doy_week(*($self), fdow);
+ }
+
+ /** Return the week number for the week the given time is within */
+ int week_number() { return icaltime_week_number(*($self)); }
+
+
+ /* ***** Query methods ***** */
+
+ int is_null_time() { return icaltime_is_null_time(*($self)); }
+
+ /** Returns false if the time is clearly invalid, but is not null. This
+ is usually the result of creating a new time type buy not clearing
+ it, or setting one of the flags to an illegal value. */
+ int is_valid_time() { return icaltime_is_valid_time(*($self)); }
+
+ /* is_date and is_utc are both over shadowed by the struct accessors,
+ but they do the same thing. */
+ int is_date() { return icaltime_is_date(*($self)); }
+ int is_utc() { return icaltime_is_utc(*($self)); }
+ /* int is_floating() { return icaltime_is_floating(*($self)); } */
+
+
+ /* ***** Modify, compare and utility methods ***** */
+
+ /** Return -1, 0, or 1 to indicate that a<b, a==b or a>b */
+ int compare(const icaltimetype b) { return icaltime_compare(*($self), b); }
+
+ /** like icaltime_compare, but only use the date parts. */
+ int compare_date_only(const icaltimetype b, icaltimezone *tz=NULL) {
+ if (tz == NULL)
+ tz = icaltimezone_get_utc_timezone();
+ return icaltime_compare_date_only_tz(*($self), b, tz);
+ }
+
+ /** Adds or subtracts a number of days, hours, minutes and seconds. */
+ void adjust(const int days, const int hours, const int minutes, const int seconds) {
+ return icaltime_adjust($self, days, hours, minutes, seconds);
+ }
+
+ /** Normalize the icaltime, so that all fields are within the normal range. */
+ icaltimetype normalize() { return icaltime_normalize(*($self)); }
+
+ icaltimetype convert_to_zone(icaltimezone *zone) {
+ return icaltime_convert_to_zone(*($self), zone);
+ }
+
+ /* ***** Static methods ***** */
+
+ static icaltimetype from_timet(const time_t tm,
+ const int is_date=0, const icaltimezone *zone=NULL) {
+ return icaltime_from_timet_with_zone(tm, is_date, zone);
+ }
+
+ static icaltimetype null_time(void) { return icaltime_null_time(); }
+ static icaltimetype null_date(void) { return icaltime_null_date(); }
+
+ static icaltimetype current_time(const icaltimezone *zone=NULL) {
+ return icaltime_current_time_with_zone(zone);
+ }
+
+ static icaltimetype today(void) { return icaltime_today(); }
+
+#if 0
+ static icaltimetype from_string(const char* str, const icaltimezone *zone=NULL) {
+ /* return _with_zone(str, zone); */
+ (void)zone;
+ return icaltime_from_string(str);
+ }
+#else
+ /* For the time being do not allow specifying a timezone because this
+ is unimplemented as of yet. */
+ static icaltimetype from_string(const char* str) {
+ return icaltime_from_string(str);
+ }
+#endif
+
+ /** Return the number of days in the given month */
+ static int days_in_month(const int month, const int year) {
+ return icaltime_days_in_month(month, year);
+ }
+
+ /** Return whether you've specified a leapyear or not. */
+ static int is_leap_year (const int year) {
+ return icaltime_is_leap_year(year);
+ }
+
+ /** Return the number of days in this year */
+ /* static int days_in_year (const int year) { return icaltime_days_in_year(year); } */
+
+}
+
+// This is a hackish way to support adding the __str__ method to
+// a class in python. Its much easier than writing in C (that
+// I've figured out).
+%pythoncode %{
+
+def __icaltimetype_str__(self):
+ return "<icaltimetype (%d, %d, %d, %d, %d, %d, %d, %d)>" % (
+ self.year, self.month, self.day, self.hour, self.minute,
+ self.second, self.is_date, self.is_daylight)
+icaltimetype.__str__ = __icaltimetype_str__
+
+import datetime
+def icaltimetype_as_datetime(self):
+ "as_datetime() -> returns datetime object"
+ return datetime.datetime(self.year, self.month, self.day, self.hour,
+ self.minute, self.second, 0, self.timezone)
+icaltimetype.as_datetime = icaltimetype_as_datetime
+
+def icaltimetype_from_datetime(dt):
+ "from_datetime() -> returns icaltimetype object"
+ tt = icaltimetype()
+
+ tt.year = dt.year
+ tt.month = dt.month
+ tt.day = dt.day
+ tt.hour = dt.hour
+ tt.minute = dt.minute
+ tt.second = dt.second
+ if dt.tzinfo:
+ # TODO: convert to the right timezone, assume for now we are UTC
+ tt.zone = 0
+ tt.is_utc = True
+ tt.is_date = False
+ tt.isdaylight = False
+
+ return tt
+icaltimetype.from_datetime = staticmethod(icaltimetype_from_datetime)
+
+# Remove accessors to private structure members
+icaltimetype_delprops = ["is_date", "is_utc", "zone"]
+
+_swig_remove_private_properties(icaltimetype, icaltimetype_delprops)
+
+
+# Set/Overwrite icaltimetype properties
+icaltimetype_props = {
+ "zone": (_LibicalWrap.icaltime_get_timezone, _LibicalWrap.icaltime_set_timezone, ),
+ "is_null_time": (_LibicalWrap.icaltime_is_null_time, ),
+ "is_valid_time": (_LibicalWrap.icaltime_is_valid_time, ),
+ # These do essentially the same thing as the default swig generated
+ # accessors is_date and is_utc, but by not defining the setter, we
+ # make them immutable from python
+ "is_date": (_LibicalWrap.icaltime_is_date, ),
+ "is_utc": (_LibicalWrap.icaltime_is_utc, ),
+# "is_floating": (_LibicalWrap.icaltime_is_floating, ),
+}
+
+_swig_set_properties(icaltimetype, icaltimetype_props)
+
+%}
+
+// TODO: Add icaltime_span_* to icaltime_spantype
+
diff --git a/src/python/LibicalWrap_icaltimezone.i b/src/python/LibicalWrap_icaltimezone.i
new file mode 100644
index 0000000..804a59e
--- /dev/null
+++ b/src/python/LibicalWrap_icaltimezone.i
@@ -0,0 +1,216 @@
+
+/*======================================================================
+ FILE: LibicalWrap_icaltimezone.i
+
+ (C) COPYRIGHT 2010 Glenn Washburn
+
+ The contents of this file are subject to the Mozilla Public License
+ Version 1.0 (the "License"); you may not use this file except in
+ compliance with the License. You may obtain a copy of the License at
+ http://www.mozilla.org/MPL/
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and
+ limitations under the License.
+
+ The original author is Glenn Washburn (crass@berlios.de)
+
+ Contributions from:
+
+ ======================================================================*/
+
+%rename(icaltimezone) _icaltimezone;
+
+%inline %{
+#include "libical/icaltimezone.h"
+#include "libical/icaltimezoneimpl.h"
+%}
+%include "libical/icaltimezone.h"
+%include "libical/icaltimezoneimpl.h"
+
+
+%pythoncode %{
+
+import time, datetime
+
+##### Support datetime.tzinfo API #####
+# This is a "good enough" implementation right now. Make better
+# later, if needed.
+class icaltzinfo(datetime.tzinfo):
+ def __init__(self, icaltimezone):
+ self.tz = icaltimezone
+
+ def __cmp__(self, tzinfo):
+ return cmp(self.tz, self.tz)
+
+ def utcoffset(self, dt):
+ timet = time.mktime(dt.timetuple())
+ tt = icaltimetype.from_timet(int(timet),0,None)
+ utcoffset = _LibicalWrap.icaltimezone_get_utc_offset(self.tz, tt, None)
+ return datetime.timedelta(utcoffset)
+
+ def dst(self, dt):
+ # FIXME: Since icaltimezone_get_utc_offset does all the
+ # calc for dst internally and there is not function which
+ # returns what we need here, we'll probably need to partly
+ # reimplement icaltimezone_get_utc_offset
+ return datetime.timedelta(0)
+
+ def tzname(self, dt):
+ return _LibicalWrap.icaltimezone_get_tzid(self.tz)
+
+# def fromutc(self, dt): pass
+
+%}
+
+
+#if 0
+
+/** Sets the prefix to be used for tzid's generated from system tzdata.
+ Must be globally unique (such as a domain name owned by the developer
+ of the calling application), and begin and end with forward slashes.
+ Do not change or de-allocate the string buffer after calling this.
+ */
+void icaltimezone_set_tzid_prefix(const char *new_prefix);
+
+/**
+ * @par Accessing timezones.
+ */
+
+/** Free any builtin timezone information **/
+void icaltimezone_free_builtin_timezones(void);
+
+/** Returns the array of builtin icaltimezones. */
+icalarray* icaltimezone_get_builtin_timezones (void);
+
+/**
+ * @par Converting times between timezones.
+ */
+
+void icaltimezone_convert_time (struct icaltimetype *tt,
+ icaltimezone *from_zone,
+ icaltimezone *to_zone);
+
+
+/**
+ * @par Getting offsets from UTC.
+ */
+
+/** Calculates the UTC offset of a given local time in the given
+ timezone. It is the number of seconds to add to UTC to get local
+ time. The is_daylight flag is set to 1 if the time is in
+ daylight-savings time. */
+int icaltimezone_get_utc_offset (icaltimezone *zone,
+ struct icaltimetype *tt,
+ int *is_daylight);
+
+/** Calculates the UTC offset of a given UTC time in the given
+ timezone. It is the number of seconds to add to UTC to get local
+ time. The is_daylight flag is set to 1 if the time is in
+ daylight-savings time. */
+int icaltimezone_get_utc_offset_of_utc_time (icaltimezone *zone,
+ struct icaltimetype *tt,
+ int *is_daylight);
+
+
+/*
+ * @par Handling the default location the timezone files
+ */
+
+/** Set the directory to look for the zonefiles */
+void set_zone_directory(char *path);
+
+/** Free memory dedicated to the zonefile directory */
+void free_zone_directory(void);
+void icaltimezone_release_zone_tab(void);
+
+/*
+ * @par Debugging Output.
+ */
+
+/** Dumps information about changes in the timezone up to and including
+ max_year. */
+int icaltimezone_dump_changes (icaltimezone *zone,
+ int max_year,
+ FILE *fp);
+
+#endif
+
+
+// Add some methods to the icaltimetype struct
+%extend _icaltimezone {
+
+ /* Might want to change this to somethingmore reasonable,
+ like longitude or utc offset. */
+ int __cmp__(icaltimezone *zone) {
+ return strcmp(icaltimezone_get_tzid($self),
+ icaltimezone_get_tzid(zone));
+ }
+
+}
+
+%pythoncode %{
+
+# Remove accessors to private structure members, which is all of them
+_swig_remove_private_properties(icaltimezone)
+
+def _icaltimezone_set_component_wrap(self, comp):
+ ret = _LibicalWrap.icaltimezone_set_component(self, comp)
+ if not ret:
+ # Not successful, raise an exception because setting a property
+ # has not return value to be checked.
+ raise Error.LibicalError("Failed to set component to timezone")
+
+# Set/Overwrite icaltimezone properties
+icaltimezone_props = {
+ "tzid": (_LibicalWrap.icaltimezone_get_tzid, ),
+ "location": (_LibicalWrap.icaltimezone_get_location, ),
+ "tznames": (_LibicalWrap.icaltimezone_get_tznames, ),
+ "latitude": (_LibicalWrap.icaltimezone_get_latitude, ),
+ "longitude": (_LibicalWrap.icaltimezone_get_longitude, ),
+ "display_name": (_LibicalWrap.icaltimezone_get_display_name, ),
+ "component": (_LibicalWrap.icaltimezone_get_component,
+ _icaltimezone_set_component_wrap, ),
+}
+
+_swig_set_properties(icaltimezone, icaltimezone_props)
+
+# UTC = _LibicalWrap.icaltimezone_get_utc_timezone()
+
+def icaltimezone_copy(self):
+ tz = _LibicalWrap.icaltimezone_copy(self)
+ tz.this.acquire()
+ return tz
+
+def icaltimezone_new(self):
+ # Hand off the underlying pointer by setting the this attribute
+ print "newing icaltimezone"
+ obj = _LibicalWrap.icaltimezone_new()
+ obj.this.acquire()
+ try: self.this.append(obj.this)
+ except: self.this = obj.this
+
+def icaltimezone_delete(self):
+ # do not delete the struct because swig will do this
+ if self.this.own():
+ _LibicalWrap.icaltimezone_free(self, 0)
+
+icaltimezone_methods = {
+ 'as_tzinfo': icaltzinfo,
+ 'copy': icaltimezone_copy,
+ '__init__': icaltimezone_new,
+ '__del__': icaltimezone_delete,
+}
+_swig_add_instance_methods(icaltimezone, icaltimezone_methods)
+
+icaltimezone.get_builtin_timezone = staticmethod(_LibicalWrap.icaltimezone_get_builtin_timezone)
+icaltimezone.get_builtin_timezone_from_offset = staticmethod(_LibicalWrap.icaltimezone_get_builtin_timezone_from_offset)
+icaltimezone.get_builtin_timezone_from_tzid = staticmethod(_LibicalWrap.icaltimezone_get_builtin_timezone_from_tzid)
+
+#icaltimezone.free_builtin_timezones = staticmethod(_LibicalWrap.icaltimezone_free_builtin_timezones)
+#icaltimezone.get_builtin_timezones = staticmethod(_LibicalWrap.icaltimezone_get_builtin_timezones)
+
+
+%}
+
diff --git a/src/python/Makefile.am b/src/python/Makefile.am
index e221fa9..077e03d 100644
--- a/src/python/Makefile.am
+++ b/src/python/Makefile.am
@@ -1,36 +1,12 @@
+# See xapian-bindings for an example of integrating autotools, swig and python
-lib_LTLIBRARIES = libLibicalWrap.la
+BUILT_SOURCES = _LibicalWrap.c
-libLibicalWrap_la_SOURCES = LibicalWrap.c
+pyexec_LTLIBRARIES = _LibicalWrap.la
-INCLUDES = \
- -I$(top_builddir) \
- -I$(top_srcdir)/src \
- -I$(top_builddir)/src \
- -I$(top_srcdir)/src/libical \
- -I$(top_builddir)/src/libical \
- -I$(top_srcdir)/src/libicalss \
- $(PY_CFLAGS)
-
-LDADD = ../libical/libical.la ../libicalss/libicalss.la
-
-all: LibicalWrap.so
-
-LibicalWrap.c: LibicalWrap.i
- swig -python -o LibicalWrap.c LibicalWrap.i
-
-# This part should be done with libtool, but I don't know how to do
-# it. Libtool needs to generate a shared library in this directory
-# regardless of the value of AM_DISABLE_SHARED
-LibicalWrap.so: LibicalWrap.c
- ld -shared -o LibicalWrap.so LibicalWrap.o ../libical/.libs/libical.a ../libicalss/.libs/libicalss.a
-
-CLEANFILES = LibicalWrap.c LibicalWrap_wrap.doc Libical.pyc LibicalWrap.so
-
-EXTRA_DIST = \
+common_FILES = \
+__init__.py \
Libical.py \
-LibicalWrap.i \
-python-binding.txt \
test.py \
Attendee.py \
Collection.py \
@@ -42,7 +18,38 @@ Gauge.py \
Period.py \
Property.py \
Store.py \
-Time.py \
+Time.py
+
+# Install as python source so the code gets byte-compiled at install time.
+pkgpython_PYTHON = \
+$(common_FILES) \
+LibicalWrap.py
+
+# To allow non-standard library names (ie those not prefixed by "lib") see:
+# http://sources.redhat.com/automake/automake.html#Libtool-Modules
+_LibicalWrap_la_SOURCES = _LibicalWrap.c
+_LibicalWrap_la_LDFLAGS = -avoid-version -module -lc
+_LibicalWrap_la_LIBADD = $(top_builddir)/src/libical/libical.la \
+ $(top_builddir)/src/libicalss/libicalss.la
+
+AM_CPPFLAGS = \
+ -I$(top_builddir) \
+ -I$(top_srcdir)/src \
+ -I$(top_builddir)/src \
+ -I$(top_srcdir)/src/libical \
+ -I$(top_builddir)/src/libical \
+ -I$(top_srcdir)/src/libicalss \
+ $(PY_CFLAGS)
+
+_LibicalWrap.c: $(srcdir)/LibicalWrap.i $(srcdir)/*.i $(top_builddir)/src/libical/ical.h $(top_builddir)/src/libicalss/icalss.h
+ swig -python -Wall $(AM_CPPFLAGS) -o _LibicalWrap.c $(srcdir)/LibicalWrap.i
+
+CLEANFILES = _LibicalWrap.c _LibicalWrap_wrap.doc Libical.pyc LibicalWrap.py _LibicalWrap.so
+
+EXTRA_DIST = \
+$(common_FILES) \
+LibicalWrap.i \
+python-binding.txt \
ChangeLog
diff --git a/src/python/Makefile.in b/src/python/Makefile.in
index 1cd1f64..6e5c7eb 100644
--- a/src/python/Makefile.in
+++ b/src/python/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.12.2 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -14,17 +14,31 @@
@SET_MAKE@
-SOURCES = $(libLibicalWrap_la_SOURCES)
+# See xapian-bindings for an example of integrating autotools, swig and python
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = ../..
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -40,7 +54,9 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = src/python
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
+DIST_COMMON = $(pkgpython_PYTHON) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/depcomp \
+ $(top_srcdir)/mkinstalldirs $(top_srcdir)/py-compile ChangeLog
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -48,37 +64,69 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(libdir)"
-libLTLIBRARIES_INSTALL = $(INSTALL)
-LTLIBRARIES = $(lib_LTLIBRARIES)
-libLibicalWrap_la_LIBADD =
-am_libLibicalWrap_la_OBJECTS = LibicalWrap.lo
-libLibicalWrap_la_OBJECTS = $(am_libLibicalWrap_la_OBJECTS)
-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(pyexecdir)" "$(DESTDIR)$(pkgpythondir)"
+LTLIBRARIES = $(pyexec_LTLIBRARIES)
+_LibicalWrap_la_DEPENDENCIES = $(top_builddir)/src/libical/libical.la \
+ $(top_builddir)/src/libicalss/libicalss.la
+am__LibicalWrap_la_OBJECTS = _LibicalWrap.lo
+_LibicalWrap_la_OBJECTS = $(am__LibicalWrap_la_OBJECTS)
+_LibicalWrap_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(_LibicalWrap_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
+am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
- $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(libLibicalWrap_la_SOURCES)
-DIST_SOURCES = $(libLibicalWrap_la_SOURCES)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(_LibicalWrap_la_SOURCES)
+DIST_SOURCES = $(_LibicalWrap_la_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile)
+py_compile = $(top_srcdir)/py-compile
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
@@ -102,18 +150,17 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
-DEV_FALSE = @DEV_FALSE@
-DEV_TRUE = @DEV_TRUE@
-ECHO = @ECHO@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
-HAVE_PTHREAD_FALSE = @HAVE_PTHREAD_FALSE@
-HAVE_PTHREAD_TRUE = @HAVE_PTHREAD_TRUE@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -123,6 +170,7 @@ JAVA = @JAVA@
JAVAC = @JAVAC@
JAVAH = @JAVAH@
JAVA_PLATFORM = @JAVA_PLATFORM@
+LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -130,53 +178,52 @@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
-MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
-MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OS_WIN32_FALSE = @OS_WIN32_FALSE@
-OS_WIN32_TRUE = @OS_WIN32_TRUE@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PTHREAD_LIBS = @PTHREAD_LIBS@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
PY_CFLAGS = @PY_CFLAGS@
-PY_EXTRA_LIBS = @PY_EXTRA_LIBS@
-PY_LIBS = @PY_LIBS@
-PY_LIB_LOC = @PY_LIB_LOC@
RANLIB = @RANLIB@
+SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
-WITH_BDB4_FALSE = @WITH_BDB4_FALSE@
-WITH_BDB4_TRUE = @WITH_BDB4_TRUE@
-WITH_CXX_BINDINGS_FALSE = @WITH_CXX_BINDINGS_FALSE@
-WITH_CXX_BINDINGS_TRUE = @WITH_CXX_BINDINGS_TRUE@
-WITH_JAVA_FALSE = @WITH_JAVA_FALSE@
-WITH_JAVA_TRUE = @WITH_JAVA_TRUE@
-WITH_PYTHON_FALSE = @WITH_PYTHON_FALSE@
-WITH_PYTHON_TRUE = @WITH_PYTHON_TRUE@
YACC = @YACC@
+YFLAGS = @YFLAGS@
ZONE_INFO = @ZONE_INFO@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
-am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
-am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -188,50 +235,54 @@ build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
+builddir = @builddir@
datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
+htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
+localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
-python_val = @python_val@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+swig_val = @swig_val@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
-lib_LTLIBRARIES = libLibicalWrap.la
-libLibicalWrap_la_SOURCES = LibicalWrap.c
-INCLUDES = \
- -I$(top_builddir) \
- -I$(top_srcdir)/src \
- -I$(top_builddir)/src \
- -I$(top_srcdir)/src/libical \
- -I$(top_builddir)/src/libical \
- -I$(top_srcdir)/src/libicalss \
- $(PY_CFLAGS)
-
-LDADD = ../libical/libical.la ../libicalss/libicalss.la
-CLEANFILES = LibicalWrap.c LibicalWrap_wrap.doc Libical.pyc LibicalWrap.so
-EXTRA_DIST = \
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+BUILT_SOURCES = _LibicalWrap.c
+pyexec_LTLIBRARIES = _LibicalWrap.la
+common_FILES = \
+__init__.py \
Libical.py \
-LibicalWrap.i \
-python-binding.txt \
test.py \
Attendee.py \
Collection.py \
@@ -243,10 +294,40 @@ Gauge.py \
Period.py \
Property.py \
Store.py \
-Time.py \
+Time.py
+
+
+# Install as python source so the code gets byte-compiled at install time.
+pkgpython_PYTHON = \
+$(common_FILES) \
+LibicalWrap.py
+
+
+# To allow non-standard library names (ie those not prefixed by "lib") see:
+# http://sources.redhat.com/automake/automake.html#Libtool-Modules
+_LibicalWrap_la_SOURCES = _LibicalWrap.c
+_LibicalWrap_la_LDFLAGS = -avoid-version -module -lc
+_LibicalWrap_la_LIBADD = $(top_builddir)/src/libical/libical.la \
+ $(top_builddir)/src/libicalss/libicalss.la
+
+AM_CPPFLAGS = \
+ -I$(top_builddir) \
+ -I$(top_srcdir)/src \
+ -I$(top_builddir)/src \
+ -I$(top_srcdir)/src/libical \
+ -I$(top_builddir)/src/libical \
+ -I$(top_srcdir)/src/libicalss \
+ $(PY_CFLAGS)
+
+CLEANFILES = _LibicalWrap.c _LibicalWrap_wrap.doc Libical.pyc LibicalWrap.py _LibicalWrap.so
+EXTRA_DIST = \
+$(common_FILES) \
+LibicalWrap.i \
+python-binding.txt \
ChangeLog
-all: all-am
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
@@ -254,14 +335,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/python/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu src/python/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/python/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/python/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -279,35 +360,43 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+$(am__aclocal_m4_deps):
+install-pyexecLTLIBRARIES: $(pyexec_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
- @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ @list='$(pyexec_LTLIBRARIES)'; test -n "$(pyexecdir)" || list=; \
+ list2=; for p in $$list; do \
if test -f $$p; then \
- f=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
- $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ list2="$$list2 $$p"; \
else :; fi; \
- done
-
-uninstall-libLTLIBRARIES:
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pyexecdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pyexecdir)" || exit 1; \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pyexecdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pyexecdir)"; \
+ }
+
+uninstall-pyexecLTLIBRARIES:
@$(NORMAL_UNINSTALL)
- @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
- p=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
- $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ @list='$(pyexec_LTLIBRARIES)'; test -n "$(pyexecdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pyexecdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pyexecdir)/$$f"; \
done
-clean-libLTLIBRARIES:
- -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
- @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
- dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
- echo "rm -f \"$${dir}/so_locations\""; \
- rm -f "$${dir}/so_locations"; \
- done
-libLibicalWrap.la: $(libLibicalWrap_la_OBJECTS) $(libLibicalWrap_la_DEPENDENCIES)
- $(LINK) -rpath $(libdir) $(libLibicalWrap_la_LDFLAGS) $(libLibicalWrap_la_OBJECTS) $(libLibicalWrap_la_LIBADD) $(LIBS)
+clean-pyexecLTLIBRARIES:
+ -test -z "$(pyexec_LTLIBRARIES)" || rm -f $(pyexec_LTLIBRARIES)
+ @list='$(pyexec_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+_LibicalWrap.la: $(_LibicalWrap_la_OBJECTS) $(_LibicalWrap_la_DEPENDENCIES) $(EXTRA__LibicalWrap_la_DEPENDENCIES)
+ $(_LibicalWrap_la_LINK) -rpath $(pyexecdir) $(_LibicalWrap_la_OBJECTS) $(_LibicalWrap_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -315,25 +404,25 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LibicalWrap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_LibicalWrap.Plo@am__quote@
.c.o:
-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
-@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
@@ -343,94 +432,151 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
-
-distclean-libtool:
- -rm -f libtool
-uninstall-info-am:
+install-pkgpythonPYTHON: $(pkgpython_PYTHON)
+ @$(NORMAL_INSTALL)
+ @list='$(pkgpython_PYTHON)'; dlist=; list2=; test -n "$(pkgpythondir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgpythondir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgpythondir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \
+ if test -f $$b$$p; then \
+ $(am__strip_dir) \
+ dlist="$$dlist $$f"; \
+ list2="$$list2 $$b$$p"; \
+ else :; fi; \
+ done; \
+ for file in $$list2; do echo $$file; done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgpythondir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgpythondir)" || exit $$?; \
+ done || exit $$?; \
+ if test -n "$$dlist"; then \
+ $(am__py_compile) --destdir "$(DESTDIR)" \
+ --basedir "$(pkgpythondir)" $$dlist; \
+ else :; fi
+
+uninstall-pkgpythonPYTHON:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgpython_PYTHON)'; test -n "$(pkgpythondir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ dir='$(DESTDIR)$(pkgpythondir)'; \
+ filesc=`echo "$$files" | sed 's|$$|c|'`; \
+ fileso=`echo "$$files" | sed 's|$$|o|'`; \
+ st=0; \
+ for files in "$$files" "$$filesc" "$$fileso"; do \
+ $(am__uninstall_files_from_dir) || st=$$?; \
+ done; \
+ exit $$st
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
+ set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
- here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
+ $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
- list='$(DISTFILES)'; for file in $$list; do \
- case $$file in \
- $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
- $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
- esac; \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test "$$dir" != "$$file" && test "$$dir" != "."; then \
- dir="/$$dir"; \
- $(mkdir_p) "$(distdir)$$dir"; \
- else \
- dir=''; \
- fi; \
if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
-check: check-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
- for dir in "$(DESTDIR)$(libdir)"; do \
- test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ for dir in "$(DESTDIR)$(pyexecdir)" "$(DESTDIR)$(pkgpythondir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
-install: install-am
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
@@ -440,10 +586,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
@@ -451,20 +602,22 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
clean: clean-am
-clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+clean-am: clean-generic clean-libtool clean-pyexecLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-libtool distclean-tags
+ distclean-tags
dvi: dvi-am
@@ -472,18 +625,38 @@ dvi-am:
html: html-am
+html-am:
+
info: info-am
info-am:
-install-data-am:
+install-data-am: install-pkgpythonPYTHON
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-pyexecLTLIBRARIES
-install-exec-am: install-libLTLIBRARIES
+install-html: install-html-am
+
+install-html-am:
install-info: install-info-am
+install-info-am:
+
install-man:
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -504,32 +677,30 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
+uninstall-am: uninstall-pkgpythonPYTHON uninstall-pyexecLTLIBRARIES
+
+.MAKE: all check install install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libLTLIBRARIES clean-libtool ctags distclean \
- distclean-compile distclean-generic distclean-libtool \
- distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-exec \
- install-exec-am install-info install-info-am \
- install-libLTLIBRARIES install-man install-strip installcheck \
+ clean-libtool clean-pyexecLTLIBRARIES cscopelist ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-pkgpythonPYTHON install-ps install-ps-am \
+ install-pyexecLTLIBRARIES install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am uninstall-info-am \
- uninstall-libLTLIBRARIES
-
+ tags uninstall uninstall-am uninstall-pkgpythonPYTHON \
+ uninstall-pyexecLTLIBRARIES
-all: LibicalWrap.so
-LibicalWrap.c: LibicalWrap.i
- swig -python -o LibicalWrap.c LibicalWrap.i
+_LibicalWrap.c: $(srcdir)/LibicalWrap.i $(srcdir)/*.i $(top_builddir)/src/libical/ical.h $(top_builddir)/src/libicalss/icalss.h
+ swig -python -Wall $(AM_CPPFLAGS) -o _LibicalWrap.c $(srcdir)/LibicalWrap.i
-# This part should be done with libtool, but I don't know how to do
-# it. Libtool needs to generate a shared library in this directory
-# regardless of the value of AM_DISABLE_SHARED
-LibicalWrap.so: LibicalWrap.c
- ld -shared -o LibicalWrap.so LibicalWrap.o ../libical/.libs/libical.a ../libicalss/.libs/libicalss.a
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/src/python/Period.py b/src/python/Period.py
index a9a4777..fb99816 100644
--- a/src/python/Period.py
+++ b/src/python/Period.py
@@ -76,13 +76,13 @@ class Period(Property):
raise Property.ConstructorFailedError("Failed to construct Period")
def _end_is_duration(self):
- dur = icalperiodtype_duration_get(self.pt)
+ dur = self.pt.duration
if not icaldurationtype_is_null_duration(dur):
return 1
return 0
def _end_is_time(self):
- end = icalperiodtype_end_get(self.pt)
+ end = self.pt.end
if not icaltime_is_null_time(end):
return 1
return 0
@@ -112,12 +112,12 @@ class Period(Property):
else:
raise TypeError
- icalperiodtype_start_set(self.pt,t.tt)
+ self.pt.start = t.tt
self._update_value()
- return Time(icaltime_as_timet(icalperiodtype_start_get(self.pt)),
+ return Time(self.pt.start.as_timet(),
"DTSTART")
def end(self,v=None):
@@ -139,23 +139,22 @@ class Period(Property):
raise TypeError
if(self._end_is_duration()):
- start = icaltime_as_timet(icalperiodtype_start_get(self.pt))
+ start = self.pt.start.as_timet()
dur = t.utc_seconds()-start;
- icalperiodtype_duration_set(self.pt,
- icaldurationtype_from_int(dur))
+ self.pt.duration = icaldurationtype_from_int(dur)
else:
- icalperiodtype_end_set(self.pt,t.tt)
+ self.pt.end = t.tt
self._update_value()
if(self._end_is_time()):
- rt = Time(icaltime_as_timet(icalperiodtype_end_get(self.pt)),
+ rt = Time(self.pt.end.as_timet(),
'DTEND')
rt.timezone(self.timezone())
return rt
elif(self._end_is_duration()):
- start = icaltime_as_timet(icalperiodtype_start_get(self.pt))
- dur = icaldurationtype_as_int(icalperiodtype_duration_get(self.pt))
+ start = self.pt.start.as_timet()
+ dur = icaldurationtype_as_int(self.pt.duration)
rt = Time(start+dur,'DTEND')
rt.timezone(self.timezone())
return rt
@@ -183,24 +182,23 @@ class Period(Property):
raise TypeError
if(self._end_is_time()):
- start = icaltime_as_timet(icalperiodtype_start_get(self.pt))
+ start = self.pt.start.as_timet()
end = start + d.seconds()
- icalperiodtype_end_set(self.pt,icaltime_from_timet(end,0))
+ self.pt.end = icaltimetype.from_timet(end)
else:
- icalperiodtype_duration_set(self.pt,d.dur)
+ self.pt.duration = d.dur
if(self._end_is_time()):
- start =icaltime_as_timet(icalperiodtype_start_get(self.pt))
- end = icaltime_as_timet(icalperiodtype_end_get(self.pt))
+ start = self.pt.start.as_timet()
+ end = self.pt.end.as_timet()
print "End is time " + str(end-start)
return Duration(end-start,"DURATION")
elif(self._end_is_duration()):
- dur = icaldurationtype_as_int(
- icalperiodtype_duration_get(self.pt))
+ dur = icaldurationtype_as_int(self.pt.duration)
return Duration(dur,"DURATION")
else:
diff --git a/src/python/Property.py b/src/python/Property.py
index 1b9b5ef..a53585e 100644
--- a/src/python/Property.py
+++ b/src/python/Property.py
@@ -43,18 +43,16 @@ def error_type():
def test_enum(prop,enum):
- kind = icalproperty_string_to_kind(prop)
- e = icalproperty_string_to_enum(enum)
-
- t = icalproperty_enum_belongs_to_property(kind,e)
+ vkind = icalvalue_string_to_kind(prop)
+ e = icalproperty_kind_and_string_to_enum(vkind, enum)
- if t == 1:
+ if e != 0:
return 1
return None
-class Property:
+class Property(object):
""" Represent any iCalendar Property.
Usage:
@@ -75,8 +73,8 @@ class Property:
def __init__(self, type = None, ref = None):
- assert(ref == None or isinstance(ref,StringType))
- assert(type == None or isinstance(type,StringType))
+ #~ assert(ref == None or isinstance(ref,StringType))
+ #~ assert(type == None or isinstance(type,StringType))
self._ref = None
@@ -87,14 +85,13 @@ class Property:
self._ref = icalproperty_new(kind)
if type.find("X-") == 0:
- icalproperty_set_x_name(self._ref, type)
+ icalproperty_set_x_name(self._ref, type)
if self._ref == None or self._ref == 'NULL':
- raise Property.ConstructorFailedError("Failed to construct Property")
+ raise Property.ConstructorFailedError("Failed to construct Property: %s (%s)"%(type, ref))
self._deleted = 0;
-
# Initialize all of the required keys
@@ -110,7 +107,7 @@ class Property:
def name(self,v=None):
""" Return the name of the property """
- return icalproperty_get_name(self._ref)
+ return icalproperty_get_property_name(self._ref)
def ref(self,v=None):
""" Return the internal reference to the libical icalproperty """
@@ -133,7 +130,9 @@ class Property:
if kind != None:
# Get the default kind of value for this property
- default_kind = icalvalue_kind_to_string(icalproperty_kind_to_value_kind(icalproperty_string_to_kind(self.name())))
+ default_kind = icalvalue_kind_to_string(
+ icalproperty_kind_to_value_kind(
+ icalproperty_string_to_kind(self.name())))
if(kind != default_kind):
self.__setitem__('VALUE',kind)
@@ -148,9 +147,11 @@ class Property:
icalerror_clear_errno()
#e1=icalerror_supress("MALFORMEDDATA")
- if (self.name().find("X-") == 0) and type(v) is StringType:
- v = icallangbind_quote_as_ical(v)
- v = icallangbind_quote_as_ical(v)
+ if (self.name() == None or self.name().find("X-") == 0) and type(v) is StringType:
+ v = icallangbind_quote_as_ical(v)
+
+ if isinstance(v, unicode):
+ v = v.encode('utf8')
icalproperty_set_value_from_string(self._ref,str(v),vt)
#icalerror_restore("MALFORMEDDATA",e1)
diff --git a/src/python/Time.py b/src/python/Time.py
index 6354bc1..8e6e5f2 100644
--- a/src/python/Time.py
+++ b/src/python/Time.py
@@ -30,6 +30,8 @@ from Property import Property
from types import DictType, StringType, IntType, FloatType
from Duration import Duration
+UTC = icaltimezone_get_utc_timezone()
+
class Time(Property):
""" Represent iCalendar DATE, TIME and DATE-TIME """
def __init__(self, arg, name="DTSTART", zone=None):
@@ -79,7 +81,7 @@ class Time(Property):
raise Property.ConstructorFailedError("Failed to construct a Time")
def _update_value(self):
- self.tt = icaltime_normalize(self.tt)
+ self.normalize()
self.value(icaltime_as_ical_string(self.tt),"DATE-TIME")
def valid(self):
@@ -88,12 +90,12 @@ class Time(Property):
def utc_seconds(self,v=None):
""" Return or set time in seconds past POSIX epoch"""
+ tz = icaltimezone_get_builtin_timezone(self.timezone())
if (v!=None):
- tz = icaltimezone_get_builtin_timezone(self.timezone())
self.tt = icaltime_from_timet_with_zone(v,0,tz)
self._update_value()
- return icaltime_as_timet(self.tt)
+ return icaltime_as_timet_with_zone(self.tt, tz)
def is_utc(self):
""" Return a boolean indicating if time is in UTC """
@@ -127,48 +129,56 @@ class Time(Property):
self._update_value()
return icaltime_get_tzid(self.tt)
- def second(self,v=None):
+ def normalize(self):
+ self.tt = icaltime_normalize(self.tt)
+
+ def __second_property(self,v=None):
""" Get or set the seconds component of this time """
if(v != None):
- icaltimetype_second_set(self.tt,v)
+ self.tt.second = v
self._update_value()
- return icaltimetype_second_get(self.tt)
+ return self.tt.second
+ second = property(__second_property, __second_property)
- def minute(self,v=None):
+ def __minute_property(self,v=None):
""" Get or set the minute component of this time """
if(v != None):
- icaltimetype_minute_set(self.tt,v)
+ self.tt.minute = v
self._update_value()
- return icaltimetype_minute_get(self.tt)
+ return self.tt.minute
+ minute = property(__minute_property, __minute_property)
- def hour(self,v=None):
+ def __hour_property(self,v=None):
""" Get or set the hour component of this time """
if(v != None):
- icaltimetype_hour_set(self.tt,v)
+ self.tt.hour = v
self._update_value()
- return icaltimetype_hour_get(self.tt)
+ return self.tt.hour
+ hour = property(__hour_property, __hour_property)
- def day(self,v=None):
+ def __day_property(self,v=None):
""" Get or set the month day component of this time """
if(v != None):
- icaltimetype_day_set(self.tt,v)
+ self.tt.day = v
self._update_value()
- return icaltimetype_day_get(self.tt)
+ return self.tt.day
+ day = property(__day_property, __day_property)
- def month(self,v=None):
+ def __month_property(self,v=None):
""" Get or set the month component of this time. January is month 1 """
if(v != None):
- icaltimetype_month_set(self.tt,v)
+ self.tt.month = v
self._update_value()
- return icaltimetype_month_get(self.tt)
+ return self.tt.month
+ month = property(__month_property, __month_property)
- def year(self,v=None):
+ def __year_property(self,v=None):
""" Get or set the year component of this time """
if(v != None):
- icaltimetype_year_set(self.tt,v)
+ self.tt.year = v
self._update_value()
-
- return icaltimetype_year_get(self.tt)
+ return self.tt.year
+ year = property(__year_property, __year_property)
def __cmp__(self,other):
@@ -185,9 +195,10 @@ class Time(Property):
if not other.valid():
return Duration(0,"DURATION")
-
+
+ print self.utc_seconds(), other.seconds()
seconds = self.utc_seconds() + other.seconds()
-
+
new = Time(seconds,self.name(),self.timezone())
return new
diff --git a/src/python/__init__.py b/src/python/__init__.py
new file mode 100644
index 0000000..bbae718
--- /dev/null
+++ b/src/python/__init__.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# -*- Mode: python -*-
+#======================================================================
+# FILE: __init__.py
+# CREATOR: glenn
+#
+# DESCRIPTION:
+#
+#
+# (C) COPYRIGHT 2001, Eric Busboom <eric@softwarestudio.org>
+# (C) COPYRIGHT 2001, Patrick Lewis <plewis@inetarena.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of either:
+#
+# The LGPL as published by the Free Software Foundation, version
+# 2.1, available at: http://www.fsf.org/copyleft/lesser.html
+#
+# Or:
+#
+# The Mozilla Public License Version 1.0. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#======================================================================
+
+from Libical import *
diff --git a/src/python/test.py b/src/python/test.py
index 01c683f..1d82062 100644
--- a/src/python/test.py
+++ b/src/python/test.py
@@ -133,12 +133,12 @@ def test_time():
t = Time("19970325T123010Z",'DTSTART')
- assert(t.year() == 1997)
- assert(t.month() == 3)
- assert(t.day() == 25)
- assert(t.hour() == 12)
- assert(t.minute() == 30)
- assert(t.second() == 10)
+ assert(t.year == 1997)
+ assert(t.month == 3)
+ assert(t.day == 25)
+ assert(t.hour == 12)
+ assert(t.minute == 30)
+ assert(t.second == 10)
assert(t.is_utc())
assert(not t.is_date())
@@ -148,25 +148,26 @@ def test_time():
print str(t)
print t.timezone()
#assert(str(t)=='DTSTART;TZID=America/Los_Angeles:19970325T123010')
- assert(str(t)=='DTSTART;TZID=/softwarestudio.org/Olson_20010626_2/America/Los_Angeles:19970325T043010')
+ assert(str(t)=='DTSTART;TZID=/freeassociation.sourceforge.net/Tzfile/America/Los_Angeles:19970325T053010')
- t.second(t.second()+80)
+ t.second = t.second+80
t.timezone("UTC")
- assert(t.minute() == 31)
- assert(t.second() == 30)
+ print t.minute, t.second
+ assert(t.minute == 31)
+ assert(t.second == 30)
d = Duration(3600,"DURATION")
t2 = t + d
print t2
- assert(t2.hour() == 13)
+ assert(t2.hour == 13)
t2 = t - d
print t2
assert(isinstance(t2,Time))
- assert(t2.hour() == 11)
+ assert(t2.hour == 11)
# test int args
t = Time(2)
@@ -297,13 +298,13 @@ def test_component():
print dtstart
- print "\n Orig hour: ", dtstart.hour()
- assert(dtstart.hour() == 12)
+ print "\n Orig hour: ", dtstart.hour
+ assert(dtstart.hour == 12)
- dtstart.hour(dtstart.hour() + 5)
+ dtstart.hour = dtstart.hour + 5
- print "\n New hour: ", dtstart.hour()
- assert(dtstart.hour() == 17)
+ print "\n New hour: ", dtstart.hour
+ assert(dtstart.hour == 17)
attendee = inner.properties('ATTENDEE')[0]
@@ -496,7 +497,7 @@ def do_test_store(storeobj=None, *args):
for i in range(1,11):
newevent = event.clone()
newevent.uid("%d@localhost" % (i,))
- newevent.dtstart().month( newevent.dtstart().month() + i )
+ newevent.dtstart().month = newevent.dtstart().month + i
#print ne
store.add_component(newevent)
@@ -575,6 +576,8 @@ def test_store():
do_test_store(FileStore,"filesetout.ics")
def run_tests():
+ print "Running unit tests for:", ICAL_PACKAGE, ICAL_VERSION
+
test_property()
test_time()