Modifications to have parallel-installable gst-python

Original commit message from CVS:
* Makefile.am:
* configure.ac:
* gst/Makefile.am:
* pygst.py.in:
Modifications to have parallel-installable gst-python
Works more or less in the same way as pygtk:
import pygst
pygst.require('0.9')
import gst
This commit is contained in:
Edward Hervey 2005-07-01 10:47:25 +00:00
parent b35b212bf8
commit f3ec338b76
6 changed files with 90 additions and 3 deletions

View file

@ -1,3 +1,16 @@
2005-07-01 Edward Hervey <edward@fluendo.com>
* Makefile.am:
* configure.ac:
* gst/Makefile.am:
* pygst.py.in:
Modifications to have parallel-installable gst-python
Works more or less in the same way as pygtk:
import pygst
pygst.require('0.9')
import gst
2005-06-28 Edward Hervey <edward@fluendo.com>
* gst/pygstminiobject.c:

View file

@ -18,3 +18,16 @@ EXTRA_DIST = \
RELEASE
include $(top_srcdir)/common/release.mak
# install pth file.
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(pythondir)
echo "gst-$(GST_MAJORMINOR)" > $(DESTDIR)$(pyexecdir)/pygst.pth
install-exec-local:
$(mkinstalldirs) $(DESTDIR)$(pyexecdir)
echo "gst-$(GST_MAJORMINOR)" > $(DESTDIR)$(pyexecdir)/pygst.pth
uninstall-local:
rm -f $(DESTDIR)$(pythondir)/pygst.pth $(DESTDIR)$(pyexecdir)/pygst.pth
# this file is common to all pygtk versions.
pyexec_PYTHON = pygst.py

2
common

@ -1 +1 @@
Subproject commit d6e46b214fac0ecb46010ff522af2f7653e1c18e
Subproject commit 4ca96aedcf2be0b3dcf31fce732aed1da21b8850

View file

@ -160,6 +160,9 @@ fi
PYGST_CFLAGS="$PYGST_ERROR_CFLAGS"
AC_SUBST(PYGST_CFLAGS)
dnl full installation path
AS_AC_EXPAND(PYTHONDIR, $pythondir)
dnl add debugging options ...
changequote(,)dnl
if test "x$GCC" = xyes; then
@ -188,4 +191,5 @@ AC_OUTPUT([
docs/gst-python.ent
testsuite/Makefile
gst-python.spec
pygst.py
])

View file

@ -2,8 +2,8 @@ common_cflags = $(PYGTK_CFLAGS) $(GST_CFLAGS) $(PYGST_CFLAGS) -fno-strict-aliasi
common_libadd = $(GST_LIBS)
common_ldflags = -module -avoid-version
pkgpythondir = $(pythondir)/gst
pkgpyexecdir = $(pyexecdir)/gst
pkgpythondir = $(pythondir)/gst-$(GST_MAJORMINOR)/gst
pkgpyexecdir = $(pyexecdir)/gst-$(GST_MAJORMINOR)/gst
pygstdir = $(pkgpythondir)
pygst_PYTHON = __init__.py

57
pygst.py.in Normal file
View file

@ -0,0 +1,57 @@
# -*- Mode: Python; py-indent-offset: 4 -*-
# pygtk - Python bindings for the GTK+ widget set.
# Copyright (C) 1998-2002 James Henstridge
# (C) 2005 Edward Hervey
#
# pygst.py: pygst version selection code.
#
# 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 2 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 General Public License for more details.
#
# You should have received a copy of the GNU 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 allows parallel installation of gst-python
#
# In order to have backward compatibility
import fnmatch
import glob
import os
import sys
__all__ = ['require']
_pygst_dir = '@PYTHONDIR@/gst-@GST_MAJORMINOR@'
_pygst_version = '@GST_MAJORMINOR@'
_pygst_required_version = None
def require(version):
global _pygst_required_version
if _pygst_required_version != None:
assert _pygst_required_version == version, \
"a different version of gst was already required"
return
assert not sys.modules.has_key('gst'), \
"pygst.require() must be called before importing gst"
assert version == _pygst_version, \
"Only version '%s' is available" % version
# prepend the pygst path ...
sys.path.insert(0, _pygst_dir)
_pygst_required_version = version