summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2012-06-10 12:02:35 +0000
committerKai Huuhko <kai.huuhko@gmail.com>2012-06-10 12:02:35 +0000
commitce0161ba74ee8e482c3649d2651549f76dbffa36 (patch)
tree5a82e1905f03c6754956b28323e19c06f857f5d2
parent934fa6e04f26b4afa1eee9d1db2935fe6fef4cbe (diff)
python-edje: Remove hacks.
SVN revision: 71897
-rw-r--r--INSTALL15
-rw-r--r--edje/__init__.py4
-rw-r--r--edje/edit/c_edit_object_state.pxi2
-rw-r--r--edje/edje.c_edje.pyx37
-rw-r--r--edje/edje.c_edje_object.pxi48
-rw-r--r--m4/cython.m42
-rw-r--r--m4/python.m44
7 files changed, 52 insertions, 60 deletions
diff --git a/INSTALL b/INSTALL
index 7d1c323..6e90e07 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,8 +1,8 @@
1Installation Instructions 1Installation Instructions
2************************* 2*************************
3 3
4Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 4Copyright (C) 1994-1996, 1999-2002, 2004-2012 Free Software Foundation,
52006, 2007, 2008, 2009 Free Software Foundation, Inc. 5Inc.
6 6
7 Copying and distribution of this file, with or without modification, 7 Copying and distribution of this file, with or without modification,
8are permitted in any medium without royalty provided the copyright 8are permitted in any medium without royalty provided the copyright
@@ -226,6 +226,11 @@ order to use an ANSI C compiler:
226 226
227and if that doesn't work, install pre-built binaries of GCC for HP-UX. 227and if that doesn't work, install pre-built binaries of GCC for HP-UX.
228 228
229 HP-UX `make' updates targets which have the same time stamps as
230their prerequisites, which makes it generally unusable when shipped
231generated files such as `configure' are involved. Use GNU `make'
232instead.
233
229 On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot 234 On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
230parse its `<wchar.h>' header file. The option `-nodtk' can be used as 235parse its `<wchar.h>' header file. The option `-nodtk' can be used as
231a workaround. If GNU CC is not installed, it is therefore recommended 236a workaround. If GNU CC is not installed, it is therefore recommended
@@ -304,9 +309,10 @@ causes the specified `gcc' to be used as the C compiler (unless it is
304overridden in the site shell script). 309overridden in the site shell script).
305 310
306Unfortunately, this technique does not work for `CONFIG_SHELL' due to 311Unfortunately, this technique does not work for `CONFIG_SHELL' due to
307an Autoconf bug. Until the bug is fixed you can use this workaround: 312an Autoconf limitation. Until the limitation is lifted, you can use
313this workaround:
308 314
309 CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash 315 CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
310 316
311`configure' Invocation 317`configure' Invocation
312====================== 318======================
@@ -362,4 +368,3 @@ operates.
362 368
363`configure' also accepts some other, not widely useful, options. Run 369`configure' also accepts some other, not widely useful, options. Run
364`configure --help' for more details. 370`configure --help' for more details.
365
diff --git a/edje/__init__.py b/edje/__init__.py
index 5dc7057..4570456 100644
--- a/edje/__init__.py
+++ b/edje/__init__.py
@@ -17,9 +17,9 @@
17 17
18#!/usr/bin/env python 18#!/usr/bin/env python
19 19
20import c_edje 20import edje.c_edje
21 21
22from c_edje import Edje, shutdown, frametime_set, frametime_get, \ 22from edje.c_edje import Edje, shutdown, frametime_set, frametime_get, \
23 freeze, thaw, fontset_append_get, fontset_append_set, \ 23 freeze, thaw, fontset_append_get, fontset_append_set, \
24 file_collection_list, file_group_exists, \ 24 file_collection_list, file_group_exists, \
25 file_data_get, file_cache_set, file_cache_get, file_cache_flush, \ 25 file_data_get, file_cache_set, file_cache_get, file_cache_flush, \
diff --git a/edje/edit/c_edit_object_state.pxi b/edje/edit/c_edit_object_state.pxi
index 5a3e43f..15fddc9 100644
--- a/edje/edit/c_edit_object_state.pxi
+++ b/edje/edit/c_edit_object_state.pxi
@@ -564,7 +564,7 @@ cdef class State:
564 return self.external_param_int_set(param, value) 564 return self.external_param_int_set(param, value)
565 elif isinstance(value, float): 565 elif isinstance(value, float):
566 return self.external_param_double_set(param, value) 566 return self.external_param_double_set(param, value)
567 elif isinstance(value, basestring): 567 elif isinstance(value, str):
568 t = edje_object_part_external_param_type_get( 568 t = edje_object_part_external_param_type_get(
569 self.edje.obj, self.part, param) 569 self.edje.obj, self.part, param)
570 if t == edje.c_edje.EDJE_EXTERNAL_PARAM_TYPE_STRING: 570 if t == edje.c_edje.EDJE_EXTERNAL_PARAM_TYPE_STRING:
diff --git a/edje/edje.c_edje.pyx b/edje/edje.c_edje.pyx
index ec6ddb8..59e5dda 100644
--- a/edje/edje.c_edje.pyx
+++ b/edje/edje.c_edje.pyx
@@ -269,14 +269,35 @@ def available_modules_get():
269def module_load(char *name): 269def module_load(char *name):
270 return bool(edje_module_load(name)) 270 return bool(edje_module_load(name))
271 271
272cdef extern from "Python.h": 272class EdjeObjectMeta(evas.c_evas.EvasObjectMeta):
273 ctypedef struct PyTypeObject: 273 def __init__(cls, name, bases, dict_):
274 PyTypeObject *ob_type 274 evas.c_evas.EvasObjectMeta.__init__(cls, name, bases, dict_)
275 275 cls._fetch_callbacks()
276cdef void _install_metaclass(PyTypeObject *ctype, object metaclass): 276
277 Py_INCREF(metaclass) 277 def _fetch_callbacks(cls):
278 ctype.ob_type = <PyTypeObject*>metaclass 278 if "__edje_signal_callbacks__" in cls.__dict__:
279 279 return
280
281 cls.__edje_signal_callbacks__ = []
282 cls.__edje_message_callbacks__ = []
283 cls.__edje_text_callbacks__ = []
284
285 sig_append = cls.__edje_signal_callbacks__.append
286 msg_append = cls.__edje_message_callbacks__.append
287 txt_append = cls.__edje_text_callbacks__.append
288
289 for name in dir(cls):
290 val = getattr(cls, name)
291 if not callable(val):
292 continue
293
294 if hasattr(val, "edje_signal_callback"):
295 sig_data = getattr(val, "edje_signal_callback")
296 sig_append((name, sig_data))
297 elif hasattr(val, "edje_message_handler"):
298 msg_append(name)
299 elif hasattr(val, "edje_text_change_callback"):
300 txt_append(name)
280 301
281include "edje.c_edje_message.pxi" 302include "edje.c_edje_message.pxi"
282include "edje.c_edje_external.pxi" 303include "edje.c_edje_external.pxi"
diff --git a/edje/edje.c_edje_object.pxi b/edje/edje.c_edje_object.pxi
index 540fbb5..e74b953 100644
--- a/edje/edje.c_edje_object.pxi
+++ b/edje/edje.c_edje_object.pxi
@@ -139,6 +139,9 @@ cdef public class Edje(evas.c_evas.Object) [object PyEdje, type PyEdje_Type]:
139 ... 139 ...
140 >>> my_edje.message_handler_set(msg_dbg) 140 >>> my_edje.message_handler_set(msg_dbg)
141 """ 141 """
142
143 __metaclass__ = EdjeObjectMeta
144
142 def __cinit__(self, *a, **ka): 145 def __cinit__(self, *a, **ka):
143 self._signal_callbacks = {} 146 self._signal_callbacks = {}
144 147
@@ -879,8 +882,8 @@ cdef public class Edje(evas.c_evas.Object) [object PyEdje, type PyEdje_Type]:
879 self.message_send_int_set(id, data) 882 self.message_send_int_set(id, data)
880 elif isinstance(head, float): 883 elif isinstance(head, float):
881 self.message_send_float_set(id, data) 884 self.message_send_float_set(id, data)
882 elif isinstance(head, basestring): 885 elif isinstance(head, str):
883 if issubclass(item_type, basestring): 886 if issubclass(item_type, str):
884 self.message_send_str_set(id, data) 887 self.message_send_str_set(id, data)
885 elif item_type == int or item_type == long: 888 elif item_type == int or item_type == long:
886 if len(data) == 2: 889 if len(data) == 2:
@@ -912,7 +915,7 @@ cdef public class Edje(evas.c_evas.Object) [object PyEdje, type PyEdje_Type]:
912 self.message_send_int(id, data) 915 self.message_send_int(id, data)
913 elif isinstance(data, float): 916 elif isinstance(data, float):
914 self.message_send_float(id, data) 917 self.message_send_float(id, data)
915 elif isinstance(data, basestring): 918 elif isinstance(data, str):
916 self.message_send_str(id, data) 919 self.message_send_str(id, data)
917 elif isinstance(data, (tuple, list)): 920 elif isinstance(data, (tuple, list)):
918 if len(data) < 1: 921 if len(data) < 1:
@@ -921,7 +924,7 @@ cdef public class Edje(evas.c_evas.Object) [object PyEdje, type PyEdje_Type]:
921 self.message_send(id, data[0]) 924 self.message_send(id, data[0])
922 return 925 return
923 926
924 if not isinstance(data[0], (long, int, float, basestring)): 927 if not isinstance(data[0], (long, int, float, str)):
925 raise TypeError("invalid message list type '%s'" % 928 raise TypeError("invalid message list type '%s'" %
926 type(data[0]).__name__) 929 type(data[0]).__name__)
927 930
@@ -1007,41 +1010,4 @@ cdef public class Edje(evas.c_evas.Object) [object PyEdje, type PyEdje_Type]:
1007 "Emit signal with B{emission} and B{source}" 1010 "Emit signal with B{emission} and B{source}"
1008 edje_object_signal_emit(self.obj, emission, source) 1011 edje_object_signal_emit(self.obj, emission, source)
1009 1012
1010
1011class EdjeObjectMeta(evas.c_evas.EvasObjectMeta):
1012 def __init__(cls, name, bases, dict_):
1013 evas.c_evas.EvasObjectMeta.__init__(cls, name, bases, dict_)
1014 cls._fetch_callbacks()
1015
1016 def _fetch_callbacks(cls):
1017 if "__edje_signal_callbacks__" in cls.__dict__:
1018 return
1019
1020 cls.__edje_signal_callbacks__ = []
1021 cls.__edje_message_callbacks__ = []
1022 cls.__edje_text_callbacks__ = []
1023
1024 sig_append = cls.__edje_signal_callbacks__.append
1025 msg_append = cls.__edje_message_callbacks__.append
1026 txt_append = cls.__edje_text_callbacks__.append
1027
1028 for name in dir(cls):
1029 val = getattr(cls, name)
1030 if not callable(val):
1031 continue
1032
1033 if hasattr(val, "edje_signal_callback"):
1034 sig_data = getattr(val, "edje_signal_callback")
1035 sig_append((name, sig_data))
1036 elif hasattr(val, "edje_message_handler"):
1037 msg_append(name)
1038 elif hasattr(val, "edje_text_change_callback"):
1039 txt_append(name)
1040
1041
1042cdef extern from "Edje.h": # hack to force type to be known
1043 cdef PyTypeObject PyEdje_Type # hack to install metaclass
1044_install_metaclass(&PyEdje_Type, EdjeObjectMeta)
1045
1046
1047evas.c_evas._object_mapping_register("edje", Edje) 1013evas.c_evas._object_mapping_register("edje", Edje)
diff --git a/m4/cython.m4 b/m4/cython.m4
index ba1d432..5353b6d 100644
--- a/m4/cython.m4
+++ b/m4/cython.m4
@@ -8,7 +8,7 @@ ifelse([$1], [], [_msg=""], [_msg=" >= $1"])
8AC_MSG_CHECKING(for Cython$_msg) 8AC_MSG_CHECKING(for Cython$_msg)
9AC_CACHE_VAL(py_cv_cython, [ 9AC_CACHE_VAL(py_cv_cython, [
10 10
11prog="import Cython.Compiler.Version; print Cython.Compiler.Version.version" 11prog="import Cython.Compiler.Version; print(Cython.Compiler.Version.version)"
12CYTHON_VERSION=`$PYTHON -c "$prog" 2>&AC_FD_CC` 12CYTHON_VERSION=`$PYTHON -c "$prog" 2>&AC_FD_CC`
13 13
14py_cv_cython=no 14py_cv_cython=no
diff --git a/m4/python.m4 b/m4/python.m4
index 02acac8..f625251 100644
--- a/m4/python.m4
+++ b/m4/python.m4
@@ -47,8 +47,8 @@ if test -x "$PYTHON_INCLUDES"; then
47PYTHON_INCLUDES="-I$PYTHON_INCLUDES" 47PYTHON_INCLUDES="-I$PYTHON_INCLUDES"
48else 48else
49dnl deduce PYTHON_INCLUDES 49dnl deduce PYTHON_INCLUDES
50py_prefix=`$PYTHON -c "import sys; print sys.prefix"` 50py_prefix=`$PYTHON -c "import sys; print(sys.prefix)"`
51py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"` 51py_exec_prefix=`$PYTHON -c "import sys; print(sys.exec_prefix)"`
52if test -x "$PYTHON-config"; then 52if test -x "$PYTHON-config"; then
53PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null` 53PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null`
54else 54else