diff --git a/Makefile.am b/Makefile.am index f32edf7f4d..c4d7ae05ba 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ 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) diff --git a/bindings/Makefile.am b/bindings/Makefile.am new file mode 100644 index 0000000000..be927819a0 --- /dev/null +++ b/bindings/Makefile.am @@ -0,0 +1,6 @@ +SUBDIRS = + +if WITH_PYTHON + SUBDIRS += python +endif + diff --git a/bindings/python/Makefile.am b/bindings/python/Makefile.am new file mode 100644 index 0000000000..22bf444c77 --- /dev/null +++ b/bindings/python/Makefile.am @@ -0,0 +1,5 @@ +SUBDIRS = gi + +if BUILD_EXAMPLES +SUBDIRS += examples +endif diff --git a/bindings/python/examples/Makefile.am b/bindings/python/examples/Makefile.am new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bindings/python/gi/Makefile.am b/bindings/python/gi/Makefile.am new file mode 100644 index 0000000000..eeba093438 --- /dev/null +++ b/bindings/python/gi/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = overrides diff --git a/bindings/python/gi/__init__.py b/bindings/python/gi/__init__.py new file mode 100644 index 0000000000..09d180b676 --- /dev/null +++ b/bindings/python/gi/__init__.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# +# __init__.py +# +# Copyright (C) 2012 Thibault Saunier +# +# 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__) diff --git a/bindings/python/gi/overrides/GES.py b/bindings/python/gi/overrides/GES.py new file mode 100644 index 0000000000..4cffe4a58f --- /dev/null +++ b/bindings/python/gi/overrides/GES.py @@ -0,0 +1,64 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# GES.py +# +# Copyright (C) 2012 Thibault Saunier +# +# 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") + + diff --git a/bindings/python/gi/overrides/Makefile.am b/bindings/python/gi/overrides/Makefile.am new file mode 100644 index 0000000000..c876b5e9e5 --- /dev/null +++ b/bindings/python/gi/overrides/Makefile.am @@ -0,0 +1,4 @@ +pygesdir = $(pkgpyexecdir) +pyges_PYTHON = GES.py + +EXTRA_DIST = GES.py diff --git a/bindings/python/gi/overrides/__init__.py b/bindings/python/gi/overrides/__init__.py new file mode 100644 index 0000000000..5a1c721dfa --- /dev/null +++ b/bindings/python/gi/overrides/__init__.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# +# __init__.py +# +# Copyright (C) 2012 Thibault Saunier +# +# 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__ diff --git a/configure.ac b/configure.ac index fe6067613e..5e1cdd63c7 100644 --- a/configure.ac +++ b/configure.ac @@ -107,8 +107,30 @@ GOBJECT_INTROSPECTION_CHECK([0.9.6]) dnl check for documentation tools AG_GST_DOCBOOK_CHECK GTK_DOC_CHECK([1.3]) +AS_PATH_PYTHON([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 check for libm, for sin() etc. @@ -321,5 +343,10 @@ docs/libs/Makefile pkgconfig/Makefile pkgconfig/gst-editing-services.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