bindings: Start implementing overrides for python

This commit is contained in:
Thibault Saunier 2012-09-14 01:05:45 +02:00
parent 3afd8fb88a
commit df4040a106
10 changed files with 166 additions and 1 deletions

View file

@ -1,6 +1,6 @@
DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
SUBDIRS = ges tests tools common m4 pkgconfig docs SUBDIRS = ges tests tools common m4 pkgconfig docs bindings
DIST_SUBDIRS = $(SUBDIRS) DIST_SUBDIRS = $(SUBDIRS)

6
bindings/Makefile.am Normal file
View file

@ -0,0 +1,6 @@
SUBDIRS =
if WITH_PYTHON
SUBDIRS += python
endif

View file

@ -0,0 +1,5 @@
SUBDIRS = gi
if BUILD_EXAMPLES
SUBDIRS += examples
endif

View file

View file

@ -0,0 +1 @@
SUBDIRS = overrides

View file

@ -0,0 +1,29 @@
#!/usr/bin/env python
#
# __init__.py
#
# Copyright (C) 2012 Thibault Saunier <thibaul.saunier@collabora.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

View file

@ -0,0 +1,64 @@
# -*- Mode: Python; py-indent-offset: 4 -*-
# vim: tabstop=4 shiftwidth=4 expandtab
#
# GES.py
#
# Copyright (C) 2012 Thibault Saunier <thibault.saunier@collabora.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
import sys
from ..overrides import override
from ..importer import modules
if sys.version_info >= (3, 0):
_basestring = str
_callable = lambda c: hasattr(c, '__call__')
else:
_basestring = basestring
_callable = callable
GES = modules['GES']._introspection_module
__all__ = []
if GES._version == '0.10':
import warnings
warn_msg = "You have imported the GES 0.10 module. Because GES 0.10 \
was not designed for use with introspection some of the \
interfaces and API will fail. As such this is not supported \
by the GStreamer development team and we encourage you to \
port your app to GES 1 or greater. static python bindings is the recomended \
python module to use with GES 0.10"
warnings.warn(warn_msg, RuntimeWarning)
try:
from gi.repository import Gst
Gst
except:
raise RuntimeError("GSt couldn't be imported, make sure you have gst-python installed")
initialized = GES.init()
if not initialized:
raise RuntimeError("GES couldn't be initialized, make sure you have gst-python installed")

View file

@ -0,0 +1,4 @@
pygesdir = $(pkgpyexecdir)
pyges_PYTHON = GES.py
EXTRA_DIST = GES.py

View file

@ -0,0 +1,29 @@
#!/usr/bin/env python
#
# __init__.py
#
# Copyright (C) 2012 Thibault Saunier <thibaul.saunier@collabora.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
print __path__, __name__

View file

@ -107,8 +107,30 @@ GOBJECT_INTROSPECTION_CHECK([0.9.6])
dnl check for documentation tools dnl check for documentation tools
AG_GST_DOCBOOK_CHECK AG_GST_DOCBOOK_CHECK
GTK_DOC_CHECK([1.3]) GTK_DOC_CHECK([1.3])
AS_PATH_PYTHON([2.1])
AG_GST_PLUGIN_DOCS([1.3],[2.1]) AG_GST_PLUGIN_DOCS([1.3],[2.1])
dnl check for python
AM_PATH_PYTHON
AC_MSG_CHECKING(for python >= 2.3)
prog="
import sys, string
minver = (2,3,0,'final',0)
if sys.version_info < minver:
sys.exit(1)
sys.exit(0)"
if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
then
HAVE_PYTHON=yes
AC_MSG_RESULT(okay)
else
HAVE_PYTHON=no
AC_MSG_RESULT(no python)
fi
AM_CONDITIONAL(WITH_PYTHON, [test "x$HAVE_PYTHON" = "xyes"])
dnl *** checks for libraries *** dnl *** checks for libraries ***
dnl check for libm, for sin() etc. dnl check for libm, for sin() etc.
@ -321,5 +343,10 @@ docs/libs/Makefile
pkgconfig/Makefile pkgconfig/Makefile
pkgconfig/gst-editing-services.pc pkgconfig/gst-editing-services.pc
pkgconfig/gst-editing-services-uninstalled.pc pkgconfig/gst-editing-services-uninstalled.pc
bindings/Makefile
bindings/python/Makefile
bindings/python/gi/Makefile
bindings/python/gi/overrides/Makefile
bindings/python/examples/Makefile
) )
AC_OUTPUT AC_OUTPUT