[gegl-qt] Python: Allow parallel installs
- From: Jon Nordby <jonnor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl-qt] Python: Allow parallel installs
- Date: Wed, 28 Sep 2011 19:22:09 +0000 (UTC)
commit 4bd45a0133e47a05ac70e45fe3f78336462583e5
Author: Jon Nordby <jononor gmail com>
Date: Wed Sep 28 19:26:41 2011 +0200
Python: Allow parallel installs
.gitignore | 1 +
examples/examples.pro | 2 +-
examples/pyside-basic.py | 4 +++-
examples/python-nodeviewoptions.py | 2 ++
pygegl-qt/pygegl-qt.pro | 25 +++++++++++++++++--------
pygegl-qt/pygeglqt4.py | 26 ++++++++++++++++++++++++++
6 files changed, 50 insertions(+), 10 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 28e95bc..12b7315 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,4 @@ qrc_*
gegl-qt-build-*
gegl-qt-*.*
*~
+*.pyc
diff --git a/examples/examples.pro b/examples/examples.pro
index b5126f0..0c8ab3e 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -17,4 +17,4 @@ contains(HAVE_QT_DECLARATIVE, yes) {
}
-OTHER_FILES += pyside-basic.py
+OTHER_FILES += pyside-basic.py python-nodeviewoptions.py
diff --git a/examples/pyside-basic.py b/examples/pyside-basic.py
index df60562..7710d41 100644
--- a/examples/pyside-basic.py
+++ b/examples/pyside-basic.py
@@ -8,6 +8,8 @@ from gi.repository import Gegl
from PySide.QtCore import *
from PySide.QtGui import *
+import pygeglqt4
+pygeglqt4.require("0.1")
from geglqt import GeglQt
graph_xml = """
@@ -17,7 +19,7 @@ graph_xml = """
<gegl:translate x='30' y='30'/>
<gegl:dropshadow radius='1.5' x='3' y='3'/>
<gegl:text size='80' color='white'><params>
- <param name='string'>GEGL GTK</param>
+ <param name='string'>GEGL QT</param>
</params>
</gegl:text>
</gegl:over>
diff --git a/examples/python-nodeviewoptions.py b/examples/python-nodeviewoptions.py
index 1b24916..ece6483 100644
--- a/examples/python-nodeviewoptions.py
+++ b/examples/python-nodeviewoptions.py
@@ -9,6 +9,8 @@ from gi.repository import Gegl
from PySide.QtCore import *
from PySide.QtGui import *
+import pygeglqt4
+pygeglqt4.require("0.1")
from geglqt import GeglQt
graph_xml = """
diff --git a/pygegl-qt/pygegl-qt.pro b/pygegl-qt/pygegl-qt.pro
index 500eecd..4cc523e 100644
--- a/pygegl-qt/pygegl-qt.pro
+++ b/pygegl-qt/pygegl-qt.pro
@@ -39,7 +39,11 @@ LIBRARIES += $$system(pkg-config --libs gegl pygobject-2.0 gobject-2.0 pyside)
outputFiles(global.h typesystem_gegl-qt.xml)
-OTHER_FILES += global.h.in typesystem_gegl-qt.xml.in
+OTHER_FILES += \
+ global.h.in \
+ typesystem_gegl-qt.xml.in \
+ geglnode_conversions.h \
+ pygeglqt4.py \
# Generate
QMAKE_EXTRA_TARGETS += generate
@@ -61,8 +65,10 @@ compile.commands += g++ geglqt/geglqt_module_wrapper.cpp $$INCLUDES -Wall -fPIC
# Link
QMAKE_EXTRA_TARGETS += link
link.depends += compile
-link.target = geglqt.so
-link.commands += g++ geglqt*wrapper.o $$LIBRARIES -fPIC -shared -Wl,-soname,geglqt.so -o geglqt.so
+link.target = $$GEGLQT_LIBNAME/geglqt.so
+link.commands += mkdir -p $$GEGLQT_LIBNAME;
+link.commands += cd $$GEGLQT_LIBNAME;
+link.commands += g++ ../geglqt*wrapper.o $$LIBRARIES -fPIC -shared -Wl,-soname,geglqt.so -o geglqt.so
# Install
PYTHON_SITE_PACKAGES = $$system(`echo $PYTHON` -c \"from distutils.sysconfig import get_python_lib; print get_python_lib(True)\")
@@ -71,12 +77,15 @@ isEmpty(PYTHON_SITE_PACKAGES) {
}
-modules.files = geglqt.so
+modules.files = $$GEGLQT_LIBNAME/geglqt.so
modules.CONFIG += no_check_exist
-modules.path = $$PYTHON_SITE_PACKAGES
+modules.path = $$PYTHON_SITE_PACKAGES/$$GEGLQT_LIBNAME
+
+wrapper.files = pygeglqt4.py
+wrapper.path = $$PYTHON_SITE_PACKAGES
+
+INSTALLS += modules wrapper
+
-INSTALLS += modules
-OTHER_FILES += \
- geglnode_conversions.h \
diff --git a/pygegl-qt/pygeglqt4.py b/pygegl-qt/pygeglqt4.py
new file mode 100644
index 0000000..c62c582
--- /dev/null
+++ b/pygegl-qt/pygeglqt4.py
@@ -0,0 +1,26 @@
+
+import sys, os.path
+
+# Used so that we can support install of multiple parallel
+#
+def require(version):
+ """Set up the import for a given gegl-qt version.
+
+ After calling this function the module 'geglqt' can be imported and used.
+ Will raise ValueError on unsupported
+
+ Example:
+ import pygeglqt4
+ pygeglqt4.require("0.1")
+ from geglqt import GeglQt
+ """
+
+ if version != "0.1":
+ raise ValueError, "Unsupported version or invalid version argument: %s" % (repr(version),)
+
+ # The module is installed in a versioned directory relative to this file
+ # Locate it and prepend it to the python import path
+ base_dir = os.path.abspath(os.path.dirname(__file__))
+ module_dir = 'gegl-qt4-%s' % (version,)
+ module_path = os.path.join(base_dir, module_dir)
+ sys.path.insert(0, module_path)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]