[pygobject] Make codegen report errors using Python function/method names
- From: Paul Pogonyshev <paulp src gnome org>
- To: svn-commits-list gnome org
- Subject: [pygobject] Make codegen report errors using Python function/method names
- Date: Fri, 12 Jun 2009 17:00:00 -0400 (EDT)
commit 07e9c18dc092f6546230168b6b69c1b3454e120a
Author: Paul Pogonyshev <pogonyshev gmx net>
Date: Sun May 31 18:56:55 2009 +0300
Make codegen report errors using Python function/method names
Part of bug #584289.
codegen/codegen.py | 9 +++++----
codegen/definitions.py | 10 +++++++++-
2 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/codegen/codegen.py b/codegen/codegen.py
index bf5dfc5..73324a5 100755
--- a/codegen/codegen.py
+++ b/codegen/codegen.py
@@ -249,10 +249,11 @@ class Wrapper:
def get_initial_class_substdict(self): return {}
def get_initial_constructor_substdict(self, constructor):
- return { 'name': '%s.__init__' % self.objinfo.c_name,
+ return { 'name': '%s.__init__' % self.objinfo.py_name,
'errorreturn': '-1' }
+
def get_initial_method_substdict(self, method):
- substdict = { 'name': '%s.%s' % (self.objinfo.c_name, method.name) }
+ substdict = { 'name': '%s.%s' % (self.objinfo.py_name, method.name) }
if method.unblock_threads:
substdict['begin_allow_threads'] = 'pyg_begin_allow_threads;'
substdict['end_allow_threads'] = 'pyg_end_allow_threads;'
@@ -467,7 +468,7 @@ class Wrapper:
def _get_class_virtual_substdict(self, meth, cname, parent):
substdict = self.get_initial_method_substdict(meth)
- substdict['virtual'] = substdict['name'].split('.')[1]
+ substdict['virtual'] = meth.name
substdict['cname'] = cname
substdict['class_cast_macro'] = parent.typecode.replace(
'_TYPE_', '_', 1) + "_CLASS"
@@ -1133,7 +1134,7 @@ class GInterfaceWrapper(GObjectWrapper):
def _get_class_virtual_substdict(self, meth, cname, parent):
substdict = self.get_initial_method_substdict(meth)
- substdict['virtual'] = substdict['name'].split('.')[1]
+ substdict['virtual'] = meth.name
substdict['cname'] = cname
substdict['typecode'] = self.objinfo.typecode
substdict['vtable'] = self.objinfo.vtable
diff --git a/codegen/definitions.py b/codegen/definitions.py
index 88b6cdb..aca5adb 100644
--- a/codegen/definitions.py
+++ b/codegen/definitions.py
@@ -60,15 +60,23 @@ class Property(object):
self.argname = old.argname
-class Definition:
+class Definition(object):
docstring = "NULL"
+
+ def py_name(self):
+ return '%s.%s' % (self.module, self.name)
+
+ py_name = property(py_name)
+
def __init__(self, *args):
"""Create a new defs object of this type. The arguments are the
components of the definition"""
raise RuntimeError, "this is an abstract class"
+
def merge(self, old):
"""Merge in customisations from older version of definition"""
raise RuntimeError, "this is an abstract class"
+
def write_defs(self, fp=sys.stdout):
"""write out this definition in defs file format"""
raise RuntimeError, "this is an abstract class"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]