wingo - in flumotion/trunk: . flumotion/common pkgconfig
flumotion-commit at lists.fluendo.com
flumotion-commit at lists.fluendo.com
Tue Feb 6 15:00:36 CET 2007
Author: wingo
Date: Tue Feb 6 15:00:32 2007
New Revision: 4461
Added:
flumotion/trunk/flumotion/common/boot.py
- copied, changed from r4459, flumotion/trunk/flumotion/common/boot.py.in
Removed:
flumotion/trunk/flumotion/common/boot.py.in
Modified:
flumotion/trunk/ChangeLog
flumotion/trunk/configure.ac
flumotion/trunk/flumotion/common/Makefile.am
flumotion/trunk/pkgconfig/flumotion-uninstalled.pc.in
flumotion/trunk/pkgconfig/flumotion.pc.in
Log:
2007-02-06 Andy Wingo <wingo at pobox.com>
* flumotion/common/boot.py: Moved here from boot.py.in; not
autogenerated any more. Less clever and more comprehensive checks.
Don't munge sys.path any more to include dirs found at
configure-time; instead if the caller wants to affect which pygtk
we find it should change the environment. Fixes #500.
* pkgconfig/flumotion.pc.in:
* pkgconfig/flumotion-uninstalled.pc.in: Don't add gstreamer to
the pkg-config requires; pkg-config is unsuited to flumotion.
* configure.ac: Remove pkg-config checks for gstreamer and pygtk
-- use the same runtime checks that flumotion uses. We have to
check pygtk's pkg-config file tho, because of defs and codegen.
Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog (original)
+++ flumotion/trunk/ChangeLog Tue Feb 6 15:00:32 2007
@@ -1,5 +1,19 @@
2007-02-06 Andy Wingo <wingo at pobox.com>
+ * flumotion/common/boot.py: Moved here from boot.py.in; not
+ autogenerated any more. Less clever and more comprehensive checks.
+ Don't munge sys.path any more to include dirs found at
+ configure-time; instead if the caller wants to affect which pygtk
+ we find it should change the environment. Fixes #500.
+
+ * pkgconfig/flumotion.pc.in:
+ * pkgconfig/flumotion-uninstalled.pc.in: Don't add gstreamer to
+ the pkg-config requires; pkg-config is unsuited to flumotion.
+
+ * configure.ac: Remove pkg-config checks for gstreamer and pygtk
+ -- use the same runtime checks that flumotion uses. We have to
+ check pygtk's pkg-config file tho, because of defs and codegen.
+
* common/as-python.m4: Only check for python >= 2.2. Use
sys.version_info instead of textual comparison. Add 2.3, 2.4, and
2.5 as candidates.
Modified: flumotion/trunk/configure.ac
==============================================================================
--- flumotion/trunk/configure.ac (original)
+++ flumotion/trunk/configure.ac Tue Feb 6 15:00:32 2007
@@ -51,71 +51,15 @@
AC_MSG_ERROR([You need to install the Python development packages.])
])
-dnl check for GStreamer
-PKG_CHECK_MODULES(GST_010, gstreamer-0.10 >= $GST_010_REQ,
- [GST_010_SUPPORTED=yes], [AC_MSG_RESULT([$GST_010_PKG_ERRORS]); GST_010_SUPPORTED=no])
-
-if test $GST_010_SUPPORTED = "no"; then
- AC_MSG_ERROR([No GStreamer development packages found.
-Please install GStreamer development packages for version 0.10.
-Also, check your PKG_CONFIG_PATH.])
-fi
-
-export PYTHONPATH=$PYGTK_DIR:$PYTHONPATH
-PKG_CHECK_MODULES(PYGTK, pygtk-2.0 >= $PYGTK_010_REQ)
-PYGTK_DIR="`$PKG_CONFIG --variable=pyexecdir pygtk-2.0`"
-AC_SUBST(PYGTK_DIR)
-AC_MSG_NOTICE(Using pygtk installed in $PYGTK_DIR)
-PYGTK_VERSION="`$PKG_CONFIG --modversion pygtk-2.0`"
-
-if test "x$PYGTK_VERSION" = "x2.5.2"
-then
- AC_MSG_ERROR([PyGTK 2.5.2 contains known bugs, please install other version])
-fi
-
-if test "x$DISPLAY" != "x"; then
- AS_PYTHON_IMPORT([gtk.glade],,
- AC_MSG_ERROR([You need to have python libglade bindings installed]))
-else
- AC_MSG_NOTICE([Not trying to import gtk.glade because DISPLAY is unset])
-fi
-
-if test $GST_010_SUPPORTED = "no"; then
- AC_MSG_ERROR([No appropriate version of PyGTK installed. Correct the above
-errors and try again.])
-fi
-
-dnl checks for gst-python
-if test $GST_010_SUPPORTED = "yes"; then
- PKG_CHECK_MODULES(PYGST_010, gst-python-0.10 >= $PYGST_010_REQ,
- [PYGST_010_DIR="`$PKG_CONFIG --variable=pyexecdir gst-python-0.10`"
- AC_SUBST(PYGST_010_DIR)
- AC_MSG_NOTICE(Using gstreamer-python 0.10 installed in $PYGST_010_DIR)],
- [AC_MSG_RESULT([$PYGST_010_PKG_ERRORS])
- GST_010_SUPPORTED=no])
-
- if test $GST_010_SUPPORTED = "yes"; then
- saved_PYTHONPATH=$PYTHONPATH
- export PYTHONPATH=$PYGST_010_DIR:$PYTHONPATH
- AS_PYTHON_IMPORT([gst],,
- [AC_MSG_NOTICE([Unable to import gst-python 0.10 -- check your PYTHONPATH?])
- GST_010_SUPPORTED=no],
- [import pygst; pygst.require('0.10')],
- [assert gst.pygst_version[[1]] == 10 or (gst.pygst_version[[1]] == 9 and gst.pygst_version[[2]] >= 7)])
-
- fi
-fi
-
-if test $GST_010_SUPPORTED = "no"; then
- AC_MSG_ERROR([No suitable gstreamer-python versions found. Correct the above
-errors and try again.])
-fi
-
-AC_SUBST(GST_010_SUPPORTED)
-
-FLU_PKG_CONFIG_REQUIRES="gstreamer-0.10 >= $GST_010_REQ"
-AC_SUBST(FLU_PKG_CONFIG_REQUIRES)
+dnl check for pygtk
+AS_PYTHON_IMPORT(pygtk,,AC_MSG_ERROR([pygtk not found or too old]),,
+ [from flumotion.common import boot; boot.init_gobject()])
+
+dnl check for gstreamer
+AS_PYTHON_IMPORT(pygst,,AC_MSG_ERROR([gst-python not found or too old]),,
+ [from flumotion.common import boot; boot.init_gobject(); boot.init_gst()])
+PKG_CHECK_MODULES(PYGTK, pygtk-2.0)
dnl check stuff we can generate the tray icon with
AC_MSG_CHECKING(for pygtk codegen)
PYGTK_CODEGEN="$PYTHON `$PKG_CONFIG --variable=codegendir pygtk-2.0`/codegen.py"
@@ -216,7 +160,6 @@
flumotion/admin/gtk/Makefile
flumotion/admin/text/Makefile
flumotion/common/Makefile
-flumotion/common/boot.py
flumotion/component/Makefile
flumotion/component/base/Makefile
flumotion/component/bouncers/Makefile
Modified: flumotion/trunk/flumotion/common/Makefile.am
==============================================================================
--- flumotion/trunk/flumotion/common/Makefile.am (original)
+++ flumotion/trunk/flumotion/common/Makefile.am Tue Feb 6 15:00:32 2007
@@ -2,11 +2,6 @@
flumotiondir = $(libdir)/flumotion/python/flumotion/common
-BUILT_SOURCES = boot.py
-
-nodist_flumotion_PYTHON = \
- boot.py
-
flumotion_PYTHON = \
__init__.py \
boot.py \
@@ -45,5 +40,3 @@
clean-local:
rm -rf *.pyc *.pyo
-
-EXTRA_DIST = boot.py.in
Copied: flumotion/trunk/flumotion/common/boot.py (from r4459, flumotion/trunk/flumotion/common/boot.py.in)
==============================================================================
--- flumotion/trunk/flumotion/common/boot.py.in (original)
+++ flumotion/trunk/flumotion/common/boot.py Tue Feb 6 15:00:32 2007
@@ -22,24 +22,16 @@
import os
import sys
-PYGTK_DIR = '@PYGTK_DIR@'
+PYGTK_REQ = (2, 6, 3)
-PYGTK_BASE_REQ = '@PYGTK_010_REQ@'
-
-GST_010_SUPPORTED = '@GST_010_SUPPORTED@'
-PYGST_010_DIR = '@PYGST_010_DIR@'
-PYGTK_010_REQ = '@PYGTK_010_REQ@'
+GST_REQ = {'0.10': {'gstreamer': (0, 10, 0, 1),
+ 'gst-python': (0, 10, 0, 1)}}
def init_gobject():
"""
- I setup paths for pygtk from configure and
- make sure that the installed version of pygtk
- is sane enough to be usable by us
+ Initialize pygobject. A missing or too-old pygobject will cause a
+ SystemExit exception to be raised.
"""
-
- if not PYGTK_DIR in sys.path:
- sys.path.insert(0, PYGTK_DIR)
-
try:
import pygtk
pygtk.require('2.0')
@@ -48,73 +40,80 @@
except ImportError:
raise SystemExit('ERROR: PyGTK could not be found')
- if gobject.pygtk_version < PYGTK_BASE_REQ.split('.'):
- raise SystemExit(
- 'ERROR: PyGTK %s or higher is required' % PYGTK_BASE_REQ)
-
- # To be able to have other threads emitting signals connected
- # python callbacks we need to use the new PyGILThread_STATE API
- # Which in PyGTK 2.4.0 only can be turned on by using an
- # environment variable
- os.environ['PYGTK_USE_GIL_STATE_API'] = ''
+ if gobject.pygtk_version < PYGTK_REQ:
+ raise SystemExit('ERROR: PyGTK %s or higher is required'
+ % '.'.join(map(str, PYGTK_REQ)))
+
gobject.threads_init()
-def init_gst():
- """
- I setup paths for gst-python from configure and
- make sure that the installed version of gst-python
- is sane enough to be usable by us
- """
+def _init_gst_version(gst_majorminor):
+ if gst_majorminor not in GST_REQ:
+ raise SystemExit('ERROR: Invalid FLU_GST_VERSION: %r (expected '
+ 'one of %r)' % (gst_majorminor, GST_REQ.keys()))
+
+ pygst_req = GST_REQ[gst_majorminor]['gst-python']
+ gst_req = GST_REQ[gst_majorminor]['gstreamer']
- default_version = GST_010_SUPPORTED == 'yes' and '0.10'
- gst_version = os.getenv('FLU_GST_VERSION', default_version)
+ try:
+ import pygst
+ pygst.require(gst_majorminor)
+ import gst
+ except ImportError, AssertionError:
+ return False
- if gst_version == '0.10':
- pygst_dir = PYGST_010_DIR
- pygtk_req = PYGTK_010_REQ
- else:
- raise SystemExit(
- 'ERROR: Invalid FLU_GST_VERSION: "%s" ("0.10" expected)'
- % gst_version)
+ try:
+ gst_version = gst.get_gst_version()
+ pygst_version = gst.get_pygst_version()
+ except AttributeError:
+ # get_foo_version() added in 0.10.4, fall back
+ gst_version = gst.gst_version
+ pygst_version = gst.pygst_version
+
+ if gst_req[:2] != gst_version[:2]:
+ raise SystemExit('ERROR: Expected GStreamer %s, but got incompatible %s'
+ % (gst_majorminor, tup2version(gst_version[:2])))
+
+ if gst_version < gst_req:
+ raise SystemExit('ERROR: GStreamer %s too old; install %s or newer'
+ % (tup2version(gst_version), tup2version(gst_req)))
+
+ if pygst_version < pygst_req:
+ raise SystemExit('ERROR: gst-python %s too old; install %s or newer'
+ % (tup2version(pygst_version), tup2version(pygst_req)))
+
+ return True
+def init_gst():
+ """
+ Initialize pygst. A missing or too-old pygst will cause a
+ SystemExit exception to be raised.
+ """
assert 'gobject' in sys.modules, "Run init_gobject() first"
- import gobject
+ def tup2version(tup):
+ return '.'.join(map(str, tup))
- if gobject.pygtk_version < pygtk_req.split('.'):
- raise SystemExit(
- 'ERROR: PyGTK %s or higher is required for FLU_GST_VERSION=%s'
- % (pygtk_req, gst_version))
-
- if pygst_dir != PYGTK_DIR:
- if pygst_dir in sys.path:
- sys.path.remove(pygst_dir)
+ gst_majorminor = os.getenv('FLU_GST_VERSION')
- sys.path.insert(0, pygst_dir)
-
- if gst_version == '0.10':
- try:
- import pygst
- pygst.require('0.10')
- except ImportError:
- raise SystemExit('ERROR: Could not load gst-python 0.10')
+ if gst_majorminor:
+ if not _init_gst_version(gst_majorminor):
+ raise SystemExit('ERROR: requested GStreamer version %s '
+ 'not available' % gst_majorminor)
+ else:
+ majorminors = GST_REQ.keys()
+ majorminors.sort()
+ while majorminors:
+ majorminor = majorminors.pop()
+ if _init_gst_version(majorminor):
+ gst_majorminor = majorminor
+ break
+ if not gst_majorminor:
+ raise SystemExit('ERROR: no GStreamer available '
+ '(looking for versions %r)' % (GST_REQ.keys(),))
- try:
- import gst
- except ImportError:
- raise SystemExit('ERROR: gst-python could not be found')
-
- if not (gst.pygst_version[1] == 8 and gst_version == '0.8'
- or gst.pygst_version[1] >= 10 and gst_version == '0.10'
- or gst.pygst_version[1] == 9 and gst.pygst_version[2] >= 7
- and gst_version == '0.10'):
- raise SystemExit(
- 'ERROR: Expected gst-python version %s in %s, but found %r'
- % (gst_version, pygst_dir, gst.pygst_version))
-
# store our gst version for later logging
from flumotion.configure import configure
- configure.gst_version = gst_version
+ configure.gst_version = gst_majorminor
def boot(path, gtk=False, gst=True, installReactor=True):
from flumotion.twisted import compat
Modified: flumotion/trunk/pkgconfig/flumotion-uninstalled.pc.in
==============================================================================
--- flumotion/trunk/pkgconfig/flumotion-uninstalled.pc.in (original)
+++ flumotion/trunk/pkgconfig/flumotion-uninstalled.pc.in Tue Feb 6 15:00:32 2007
@@ -6,5 +6,4 @@
Name: Flumotion Uninstalled
Description: Streaming media server, Not Installed
- at FLU_PKG_CONFIG_REQUIRES@
Version: @VERSION@
Modified: flumotion/trunk/pkgconfig/flumotion.pc.in
==============================================================================
--- flumotion/trunk/pkgconfig/flumotion.pc.in (original)
+++ flumotion/trunk/pkgconfig/flumotion.pc.in Tue Feb 6 15:00:32 2007
@@ -5,5 +5,4 @@
Name: Flumotion
Description: Streaming media server
- at FLU_PKG_CONFIG_REQUIRES@
Version: @VERSION@
More information about the flumotion-commit
mailing list