Eolian: WIP

This commit is contained in:
Kai Huuhko 2014-10-02 23:56:12 +03:00
parent 2ba244d263
commit f84fef0415
16 changed files with 1533 additions and 1380 deletions

0
efl/efl/__init__.py Normal file
View File

11
efl/efl/__init__.pyx Normal file
View File

@ -0,0 +1,11 @@
from cpython cimport PyUnicode_AsUTF8String
from efl.c_eo cimport eo_add_ref, Eo_Class, _eo_do_start, _eo_do_end, \
CFILE, CFUNC, CLINE, Eo_Event_Description
from efl.eo cimport object_from_instance, _object_mapping_register, \
Eo, _Eo
from efl.utils.conversions cimport _ctouni
from efl.eina cimport eina_hash_add, eina_hash_del, EINA_FALSE, Eina_Bool
include "generated_classes.pxi"

0
efl/elm/__init__.py Normal file
View File

File diff suppressed because it is too large Load Diff

View File

@ -22,14 +22,14 @@ from efl.eina cimport Eina_Bool, \
Eina_Hash, eina_hash_string_superfast_new, eina_hash_add, eina_hash_del, \
eina_hash_find, EINA_LOG_DOM_DBG, EINA_LOG_DOM_INFO, \
eina_hash_pointer_new
from efl.c_eo cimport Eo as cEo, eo_init, eo_shutdown, eo_del, eo_do, \
from efl.c_eo cimport Eo as Eo, eo_init, eo_shutdown, eo_del, eo_do, \
eo_class_name_get, eo_class_get, eo_base_class_get,\
eo_key_data_set, eo_key_data_get, eo_key_data_del, \
eo_event_callback_add, eo_event_callback_del, EO_EV_DEL, \
eo_parent_get, eo_parent_set, Eo_Event_Description, \
eo_event_freeze, eo_event_thaw, eo_event_freeze_count_get, \
eo_event_global_freeze, eo_event_global_thaw, \
eo_event_global_freeze_count_get
eo_event_global_freeze_count_get, eo_add_ref
cimport efl.eo.enums as enums
@ -57,16 +57,16 @@ init()
def event_global_freeze_count_get():
cdef int fcount
fcount = <int>eo_do(<const cEo *>eo_base_class_get(),
fcount = <int>eo_do(<const Eo *>eo_base_class_get(),
eo_event_global_freeze_count_get())
return fcount
def event_global_freeze():
eo_do(<const cEo *>eo_base_class_get(),
eo_do(<const Eo *>eo_base_class_get(),
eo_event_global_freeze())
def event_global_thaw():
eo_do(<const cEo *>eo_base_class_get(),
eo_do(<const Eo *>eo_base_class_get(),
eo_event_global_thaw())
######################################################################
@ -98,11 +98,11 @@ cdef void _object_mapping_unregister(char *name):
eina_hash_del(object_mapping, name, NULL)
cdef api object object_from_instance(cEo *obj):
cdef api object object_from_instance(Eo *obj):
""" Create a python object from a C Eo object pointer. """
cdef:
void *data
Eo o
_Eo o
const char *cls_name = eo_class_name_get(eo_class_get(obj))
type cls
void *cls_ret
@ -114,7 +114,7 @@ cdef api object object_from_instance(cEo *obj):
if data != NULL:
EINA_LOG_DOM_DBG(PY_EFL_EO_LOG_DOMAIN,
"Returning a Python object instance for Eo of type %s.", cls_name)
return <Eo>data
return <_Eo>data
if cls_name == NULL:
raise ValueError(
@ -143,12 +143,12 @@ cdef api object object_from_instance(cEo *obj):
o._set_obj(obj)
return o
cdef api cEo *instance_from_object(object obj):
cdef Eo o = obj
cdef api Eo *instance_from_object(object obj):
cdef _Eo o = obj
return o.obj
cdef void _register_decorated_callbacks(Eo obj):
cdef void _register_decorated_callbacks(_Eo obj):
"""
Search every attrib of the pyobj for a __decorated_callbacks__ object,
@ -179,11 +179,11 @@ EO_CALLBACK_CONTINUE = enums.EO_CALLBACK_CONTINUE
######################################################################
cdef Eina_Bool _eo_event_del_cb(void *data, cEo *obj,
cdef Eina_Bool _eo_event_del_cb(void *data, Eo *obj,
const Eo_Event_Description *desc,
void *event_info) with gil:
cdef:
Eo self = <Eo>data
_Eo self = <_Eo>data
const char *cls_name = eo_class_name_get(eo_class_get(obj))
EINA_LOG_DOM_DBG(PY_EFL_EO_LOG_DOMAIN, "Deleting Eo: %s", cls_name)
@ -197,7 +197,7 @@ cdef Eina_Bool _eo_event_del_cb(void *data, cEo *obj,
return enums.EO_CALLBACK_STOP
cdef Eina_Bool _py_efl_eo_event_cb(
void *data, cEo *obj,
void *data, Eo *obj,
const Eo_Event_Description *desc,
void *event_info
) with gil:
@ -206,7 +206,7 @@ cdef Eina_Bool _py_efl_eo_event_cb(
void *tmp1
void *tmp2
bint ret
Eo o
_Eo o
EventDesc py_ev_desc
#EventInfo py_ev_info_obj
@ -267,7 +267,7 @@ cdef class EventDesc(object):
# self.event_info = self.conv_to_c(val)
cdef class Eo(object):
cdef class _Eo(object):
"""
Base class used by all the object in the EFL.
@ -282,13 +282,13 @@ cdef class Eo(object):
self.data = dict()
def __init__(self, *args, **kwargs):
if type(self) is Eo:
if type(self) is _Eo:
raise TypeError("Must not instantiate Eo, but subclasses")
def __repr__(self):
cdef cEo *parent = NULL
cdef Eo *parent = NULL
if self.obj != NULL:
parent = <cEo *>eo_do(self.obj, eo_parent_get())
parent = <Eo *>eo_do(self.obj, eo_parent_get())
return ("<%s object (Eo) at %#x (obj=%#x, parent=%#x, refcount=%d)>") % (
type(self).__name__,
<uintptr_t><void *>self,
@ -299,7 +299,7 @@ cdef class Eo(object):
def __nonzero__(self):
return 1 if self.obj != NULL else 0
cdef int _set_obj(self, cEo *obj) except 0:
cdef int _set_obj(self, Eo *obj) except 0:
assert self.obj == NULL, "Object must be clean"
assert obj != NULL, "Cannot set a NULL object"
@ -339,7 +339,7 @@ cdef class Eo(object):
"""
return bool(self.obj == NULL)
def parent_set(self, Eo parent):
def parent_set(self, _Eo parent):
"""Set the parent object.
:param parent: The object to set as parent.
@ -355,7 +355,7 @@ cdef class Eo(object):
:rtype: :class:`Eo`
"""
cdef cEo *parent = <cEo *>eo_do(self.obj, eo_parent_get())
cdef Eo *parent = <Eo *>eo_do(self.obj, eo_parent_get())
return object_from_instance(parent)
def event_freeze(self):

View File

@ -224,6 +224,7 @@ cdef extern from "Eolian.h":
Eina_Bool eolian_function_is_empty(const Eolian_Function *function_id, Eolian_Function_Type f_type)
Eina_Bool eolian_function_is_legacy_only(const Eolian_Function *function_id, Eolian_Function_Type ftype)
Eina_Bool eolian_function_is_class(const Eolian_Function *function_id)
Eina_Bool eolian_function_is_constructor(const Eolian_Function *function_id, const Eolian_Class *klass)
const Eolian_Function_Parameter *eolian_function_parameter_get_by_name(const Eolian_Function *function_id, const char *param_name)
Eina_Iterator *eolian_function_parameters_get(const Eolian_Function *function_id)
Eina_Iterator *eolian_property_keys_get(const Eolian_Function *foo_id)
@ -261,6 +262,7 @@ cdef extern from "Eolian.h":
Eina_Stringshare *eolian_event_c_name_get(const Eolian_Event *event)
Eina_Bool eolian_class_ctor_enable_get(const Eolian_Class *klass)
Eina_Bool eolian_class_dtor_enable_get(const Eolian_Class *klass)
Eina_Stringshare *eolian_class_c_get_function_name_get(const Eolian_Class *klass)
const Eolian_Type *eolian_type_alias_get_by_name(const char *name)
const Eolian_Type *eolian_type_struct_get_by_name(const char *name)
const Eolian_Type *eolian_type_enum_get_by_name(const char *name)

View File

@ -895,6 +895,21 @@ cdef class Class(object):
def __get__(self):
return bool(eolian_class_dtor_enable_get(self.klass))
property c_get_function_name:
"""Returns the name of the C function used to get the Eo_Class pointer.
:return: a stringshare containing the func name or NULL on error.
You have to delete the stringshare manually.
"""
def __get__(self):
cdef Eina_Stringshare *ret1
ret1 = eolian_class_c_get_function_name_get(self.klass)
ret2 = _ctouni(ret1)
eina_stringshare_del(ret1)
return ret2
def function_get_by_name(self, func_name, Eolian_Function_Type f_type):
"""Find a function in a class by its name and type
@ -1049,6 +1064,16 @@ cdef class Function(object):
def __get__(self):
return bool(eolian_function_is_class(self.function_id))
def is_constructor(self, Class klass):
"""Indicates if a function is a constructing function of a given class.
@param[in] klass the class
@param[in] function_id Id of the function
@return EINA_TRUE and EINA_FALSE respectively
"""
return bool(eolian_function_is_constructor(self.function_id, klass.klass))
def parameter_get_by_name(self, param_name):
"""Returns a parameter of a function pointed by its id.

View File

@ -20,6 +20,16 @@ from efl.utils.conversions cimport eina_list_strings_to_python_list
from efl.eina cimport EINA_LOG_DOM_DBG, EINA_LOG_DOM_INFO, EINA_LOG_DOM_WARN
from efl.utils.logger cimport add_logger
from cpython cimport PyUnicode_AsUTF8String
from efl.c_eo cimport eo_add_ref, Eo, Eo_Class, _eo_do_start, _eo_do_end, \
CFILE, CFUNC, CLINE, Eo_Event_Description
from efl.eo cimport object_from_instance, _object_mapping_register, \
_register_decorated_callbacks, _Eo
from efl.utils.conversions cimport _ctouni
from efl.eina cimport eina_hash_add, eina_hash_del, EINA_FALSE
cdef int PY_EFL_EVAS_LOG_DOMAIN = add_logger(__name__).eina_log_domain
EVAS_LAYER_MIN = enums.EVAS_LAYER_MIN
@ -343,24 +353,25 @@ class EvasLoadError(Exception):
Exception.__init__(self, "%s (file=%s, key=%s)" % (msg, filename, key))
include "efl.evas_rect.pxi"
include "efl.evas_map.pxi"
include "efl.evas_canvas_callbacks.pxi"
include "efl.evas_canvas.pxi"
include "efl.evas_object_events.pxi"
include "efl.evas_object_callbacks.pxi"
include "efl.evas_object.pxi"
include "efl.evas_object_smart.pxi"
include "efl.evas_object_image.pxi"
include "efl.evas_object_line.pxi"
include "efl.evas_object_rectangle.pxi"
include "efl.evas_object_polygon.pxi"
include "efl.evas_object_text.pxi"
include "efl.evas_object_textblock.pxi"
include "efl.evas_object_box.pxi"
include "efl.evas_object_textgrid.pxi"
include "efl.evas_object_table.pxi"
include "efl.evas_object_grid.pxi"
include "generated_classes.pxi"
#include "efl.evas_rect.pxi"
#include "efl.evas_map.pxi"
#include "efl.evas_canvas_callbacks.pxi"
#include "efl.evas_canvas.pxi"
#include "efl.evas_object_events.pxi"
#include "efl.evas_object_callbacks.pxi"
#include "efl.evas_object.pxi"
#include "efl.evas_object_smart.pxi"
#include "efl.evas_object_image.pxi"
#include "efl.evas_object_line.pxi"
#include "efl.evas_object_rectangle.pxi"
#include "efl.evas_object_polygon.pxi"
#include "efl.evas_object_text.pxi"
#include "efl.evas_object_textblock.pxi"
#include "efl.evas_object_box.pxi"
#include "efl.evas_object_textgrid.pxi"
#include "efl.evas_object_table.pxi"
#include "efl.evas_object_grid.pxi"
init()

View File

@ -18,9 +18,9 @@
from efl.eina cimport Eina_Bool
cdef extern from *:
struct CFILE "__FILE__"
struct CLINE "__LINE__"
struct CFUNC "__FUNCTION__"
char *CFILE "__FILE__"
int CLINE "__LINE__"
char *CFUNC "__FUNCTION__"
cdef extern from "Eo.h":
####################################################################
@ -57,6 +57,7 @@ cdef extern from "Eo.h":
int eo_shutdown()
Eo *eo_add(const Eo_Class *klass, Eo *parent, ...)
Eo *eo_add_ref(const Eo_Class *klass, Eo *parent, ...)
Eo *eo_ref(const Eo *obj)
void eo_unref(const Eo *obj)
int eo_ref_get(const Eo *obj)

View File

@ -50,6 +50,10 @@ cdef extern from "Eina.h":
EINA_LOG_STATE_START
EINA_LOG_STATE_STOP
enum:
EINA_FALSE
EINA_TRUE
####################################################################
# Basic Types
#
@ -96,6 +100,8 @@ cdef extern from "Eina.h":
ctypedef struct _Eina_Inlist
ctypedef _Eina_Inlist Eina_Inlist
ctypedef struct Eina_Accessor
####################################################################
# Other typedefs
#

View File

@ -17,7 +17,7 @@
from efl.eina cimport Eina_Bool, Eina_List
from efl.evas cimport Evas, Evas_Object
from efl.evas cimport Object as evasObject
from efl.evas cimport _Object as evasObject
cdef extern from "Emotion.h":

View File

@ -15,18 +15,18 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
from efl.c_eo cimport Eo as cEo
from efl.c_eo cimport Eo
from efl.eina cimport Eina_Hash
cdef:
class Eo(object):
class _Eo(object):
cdef:
cEo *obj
Eo *obj
Eina_Hash *event_desc_mapping
Eina_Hash *event_conv_mapping
readonly dict data
int _set_obj(self, cEo *obj) except 0
int _set_obj(self, Eo *obj) except 0
int _set_properties_from_keyword_args(self, dict kwargs) except 0
#_add_obj(self, Eo_Class *klass, cEo *parent)
@ -36,8 +36,8 @@ cdef:
void _object_mapping_register(char *name, object cls) except *
void _object_mapping_unregister(char *name)
void _register_decorated_callbacks(Eo obj)
void _register_decorated_callbacks(_Eo obj)
cdef api:
object object_from_instance(cEo *obj)
cEo *instance_from_object(object o)
object object_from_instance(Eo *obj)
Eo *instance_from_object(object o)

View File

@ -16,8 +16,8 @@
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
from efl.eina cimport *
from efl.eo cimport Eo
from efl.c_eo cimport Eo as cEo, Eo_Class
from efl.eo cimport _Eo
from efl.c_eo cimport Eo, Eo_Class
from efl.evas.enums cimport Evas_Event_Flags, Evas_Button_Flags, \
Evas_Font_Hinting_Flags, Evas_Aspect_Control, Evas_Render_Op, \
Evas_Callback_Type, Evas_Object_Pointer_Mode, Evas_Colorspace, \
@ -25,7 +25,7 @@ from efl.evas.enums cimport Evas_Event_Flags, Evas_Button_Flags, \
Evas_Textgrid_Palette, Evas_Textgrid_Font_Style, \
Evas_Fill_Spread, Evas_Image_Scale_Hint, Evas_Image_Content_Hint, \
Evas_Image_Animated_Loop_Hint, Evas_Object_Table_Homogeneous_Mode, \
Evas_Display_Mode
Evas_Display_Mode, Evas_BiDi_Direction, Evas_Touch_Point_State
cdef extern from "Evas.h":
####################################################################
@ -35,6 +35,7 @@ cdef extern from "Evas.h":
ctypedef int Evas_Angle
ctypedef int Evas_Font_Size
ctypedef unsigned long long Evas_Modifier_Mask
ctypedef double Evas_Real
####################################################################
# Structures
@ -63,9 +64,11 @@ cdef extern from "Evas.h":
ctypedef struct Evas_Hash
ctypedef cEo Evas
ctypedef Eo Evas
ctypedef cEo Evas_Object
ctypedef Eo Evas_Object
ctypedef Eo Evas_3D_Node
ctypedef Eo Evas_3D_Mesh
ctypedef struct Evas_Modifier
ctypedef struct Evas_Lock
@ -257,6 +260,9 @@ cdef extern from "Evas.h":
ctypedef struct Evas_Map
ctypedef struct Evas_Object_Textblock_Node_Format
ctypedef struct Evas_Engine_Info
####################################################################
# Other typedefs
@ -863,51 +869,51 @@ cdef extern from "Evas.h":
####################################################################
# Python classes
#
cdef class Rect:
cdef class _Rect:
cdef int x0, y0, x1, y1, cx, cy, _w, _h
cdef class Canvas(Eo):
cdef class _Canvas(_Eo):
cdef list _event_callbacks
cdef class Map(object):
cdef class _Map(object):
cdef Evas_Map *map
cdef class Object(Eo):
cdef class _Object(_Eo):
cdef list _event_callbacks
cdef int _set_properties_from_keyword_args(self, dict) except 0
cdef class Rectangle(Object):
cdef class _Rectangle(_Object):
pass
cdef class Line(Object):
pass
#cdef class _Line(_Object):
# pass
cdef class Image(Object):
pass
#cdef class _Image(_Object):
# pass
cdef class FilledImage(Image):
pass
#cdef class _FilledImage(_Image):
# pass
cdef class Polygon(Object):
pass
#cdef class _Polygon(_Object):
# pass
cdef class Text(Object):
pass
#cdef class _Text(_Object):
# pass
cdef class Textblock(Object):
pass
#cdef class _Textblock(_Object):
# pass
cdef class SmartObject(Object):
cdef class _SmartObject(_Object):
cdef object _smart_callbacks
cdef object _m_delete
cdef object _m_move
@ -920,151 +926,151 @@ cdef class SmartObject(Object):
cdef object _m_calculate
cdef class ClippedSmartObject(SmartObject):
cdef readonly Rectangle clipper
cdef class _ClippedSmartObject(_SmartObject):
cdef readonly _Rectangle clipper
cdef class EventPoint:
cdef Evas_Point *obj
#cdef class EventPoint:
# cdef Evas_Point *obj
cdef void _set_obj(self, Evas_Point *obj)
cdef void _unset_obj(self)
cdef int _check_validity(self) except 0
# cdef void _set_obj(self, Evas_Point *obj)
# cdef void _unset_obj(self)
# cdef int _check_validity(self) except 0
cdef class EventCoordPoint:
cdef Evas_Coord_Point *obj
#cdef class EventCoordPoint:
# cdef Evas_Coord_Point *obj
cdef void _set_obj(self, Evas_Coord_Point *obj)
cdef void _unset_obj(self)
cdef int _check_validity(self) except 0
# cdef void _set_obj(self, Evas_Coord_Point *obj)
# cdef void _unset_obj(self)
# cdef int _check_validity(self) except 0
cdef class EventPrecisionPoint:
cdef Evas_Coord_Precision_Point *obj
#cdef class EventPrecisionPoint:
# cdef Evas_Coord_Precision_Point *obj
cdef void _set_obj(self, Evas_Coord_Precision_Point *obj)
cdef void _unset_obj(self)
cdef int _check_validity(self) except 0
# cdef void _set_obj(self, Evas_Coord_Precision_Point *obj)
# cdef void _unset_obj(self)
# cdef int _check_validity(self) except 0
cdef class EventPosition:
cdef readonly EventPoint output
cdef readonly EventCoordPoint canvas
#cdef class EventPosition:
# cdef readonly EventPoint output
# cdef readonly EventCoordPoint canvas
cdef void _set_objs(self, Evas_Point *output, Evas_Coord_Point *canvas)
cdef void _unset_objs(self)
# cdef void _set_objs(self, Evas_Point *output, Evas_Coord_Point *canvas)
# cdef void _unset_objs(self)
cdef class EventPrecisionPosition:
cdef readonly EventPoint output
cdef readonly EventPrecisionPoint canvas
#cdef class EventPrecisionPosition:
# cdef readonly EventPoint output
# cdef readonly EventPrecisionPoint canvas
cdef void _set_objs(self, Evas_Point *output, Evas_Coord_Precision_Point *canvas)
cdef void _unset_objs(self)
# cdef void _set_objs(self, Evas_Point *output, Evas_Coord_Precision_Point *canvas)
# cdef void _unset_objs(self)
cdef class EventMouseIn:
cdef Evas_Event_Mouse_In *obj
cdef readonly EventPosition position
#cdef class EventMouseIn:
# cdef Evas_Event_Mouse_In *obj
# cdef readonly EventPosition position
cdef void _set_obj(self, void *ptr)
cdef void _unset_obj(self)
cdef int _check_validity(self) except 0
# cdef void _set_obj(self, void *ptr)
# cdef void _unset_obj(self)
# cdef int _check_validity(self) except 0
cdef class EventMouseOut:
cdef Evas_Event_Mouse_Out *obj
cdef readonly EventPosition position
#cdef class EventMouseOut:
# cdef Evas_Event_Mouse_Out *obj
# cdef readonly EventPosition position
cdef void _set_obj(self, void *ptr)
cdef void _unset_obj(self)
cdef int _check_validity(self) except 0
# cdef void _set_obj(self, void *ptr)
# cdef void _unset_obj(self)
# cdef int _check_validity(self) except 0
cdef class EventMouseDown:
cdef Evas_Event_Mouse_Down *obj
cdef readonly EventPosition position
#cdef class EventMouseDown:
# cdef Evas_Event_Mouse_Down *obj
# cdef readonly EventPosition position
cdef void _set_obj(self, void *ptr)
cdef void _unset_obj(self)
cdef int _check_validity(self) except 0
# cdef void _set_obj(self, void *ptr)
# cdef void _unset_obj(self)
# cdef int _check_validity(self) except 0
cdef class EventMouseUp:
cdef Evas_Event_Mouse_Up *obj
cdef readonly EventPosition position
#cdef class EventMouseUp:
# cdef Evas_Event_Mouse_Up *obj
# cdef readonly EventPosition position
cdef void _set_obj(self, void *ptr)
cdef void _unset_obj(self)
cdef int _check_validity(self) except 0
# cdef void _set_obj(self, void *ptr)
# cdef void _unset_obj(self)
# cdef int _check_validity(self) except 0
cdef class EventMouseMove:
cdef Evas_Event_Mouse_Move *obj
cdef readonly EventPosition position
cdef readonly EventPosition prev_position
#cdef class EventMouseMove:
# cdef Evas_Event_Mouse_Move *obj
# cdef readonly EventPosition position
# cdef readonly EventPosition prev_position
cdef void _set_obj(self, void *ptr)
cdef void _unset_obj(self)
cdef int _check_validity(self) except 0
# cdef void _set_obj(self, void *ptr)
# cdef void _unset_obj(self)
# cdef int _check_validity(self) except 0
cdef class EventMultiDown:
cdef Evas_Event_Multi_Down *obj
cdef readonly EventPrecisionPosition position
#cdef class EventMultiDown:
# cdef Evas_Event_Multi_Down *obj
# cdef readonly EventPrecisionPosition position
cdef void _set_obj(self, void *ptr)
cdef void _unset_obj(self)
cdef int _check_validity(self) except 0
# cdef void _set_obj(self, void *ptr)
# cdef void _unset_obj(self)
# cdef int _check_validity(self) except 0
cdef class EventMultiUp:
cdef Evas_Event_Multi_Up *obj
cdef readonly EventPrecisionPosition position
#cdef class EventMultiUp:
# cdef Evas_Event_Multi_Up *obj
# cdef readonly EventPrecisionPosition position
cdef void _set_obj(self, void *ptr)
cdef void _unset_obj(self)
cdef int _check_validity(self) except 0
# cdef void _set_obj(self, void *ptr)
# cdef void _unset_obj(self)
# cdef int _check_validity(self) except 0
cdef class EventMultiMove:
cdef Evas_Event_Multi_Move *obj
cdef readonly EventPrecisionPosition position
#cdef class EventMultiMove:
# cdef Evas_Event_Multi_Move *obj
# cdef readonly EventPrecisionPosition position
cdef void _set_obj(self, void *ptr)
cdef void _unset_obj(self)
cdef int _check_validity(self) except 0
# cdef void _set_obj(self, void *ptr)
# cdef void _unset_obj(self)
# cdef int _check_validity(self) except 0
cdef class EventMouseWheel:
cdef Evas_Event_Mouse_Wheel *obj
cdef readonly EventPosition position
#cdef class EventMouseWheel:
# cdef Evas_Event_Mouse_Wheel *obj
# cdef readonly EventPosition position
cdef void _set_obj(self, void *ptr)
cdef void _unset_obj(self)
cdef int _check_validity(self) except 0
# cdef void _set_obj(self, void *ptr)
# cdef void _unset_obj(self)
# cdef int _check_validity(self) except 0
cdef class EventKeyDown:
cdef Evas_Event_Key_Down *obj
#cdef class EventKeyDown:
# cdef Evas_Event_Key_Down *obj
cdef void _set_obj(self, void *ptr)
cdef void _unset_obj(self)
cdef int _check_validity(self) except 0
# cdef void _set_obj(self, void *ptr)
# cdef void _unset_obj(self)
# cdef int _check_validity(self) except 0
cdef class EventKeyUp:
cdef Evas_Event_Key_Up *obj
#cdef class EventKeyUp:
# cdef Evas_Event_Key_Up *obj
cdef void _set_obj(self, void *ptr)
cdef void _unset_obj(self)
cdef int _check_validity(self) except 0
# cdef void _set_obj(self, void *ptr)
# cdef void _unset_obj(self)
# cdef int _check_validity(self) except 0
cdef class EventHold:
cdef Evas_Event_Hold *obj
#cdef class EventHold:
# cdef Evas_Event_Hold *obj
cdef void _set_obj(self, void *ptr)
cdef void _unset_obj(self)
cdef int _check_validity(self) except 0
# cdef void _set_obj(self, void *ptr)
# cdef void _unset_obj(self)
# cdef int _check_validity(self) except 0

View File

@ -71,12 +71,15 @@ mapping_in = {
"Eo": "_Eo_Base",
}
conversions_in = {
conversions_in_python = {
# c_type: conversion
"bool": None,
"char": "if isinstance({0}, unicode): {0} = PyUnicode_AsUTF8String({0})",
"Evas_Object": None,
"Eo": None,
}
conversions_in_c = {
# c_type: conversion
"Evas_Object": "instance_from_object({0})",
"Eo": "instance_from_object({0})",
}
mapping_out = {
@ -93,7 +96,7 @@ conversions_out = {
"bool": "bool({0})",
"char": '{0}.decode("utf-8")',
"Elm_Object_Item *": 'object_item_to_python({0})',
"Evas_Object *": 'object_from_instance({0})',
"Evas_Object": 'object_from_instance({0})',
"Eo": 'object_from_instance({0})',
}
@ -102,14 +105,20 @@ def conv_cls_name(cls):
if cls.namespaces:
lib_name = ".".join(map(unicode.lower, cls.namespaces))
name = cls.name
if name[0].isdigit():
name = "_".join(cls.namespaces) + name
else:
s = cls.name.split("_")
if len(s) > 1:
lib_name = s[0]
name = "_".join(s[1:])
if name[0].isdigit():
name = lib_name + name
else:
lib_name = s
name = s
if name[0].isdigit():
name = "A" + name
return lib_name, name
@ -125,19 +134,26 @@ def convert_in_param(tp, param_name, is_nonull=None):
if tp.type == eolian.TypeType.POINTER:
tp = tp.base_type
if tp.type == eolian.TypeType.CLASS:
return None, "Eo", "{0}.obj".format(param_name)
return None, "_Eo", "instance_from_object({0})".format(param_name)
key = tp.name if tp.name else c_type
if key in builtin_types:
return "", c_type, param_name
return None, c_type, param_name
if not key in mapping_in:
raise EolianTypeError("Unknown IN type: %s" % (key))
conv_expr = conversions_in.get(key)
if conv_expr is not None:
conv_expr = conv_expr.format(param_name)
conv_expr_1 = conversions_in_python.get(key)
if conv_expr_1 is not None:
conv_expr_1 = conv_expr_1.format(param_name)
if keyword.iskeyword(param_name):
param_name += "_"
conv_expr_2 = conversions_in_c.get(key)
if conv_expr_2 is not None:
param_name = conv_expr_2.format(param_name)
conv_t = mapping_in[key]
#if conv_t is None:
@ -146,18 +162,14 @@ def convert_in_param(tp, param_name, is_nonull=None):
if not is_nonull:
key = "<{0}>{1} if {1} is not None else NULL".format(c_type, param_name)
if keyword.iskeyword(param_name):
param_name += "_"
return conv_expr, conv_t, param_name
return conv_expr_1, conv_t, param_name
def convert_out_param(tp, param_name):
if tp.type == eolian.TypeType.POINTER:
tp = tp.base_type
if tp.type == eolian.TypeType.CLASS:
# TODO: set obj
return tp.c_type, param_name
return tp.c_type, "object_from_instance(%s)" % (param_name)
key = tp.name if tp.name else tp.c_type
@ -204,25 +216,23 @@ def event_conversion_get(tp):
if tp.type == eolian.TypeType.POINTER:
tp = tp.base_type
if tp.type == eolian.TypeType.STRUCT:
#return "EventInfo%s" % tp.name
return "return <dict><%s>" % tp.c_type
elif tp.type == eolian.TypeType.REGULAR:
def get_alias(tp1):
#print(tp1.name, tp1.type)
alias = eolian.Type.alias_get_by_name(tp1.full_name)
if not alias:
log.error("Unhandled event %s type %s" % (tp.c_type, tp.type))
log.warn("Unhandled event %s type %s" % (tp.c_type, tp.type))
return
tp2 = alias.base_type
if tp2.type == eolian.TypeType.UNKNOWN:
log.error("UGH")
log.error("Event type unknown?!? %s" % (tp.c_type))
return
elif tp2.type == eolian.TypeType.STRUCT:
#print(tp2.name, tp2.c_type)
ret = "<dict>tmp"
return ret
else:
return get_alias(tp2)
return get_alias(tp)
else:
log.error("Unhandled event type %s" % (tp.type))
log.warn("Unhandled event type %s" % (tp.type))
return

View File

@ -2,7 +2,7 @@
import os
import textwrap
import keyword
from keyword import iskeyword
#from traceback import format_exc
from collections import Counter
@ -179,7 +179,7 @@ class PyxGenerator(Generator):
self.write(")")
self.dedent()
self.write("_eo_do_end(self.obj)")
self.write("_eo_do_end(&self.obj)")
class Function(object):
@ -197,30 +197,43 @@ class Function(object):
self.c_params = []
ret_type = None
ftypes = eolian.FunctionType
if (func.type == ftypes.PROP_SET or func.type == ftypes.PROPERTY) and not isget:
ret_type = func.return_type_get(eolian.FunctionType.PROP_SET)
self.c_name += "_set"
for p in func.parameters:
self.c_params.append((p.type.c_type, p.name))
name = p.name
if iskeyword(name):
name += "_"
self.c_params.append((p.type.c_type, name))
if (func.type == ftypes.PROP_GET or func.type == ftypes.PROPERTY) and isget:
ret_type = func.return_type_get(eolian.FunctionType.PROP_GET)
self.c_name += "_get"
for p in func.parameters:
self.c_params.append((p.type.c_type + "*", p.name))
else:
name = p.name
if iskeyword(name):
name += "_"
self.c_params.append((p.type.c_type + "*", name))
if func.type == ftypes.METHOD:
ret_type = func.return_type_get(eolian.FunctionType.METHOD)
for p in func.parameters:
self.c_params.append((p.type.c_type, p.name))
name = p.name
if iskeyword(name):
name += "_"
c_type = p.type.c_type
if p.direction == eolian.ParameterDir.OUT:
c_type += "*"
self.c_params.append((c_type, name))
self.c_ret_type = ret_type.c_type if ret_type else "void"
def cdef_generate(self, gen):
func = self.func
ftypes = eolian.FunctionType
if (func.type == ftypes.PROP_SET or func.type == ftypes.PROPERTY) and self.isget:
if func.type == ftypes.PROP_SET and self.isget:
return
if (func.type == ftypes.PROP_GET or func.type == ftypes.PROPERTY) and not self.isget:
if func.type == ftypes.PROP_GET and not self.isget:
return
rtype = self.c_ret_type
if not rtype:
@ -241,7 +254,7 @@ class Function(object):
c_call_params = []
return_params = []
expand_params = []
conv_in_exps = []
conv_in_py_exps = []
out_cdefs = []
@ -252,7 +265,7 @@ class Function(object):
if func.type == ftypes.METHOD:
py_name = func.name
if keyword.iskeyword(py_name): # Check if name is python reserved
if iskeyword(py_name): # Check if name is python reserved
py_name += "_"
func_params = func.parameters
@ -262,51 +275,77 @@ class Function(object):
di = p.direction
c_type = p.type.c_type
p_name = p.name
if iskeyword(p_name):
p_name += "_"
if di == eolian.ParameterDir.IN:
conv_expr, c_type, name = convert_in_param(p.type, p.name, p.is_nonull)
conv_in_exps.append(conv_expr)
header_params.append((c_type, p.name))
conv_expr_py, c_type, name = convert_in_param(p.type, p_name, p.is_nonull)
conv_in_py_exps.append(conv_expr_py)
header_params.append((c_type, p_name))
c_call_params.append(name)
elif di == eolian.ParameterDir.OUT:
out_cdefs.append((c_type, p.name))
c_type, name = convert_out_param(p.type, p.name)
c_type, name = convert_out_param(p.type, p_name)
c_call_params.append("&" + name)
return_params.append((p.type, name))
elif di == eolian.ParameterDir.INOUT:
conv_expr, c_type, name = convert_in_param(p.type, p.name, p.is_nonull)
header_params.append((c_type, p.name))
conv_expr_py, c_type, name = convert_in_param(p.type, p_name, p.is_nonull)
header_params.append((c_type, p_name))
c_call_params.append(name)
c_type, name = convert_out_param(p.type, p.name)
return_params.append((p.type, p.name))
c_type, name = convert_out_param(p.type, p_name)
return_params.append((p.type, p_name))
ret_type = func.return_type_get(eolian.FunctionType.METHOD)
if (func.type == ftypes.PROP_SET or func.type == ftypes.PROPERTY) and not self.isget:
py_name = "__set__"
c_name = "_".join((c_name, "set"))
expand_params = []
for p in list(func.property_values) + list(func.property_keys):
conv_expr, c_type, name = convert_in_param(p.type, p.name, p.is_nonull)
conv_in_exps.append(conv_expr)
expand_params.append(p.name)
c_call_params.append(p.name)
p_name = p.name
if iskeyword(p_name):
p_name += "_"
try:
conv_expr_py, c_type, name = convert_in_param(p.type, p_name, p.is_nonull)
except Exception:
gen.method_header_write(py_name, (("", "value"),))
gen.indent()
gen.write("pass")
gen.dedent()
raise
conv_in_py_exps.append(conv_expr_py)
expand_params.append((c_type, p_name))
c_call_params.append(name)
header_params = (("", "value"),)
ret_type = func.return_type_get(eolian.FunctionType.PROP_SET)
#ret_type = func.return_type_get(eolian.FunctionType.PROP_SET)
if (func.type == ftypes.PROP_GET or func.type == ftypes.PROPERTY) and self.isget:
py_name = "__get__"
c_name = "_".join((c_name, "get"))
for p in list(func.property_values) + list(func.property_keys):
c_type = p.type.c_type
name = p.name
if iskeyword(name):
name += "_"
out_cdefs.append((c_type, name))
c_call_params.append("&%s" % (name))
c_type, name = convert_out_param(p.type, name)
try:
c_type, name = convert_out_param(p.type, name)
except Exception:
gen.method_header_write(py_name, header_params)
gen.indent()
gen.write("pass")
gen.dedent()
raise
return_params.append((p.type, name))
ret_type = func.return_type_get(eolian.FunctionType.PROP_GET)
@ -318,10 +357,16 @@ class Function(object):
gen.indent()
if expand_params:
expand_params = ", ".join(expand_params)
gen.write("%s = value" % (expand_params))
tmp_prms = ", ".join(["tmp_prm%d" % (i) for i in range(len(expand_params))])
gen.write("%s = value" % (tmp_prms))
gen.write("cdef:")
gen.indent()
for i, (t, n) in enumerate(expand_params):
gen.write("%s %s = tmp_prm%d" % (t, n, i))
for e in conv_in_exps:
gen.dedent()
for e in conv_in_py_exps:
if e:
gen.write(e)
@ -337,13 +382,21 @@ class Function(object):
if return_params:
rparams = []
for t, n in return_params:
py_ret_type, c_ret_type = conv_type_ret(t)
rparams.append((c_ret_type, n))
name = n
if iskeyword(name):
name += "_"
try:
py_ret_type, c_ret_type = conv_type_ret(t)
except EolianTypeError:
gen.write("# FIXME: Unknown return type %s" % t.c_type)
gen.dedent()
raise
rparams.append((c_ret_type, name))
gen.write("return %s" % (", ".join([r[1] for r in rparams])))
elif ret_type:
ret = self.RET_PARAM
try:
ret_type = convert_out_param(ret_type, ret)
ret_type, ret = convert_out_param(ret_type, ret)
except EolianTypeError:
gen.write("# FIXME: Unknown return type %s" % ret_type.c_type)
gen.dedent()
@ -403,27 +456,24 @@ class Property(object):
try:
self.getter.generate(gen)
self.setter.generate(gen)
except Exception:
gen.write("pass")
gen.write()
raise
finally:
gen.dedent()
class Constructor(object):
def __init__(self, ctors, prefix):
def __init__(self, ctors, prefix, clsgetter):
self.prefix = prefix
self.ctors = ctors
self.clsgetter = clsgetter
def cdef_generate(self, gen):
pass
def generate(self, gen):
cls_get = self.prefix + "_class_get()"
cls_get = self.clsgetter
header_params = [("_Base", "parent=None")]
header_params = [("_Eo", "parent=None")]
c_ctors = []
for ctor in self.ctors:
@ -434,7 +484,7 @@ class Constructor(object):
c_call_params = []
py_name = func.name
if keyword.iskeyword(py_name): # Check if name is python reserved
if iskeyword(py_name): # Check if name is python reserved
py_name += "_"
ftypes = eolian.FunctionType
@ -447,7 +497,7 @@ class Constructor(object):
c_type = p.type.c_type
conv_expr, c_type, name = convert_in_param(p.type, p.name, p.is_nonull)
conv_expr_py, c_type, name = convert_in_param(p.type, p.name, p.is_nonull)
header_params.append((c_type, p.name))
c_call_params.append(name)
@ -457,14 +507,14 @@ class Constructor(object):
gen.write("def __init__(self, %s):" % (", ".join([" ".join((t, n)).strip() for t, n in header_params])))
gen.indent()
gen.write("cdef Eo *obj = eo_add_ref(")
gen.write("cdef Eo *added_obj = eo_add_ref(")
gen.indent()
gen.write("%s, parent.obj if parent is not None else NULL," % (cls_get))
gen.write("%s(), parent.obj if parent is not None else NULL," % (cls_get))
for ctor in c_ctors:
gen.write("%s(%s)" % (ctor[0], ctor[1]))
gen.write(")")
gen.dedent()
gen.write("self._set_obj(obj)")
gen.write("self._set_obj(added_obj)")
gen.dedent()
gen.write()
@ -492,6 +542,7 @@ class Class(object):
self.c_name = cls.name
self.full_c_name = cls.full_name
self.lib_name, self.name = conv_cls_name(cls)
self.cls_getter = cls.c_get_function_name
header_path = cls.filename
if not header_path:
@ -511,7 +562,7 @@ class Class(object):
self.prefix = prefix
if cls.type == eolian.ClassType.REGULAR: # or cls.type == eolian.ClassType.MIXIN:
self.ctor.append(Constructor(cls.constructors, prefix))
self.ctor.append(Constructor(cls.constructors, prefix, cls.c_get_function_name))
props = cls.functions_get(eolian.FunctionType.PROPERTY)
for prop in props:
@ -558,7 +609,9 @@ class Class(object):
return self
def cdefs_generate(self, gen):
if self.ctor or self.methods or self.props:
gen.write("const Eo_Class *%s()" % (self.cls_getter))
# gen.write("ctypedef Eo %s" % (self.full_c_name.replace(".", "_")))
if self.ctor or self.methods or self.props or self.events:
for o in self.ctor + self.methods + self.props + self.events:
try:
o.cdef_generate(gen)
@ -574,10 +627,9 @@ class Class(object):
i_cls.type == eolian.ClassType.MIXIN:
continue
if i_cls.full_name == "Eo.Base":
inherits.append("Eo")
inherits.append("_Eo")
continue
lib_name, name = conv_cls_name(i_cls)
#i = i.rpartition(".")[2]
inherits.append("_" + name)
else:
log.warn("Inherited class %s is unknown" % (i))
@ -591,11 +643,15 @@ class Class(object):
return
if not inherits:
inherits = ("object", )
inherits = ("_Eo", )
inherits = ", ".join(inherits)
gen.write("cdef class _%s(%s):" % (self.name, inherits))
gen.indent()
gen.write()
# gen.write("cdef %s *ext_cls_obj" % self.full_c_name.replace(".", "_"))
# gen.write()
if self.events:
gen.write("def __cinit__(self):")
@ -649,9 +705,10 @@ class Class(object):
gen.dedent()
gen.write()
#def py_generate(self, gen):
# --- Py class
inherits = ["_" + self.name]
imports = [(self.lib_name, "_" + self.name)]
#imports = [(self.lib_name, "_" + self.name)]
imports = []
for i in self.inherits:
i_cls = eolian.Class.get_by_name(i)
if i_cls:
@ -659,18 +716,17 @@ class Class(object):
i_cls.type == eolian.ClassType.ABSTRACT:
continue
lib_name, name = conv_cls_name(i_cls)
#i = i.rpartition(".")[2]
else:
log.warn("Class %s is unknown" % (i))
i = i.rpartition(".")
lib_name, name = i[0], i[2]
inherits.append("_" + name)
inherits.append(lib_name.replace(".", "_") + "_" + name)
imports.append((lib_name, "_" + name))
for l, n in imports:
l = PY_EFL_TOP_LEVEL_PACKAGE + "." + l.lower()
gen.write("from %s import %s" % (l, n))
l2 = PY_EFL_TOP_LEVEL_PACKAGE + "." + l.lower()
gen.write("from %s import %s as %s" % (l2, n, l.replace(".", "_") + n))
gen.write()
gen.write()
@ -714,7 +770,7 @@ class File(object):
for i in eolian.type_aliases_get_by_file(self.filepath):
base = i.base_type
if base.type == eolian.TypeType.REGULAR:
gen.write("ctypedef %s %s" % (i.name, base.name))
gen.write("ctypedef %s %s" % (base.name, i.name))
elif base.type == eolian.TypeType.FUNCTION:
ret_type = base.return_type
if ret_type:
@ -750,26 +806,26 @@ class File(object):
def pyx_generate(self):
self.gencls.pyx_generate(self.pyxgen)
path = [args.output]
path = []
cls_name = self.cls.name.lower()
filename = cls_name + ".pxi"
namespaces = []
filename = "generated_" + cls_name + ".pxi"
for ns in self.cls.namespaces:
namespaces.append(ns.lower())
if not namespaces:
path.append(ns.lower())
if not path:
log.warning("Class %s has no namespaces defined" % (self.cls.name))
nstmp = cls_name.partition("_")
namespace = nstmp[0]
filename = nstmp[2] + ".pxi"
else:
namespace = ".".join(namespaces)
filename = ".".join((namespace, filename))
path.append(filename)
pxi_path = os.path.join(*path)
path.append(nstmp[0])
filename = "generated_" + nstmp[2] + ".pxi"
# else:
# namespace = ".".join(namespaces)
# filename = ".".join((namespace, filename))
# path.append(filename)
path = os.path.join(*path)
pxi_path = os.path.join(args.output, path, filename)
self.pyxgen.printout(filepath=pxi_path)
generated_pxis.setdefault(namespace, []).append(pxi_path)
generated_pxis.setdefault(os.path.join(path), []).append((path, filename, self.cls))
# def py_generate(self):
# py_path = os.path.join(args.output, "__init__" + ".py")
@ -788,7 +844,7 @@ class Event(object):
def generate_name_mapping(self, gen):
gen.write(
'eina_hash_set(self.event_desc_mapping, "%s", %s)' % (
'eina_hash_add(self.event_desc_mapping, "%s", <const void *>%s)' % (
self.event.name, self.event.c_name
)
)
@ -797,7 +853,7 @@ class Event(object):
conv = event_conversion_get(self.event.type)
if conv:
gen.write(
'eina_hash_set(self.event_conv_mapping, %s, self._event_conv_%s_to_python)' % (
'eina_hash_add(self.event_conv_mapping, %s, <const void *>self._event_conv_%s_to_python)' % (
self.event.c_name, self.event.name.replace(",", "_")
)
)
@ -824,9 +880,6 @@ generated_class_counter = Counter()
function_counter = Counter()
generated_function_counter = Counter()
py_path = os.path.join(args.output, "__init__" + ".py")
if os.path.exists(py_path):
os.remove(py_path)
for path in args.paths:
for dirpath, dirnames, filenames in os.walk(path):
@ -865,13 +918,18 @@ for path in args.paths:
# continue
for ns, pxis in generated_pxis.items():
filename = os.path.join(args.output, "generated_" + ns + ".pxi")
for pxis in generated_pxis.values():
ns, pxi_path, cls = pxis[0]
filename = os.path.join(args.output, ns, "generated_classes.pxi")
if os.path.exists(filename):
log.error("File %s exists, removing" % (filename))
log.warn("File %s exists, removing" % (filename))
os.remove(filename)
with open(filename, "a") as f:
for pxi in pxis:
line = 'include "%s"\n' % (pxi)
# for ns, pxi_path, cls in pxis:
# line = "ctypedef Eo %s\n" % (cls.full_name.replace(".", "_"))
# f.write(line)
for ns, pxi_path, cls in pxis:
line = 'include "%s"\n' % (pxi_path)
f.write(line)

220
setup.py
View File

@ -239,6 +239,20 @@ if set(("build", "build_ext", "install", "bdist", "sdist")) & set(sys.argv):
packages.append("efl.utils")
packages.append("efl.utils.enum")
# === Efl (interfaces) ===
eo_cflags, eo_libs = pkg_config('Efl', 'efl', EFL_MIN_VERSION)
eo_ext = Extension(
"efl.__init__", ["efl/efl/__init__" + module_suffix],
define_macros=[
('EFL_BETA_API_SUPPORT', 1),
('EFL_EO_API_SUPPORT', 1),
],
include_dirs=['include/'],
extra_compile_args=eo_cflags,
extra_link_args=eo_libs + eina_libs
)
modules.append(eo_ext)
# === Evas ===
evas_cflags, evas_libs = pkg_config('Evas', 'evas', EFL_MIN_VERSION)
evas_ext = Extension(
@ -249,19 +263,19 @@ if set(("build", "build_ext", "install", "bdist", "sdist")) & set(sys.argv):
)
modules.append(evas_ext)
# === Ecore ===
ecore_cflags, ecore_libs = pkg_config('Ecore', 'ecore', EFL_MIN_VERSION)
ecore_file_cflags, ecore_file_libs = pkg_config(
'EcoreFile', 'ecore-file', EFL_MIN_VERSION)
ecore_exts = [
Extension(
"ecore.__init__", ["efl/ecore/__init__" + module_suffix],
include_dirs=['include/'],
extra_compile_args=list(set(ecore_cflags + ecore_file_cflags)),
extra_link_args=ecore_libs + ecore_file_libs + eina_libs +
evas_libs
),
]
# # === Ecore ===
# ecore_cflags, ecore_libs = pkg_config('Ecore', 'ecore', EFL_MIN_VERSION)
# ecore_file_cflags, ecore_file_libs = pkg_config(
# 'EcoreFile', 'ecore-file', EFL_MIN_VERSION)
# ecore_exts = [
# Extension(
# "ecore.__init__", ["efl/ecore/__init__" + module_suffix],
# include_dirs=['include/'],
# extra_compile_args=list(set(ecore_cflags + ecore_file_cflags)),
# extra_link_args=ecore_libs + ecore_file_libs + eina_libs +
# evas_libs
# ),
# ]
try:
ecore_input_cflags, ecore_input_libs = pkg_config(
'EcoreInput', 'ecore-input', EFL_MIN_VERSION)
@ -269,88 +283,92 @@ if set(("build", "build_ext", "install", "bdist", "sdist")) & set(sys.argv):
'EcoreX', 'ecore-x', EFL_MIN_VERSION)
except SystemExit: # FIXME: Change pkg-config to return a value
pass
else:
ecore_exts.append(
Extension(
"ecore.x", ["efl/ecore/x" + module_suffix],
include_dirs=['include/'],
extra_compile_args=
list(set(
ecore_cflags + ecore_file_cflags + ecore_x_cflags +
ecore_input_cflags
)),
extra_link_args=
ecore_libs + ecore_file_libs + ecore_x_libs +
ecore_input_libs +
eina_libs + evas_libs,
)
)
modules += ecore_exts
packages.append("efl.ecore")
# else:
# ecore_exts.append(
# Extension(
# "ecore.x", ["efl/ecore/x" + module_suffix],
# include_dirs=['include/'],
# extra_compile_args=
# list(set(
# ecore_cflags + ecore_file_cflags + ecore_x_cflags +
# ecore_input_cflags
# )),
# extra_link_args=
# ecore_libs + ecore_file_libs + ecore_x_libs +
# ecore_input_libs +
# eina_libs + evas_libs,
# )
# )
# modules += ecore_exts
# packages.append("efl.ecore")
# === Ethumb ===
ethumb_cflags, ethumb_libs = pkg_config(
'Ethumb', 'ethumb', EFL_MIN_VERSION)
ethumb_ext = Extension(
"ethumb", ["efl/ethumb/efl.ethumb" + module_suffix],
include_dirs=['include/'],
extra_compile_args=ethumb_cflags,
extra_link_args=ethumb_libs + eina_libs,
)
modules.append(ethumb_ext)
# # === Ethumb ===
# ethumb_cflags, ethumb_libs = pkg_config(
# 'Ethumb', 'ethumb', EFL_MIN_VERSION)
# ethumb_ext = Extension(
# "ethumb", ["efl/ethumb/efl.ethumb" + module_suffix],
# include_dirs=['include/'],
# extra_compile_args=ethumb_cflags,
# extra_link_args=ethumb_libs + eina_libs,
# )
# modules.append(ethumb_ext)
ethumb_client_cflags, ethumb_client_libs = pkg_config(
'Ethumb_Client', 'ethumb_client', EFL_MIN_VERSION)
ethumb_client_ext = Extension(
"ethumb_client", ["efl/ethumb/efl.ethumb_client" + module_suffix],
include_dirs=['include/'],
extra_compile_args=ethumb_client_cflags,
extra_link_args=ethumb_client_libs + eina_libs,
)
modules.append(ethumb_client_ext)
# ethumb_client_cflags, ethumb_client_libs = pkg_config(
# 'Ethumb_Client', 'ethumb_client', EFL_MIN_VERSION)
# ethumb_client_ext = Extension(
# "ethumb_client", ["efl/ethumb/efl.ethumb_client" + module_suffix],
# include_dirs=['include/'],
# extra_compile_args=ethumb_client_cflags,
# extra_link_args=ethumb_client_libs + eina_libs,
# )
# modules.append(ethumb_client_ext)
# === Edje ===
edje_cflags, edje_libs = pkg_config('Edje', 'edje', EFL_MIN_VERSION)
edje_ext = Extension(
"edje", ["efl/edje/efl.edje" + module_suffix],
include_dirs=['include/'],
extra_compile_args=edje_cflags,
extra_link_args=edje_libs + eina_libs + evas_libs,
)
modules.append(edje_ext)
# # === Edje ===
# edje_cflags, edje_libs = pkg_config('Edje', 'edje', EFL_MIN_VERSION)
# edje_ext = Extension(
# "edje", ["efl/edje/efl.edje" + module_suffix],
# include_dirs=['include/'],
# extra_compile_args=edje_cflags,
# extra_link_args=edje_libs + eina_libs + evas_libs,
# )
# modules.append(edje_ext)
# --- Edje_Edit ---
edje_edit_ext = Extension(
"edje_edit", ["efl/edje/efl.edje_edit" + module_suffix],
define_macros=[('EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT', None)],
include_dirs=['include/'],
extra_compile_args=edje_cflags,
extra_link_args=edje_libs + eina_libs + evas_libs,
)
modules.append(edje_edit_ext)
# # --- Edje_Edit ---
# edje_edit_ext = Extension(
# "edje_edit", ["efl/edje/efl.edje_edit" + module_suffix],
# define_macros=[('EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT', None)],
# include_dirs=['include/'],
# extra_compile_args=edje_cflags,
# extra_link_args=edje_libs + eina_libs + evas_libs,
# )
# modules.append(edje_edit_ext)
# === Emotion ===
emotion_cflags, emotion_libs = pkg_config(
'Emotion', 'emotion', EFL_MIN_VERSION)
emotion_ext = Extension(
"emotion", ["efl/emotion/efl.emotion" + module_suffix],
include_dirs=['include/'],
extra_compile_args=emotion_cflags,
extra_link_args=emotion_libs +
eina_libs + evas_libs,
)
modules.append(emotion_ext)
# # === Emotion ===
# emotion_cflags, emotion_libs = pkg_config(
# 'Emotion', 'emotion', EFL_MIN_VERSION)
# emotion_ext = Extension(
# "emotion", ["efl/emotion/efl.emotion" + module_suffix],
# define_macros=[
# ('EFL_BETA_API_SUPPORT', 1),
# ('EFL_EO_API_SUPPORT', 1),
# ],
# include_dirs=['include/'],
# extra_compile_args=emotion_cflags,
# extra_link_args=emotion_libs +
# eina_libs + evas_libs,
# )
# modules.append(emotion_ext)
# === dbus mainloop integration ===
dbus_cflags, dbus_libs = pkg_config('DBus', 'dbus-python', "0.83.0")
dbus_ml_ext = Extension(
"dbus_mainloop",
["efl/dbus_mainloop/dbus_mainloop" + module_suffix,
"efl/dbus_mainloop/e_dbus.c"],
extra_compile_args=list(set(dbus_cflags + ecore_cflags)),
extra_link_args=dbus_libs + ecore_libs,
)
modules.append(dbus_ml_ext)
# # === dbus mainloop integration ===
# dbus_cflags, dbus_libs = pkg_config('DBus', 'dbus-python', "0.83.0")
# dbus_ml_ext = Extension(
# "dbus_mainloop",
# ["efl/dbus_mainloop/dbus_mainloop" + module_suffix,
# "efl/dbus_mainloop/e_dbus.c"],
# extra_compile_args=list(set(dbus_cflags + ecore_cflags)),
# extra_link_args=dbus_libs + ecore_libs,
# )
# modules.append(dbus_ml_ext)
# === Elementary ===
elm_mods = (
@ -427,19 +445,19 @@ if set(("build", "build_ext", "install", "bdist", "sdist")) & set(sys.argv):
"window",
)
elm_cflags, elm_libs = pkg_config(
'Elementary', 'elementary', ELM_MIN_VERSION)
for m in elm_mods:
e = Extension(
"elementary." + m,
["efl/elementary/" + m + module_suffix],
include_dirs=["include/"],
extra_compile_args=elm_cflags + ecore_x_cflags,
extra_link_args=elm_libs + eina_libs + evas_libs,
)
modules.append(e)
# elm_cflags, elm_libs = pkg_config(
# 'Elementary', 'elementary', ELM_MIN_VERSION)
# for m in elm_mods:
# e = Extension(
# "elementary." + m,
# ["efl/elementary/" + m + module_suffix],
# include_dirs=["include/"],
# extra_compile_args=elm_cflags + ecore_x_cflags,
# extra_link_args=elm_libs + eina_libs + evas_libs,
# )
# modules.append(e)
packages.append("efl.elementary")
# packages.append("efl.elementary")
setup(