mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
codegen/: Added code to ignore type and the function/methods/classes that use them.
Original commit message from CVS: * codegen/codegen.py: * codegen/override.py: Added code to ignore type and the function/methods/classes that use them. * gst/gst.override: ignore methods/classes/types depending on how GStreamer core was built: _ GST_DISABLE_GST_DEBUG _ GST_DISABLE_LOADSAVE _ GST_DISABLE_PARSE
This commit is contained in:
parent
6dc2d5f8fe
commit
b01b9197c7
4 changed files with 51 additions and 5 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2006-05-09 Edward Hervey <edward@fluendo.com>
|
||||
|
||||
* codegen/codegen.py:
|
||||
* codegen/override.py:
|
||||
Added code to ignore type and the function/methods/classes that use
|
||||
them.
|
||||
* gst/gst.override:
|
||||
ignore methods/classes/types depending on how GStreamer core was built:
|
||||
_ GST_DISABLE_GST_DEBUG
|
||||
_ GST_DISABLE_LOADSAVE
|
||||
_ GST_DISABLE_PARSE
|
||||
|
||||
2006-05-09 Edward Hervey <edward@fluendo.com>
|
||||
|
||||
* testsuite/python.supp:
|
||||
|
|
|
@ -220,6 +220,8 @@ class Wrapper:
|
|||
return { 'name': '%s.%s' % (self.objinfo.c_name, method.name) }
|
||||
|
||||
def write_class(self):
|
||||
if self.overrides.is_type_ignored(self.objinfo.c_name):
|
||||
return
|
||||
self.fp.write('\n/* ----------- ' + self.objinfo.c_name + ' ----------- */\n\n')
|
||||
substdict = self.get_initial_class_substdict()
|
||||
if not substdict.has_key('tp_flags'):
|
||||
|
@ -1081,12 +1083,14 @@ def write_classes(parser, overrides, fp):
|
|||
instance.write_class()
|
||||
fp.write('\n')
|
||||
|
||||
def write_enums(parser, prefix, fp=sys.stdout):
|
||||
def write_enums(parser, overrides, prefix, fp=sys.stdout):
|
||||
if not parser.enums:
|
||||
return
|
||||
fp.write('\n/* ----------- enums and flags ----------- */\n\n')
|
||||
fp.write('void\n' + prefix + '_add_constants(PyObject *module, const gchar *strip_prefix)\n{\n')
|
||||
for enum in parser.enums:
|
||||
if overrides.is_type_ignored(enum.c_name):
|
||||
continue
|
||||
if enum.typecode is None:
|
||||
for nick, value in enum.values:
|
||||
fp.write(' PyModule_AddIntConstant(module, pyg_constant_strip_prefix("%s", strip_prefix), %s);\n'
|
||||
|
@ -1131,7 +1135,7 @@ def write_extension_init(overrides, prefix, fp):
|
|||
fp.write(overrides.get_init() + '\n')
|
||||
fp.resetline()
|
||||
|
||||
def write_registers(parser, fp):
|
||||
def write_registers(parser, overrides, fp):
|
||||
for boxed in parser.boxes:
|
||||
fp.write(' pyg_register_boxed(d, "' + boxed.name +
|
||||
'", ' + boxed.typecode + ', &Py' + boxed.c_name + '_Type);\n')
|
||||
|
@ -1158,6 +1162,8 @@ def write_registers(parser, fp):
|
|||
else:
|
||||
pos = pos + 1
|
||||
for obj in objects:
|
||||
if overrides.is_type_ignored(obj.c_name):
|
||||
continue
|
||||
bases = []
|
||||
if obj.parent != None:
|
||||
bases.append(obj.parent)
|
||||
|
@ -1204,9 +1210,9 @@ def write_source(parser, overrides, prefix, fp=FileOutput(sys.stdout)):
|
|||
wrapper = Wrapper(parser, None, overrides, fp)
|
||||
wrapper.write_functions(prefix)
|
||||
|
||||
write_enums(parser, prefix, fp)
|
||||
write_enums(parser, overrides, prefix, fp)
|
||||
write_extension_init(overrides, prefix, fp)
|
||||
write_registers(parser, fp)
|
||||
write_registers(parser, overrides, fp)
|
||||
|
||||
def register_types(parser):
|
||||
for boxed in parser.boxes:
|
||||
|
|
|
@ -26,6 +26,7 @@ class Overrides:
|
|||
self.modulename = None
|
||||
self.ignores = {}
|
||||
self.glob_ignores = []
|
||||
self.type_ignores = {}
|
||||
self.overrides = {}
|
||||
self.overridden = {}
|
||||
self.kwargs = {}
|
||||
|
@ -109,6 +110,13 @@ class Overrides:
|
|||
self.glob_ignores.append(func)
|
||||
for func in string.split(rest):
|
||||
self.glob_ignores.append(func)
|
||||
elif (command == 'ignore-type' or
|
||||
command == 'ignore-type-' + sys.platform):
|
||||
"ignore-type/ignore-type-platform [typenames..]"
|
||||
for typename in words[1:]:
|
||||
self.type_ignores[typename] = 1
|
||||
for typename in string.split(rest):
|
||||
self.type_ignores[typename] = 1
|
||||
elif command == 'override':
|
||||
"override function/method [kwargs,noargs]"
|
||||
func = words[1]
|
||||
|
@ -180,6 +188,9 @@ class Overrides:
|
|||
return 1
|
||||
return 0
|
||||
|
||||
def is_type_ignored(self, name):
|
||||
return name in self.type_ignores
|
||||
|
||||
def is_overriden(self, name):
|
||||
return self.overrides.has_key(name)
|
||||
|
||||
|
|
|
@ -204,6 +204,7 @@ static PyObject *
|
|||
pygst_debug_log (PyObject *pyobject, PyObject *string, GstDebugLevel level,
|
||||
gboolean isgstobject)
|
||||
{
|
||||
#ifndef GST_DISABLE_GST_DEBUG
|
||||
gchar *str;
|
||||
gchar *function;
|
||||
gchar *filename;
|
||||
|
@ -227,6 +228,7 @@ pygst_debug_log (PyObject *pyobject, PyObject *string, GstDebugLevel level,
|
|||
if (filename)
|
||||
g_free(filename);
|
||||
Py_INCREF (Py_None);
|
||||
#endif
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
|
@ -308,12 +310,27 @@ ignore
|
|||
gst_plugin_get_module
|
||||
gst_object_sink
|
||||
gst_version
|
||||
#ifdef GST_DISABLE_LOADSAVE
|
||||
%%
|
||||
ignore-glob
|
||||
gst_xml_*
|
||||
%%
|
||||
ignore-type
|
||||
GstXML
|
||||
#endif
|
||||
#ifdef GST_DISABLE_PARSE
|
||||
%%
|
||||
ignore-glob
|
||||
gst_parse_*
|
||||
%%
|
||||
ignore-type
|
||||
GstParseError
|
||||
#endif
|
||||
%%
|
||||
/*
|
||||
Magic to be able to use bugfixes of new releases without having to use
|
||||
newer core/base
|
||||
*/
|
||||
#warn your mom !
|
||||
ignore
|
||||
#if (GST_VERSION_MICRO < 5)
|
||||
# if (GST_VERSION_MICRO < 4)
|
||||
|
|
Loading…
Reference in a new issue