gobject-introspection r833 - in trunk: . gir giscanner tests/everything tests/scanner
- From: johan svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r833 - in trunk: . gir giscanner tests/everything tests/scanner
- Date: Thu, 30 Oct 2008 02:07:44 +0000 (UTC)
Author: johan
Date: Thu Oct 30 02:07:43 2008
New Revision: 833
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=833&view=rev
Log:
2008-10-30 Johan Dahlin <jdahlin async com br>
Bug 558383 â builddir != srcdir build fails if giscanner python module not already installed
* gir/Makefile.am:
construct PYTHONPATH just once
* tests/everything/Makefile.am:
* tests/scanner/Makefile.am:
add $(top_srcdir) to PYTHONPATH to
handle builddir != srcdir
* giscanner/libtoolimporter.py:
* giscanner/sourcescanner.py:
Make the libtoolimporter work when distchecking too.
Mostly based on patch by Tommi Komulainen
Modified:
trunk/ChangeLog
trunk/gir/Makefile.am
trunk/giscanner/libtoolimporter.py
trunk/giscanner/sourcescanner.py
trunk/tests/everything/Makefile.am
trunk/tests/scanner/Makefile.am
Modified: trunk/gir/Makefile.am
==============================================================================
--- trunk/gir/Makefile.am (original)
+++ trunk/gir/Makefile.am Thu Oct 30 02:07:43 2008
@@ -2,6 +2,7 @@
EXTRA_DIST =
G_IR_SCANNER = $(top_srcdir)/tools/g-ir-scanner
+G_IR_SCANNER_PYTHONPATH = $(top_builddir):$(top_srcdir):$$PYTHONPATH
G_IR_SCANNER_FILES = $(top_srcdir)/giscanner/*.py \
$(top_builddir)/giscanner/libgiscanner.la
@@ -16,7 +17,7 @@
endif
GLib-2.0.gir: $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) Makefile glib-2.0.c
- PYTHONPATH=$(top_builddir):$$PYTHONPATH $(G_IR_SCANNER) \
+ PYTHONPATH=$(G_IR_SCANNER_PYTHONPATH) $(G_IR_SCANNER) \
-v --namespace GLib --nsversion=2.0 \
--add-include-path=. \
--noclosure \
@@ -31,7 +32,7 @@
$(GLIB_LIBDIR)/glib-2.0/include/glibconfig.h \
$(srcdir)/glib-2.0.c \
$(GLIB_INCLUDEDIR)/glib/*.h
- PYTHONPATH=$(top_builddir):$$PYTHONPATH $(G_IR_SCANNER) \
+ PYTHONPATH=$(G_IR_SCANNER_PYTHONPATH) $(G_IR_SCANNER) \
--xpath-assertions=$(srcdir)/GLib-2.0.xpath GLib-2.0.gir
BUILT_SOURCES += GLib-2.0.gir
EXTRA_DIST += glib-2.0.c GLib-2.0.xpath
@@ -47,7 +48,7 @@
endif
GObject-2.0.gir: GLib-2.0.gir $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) Makefile
- PYTHONPATH=$(top_builddir):$$PYTHONPATH $(G_IR_SCANNER) \
+ PYTHONPATH=$(G_IR_SCANNER_PYTHONPATH) $(G_IR_SCANNER) \
-v --namespace GObject --nsversion=2.0 \
--add-include-path=. \
--noclosure \
@@ -73,7 +74,7 @@
endif
GModule-2.0.gir: GLib-2.0.gir $(G_IR_SCANNER) $(G_IR_SCANNER_FILES)
- PYTHONPATH=$(top_builddir):$$PYTHONPATH $(G_IR_SCANNER) \
+ PYTHONPATH=$(G_IR_SCANNER_PYTHONPATH) $(G_IR_SCANNER) \
-v --namespace GModule --nsversion=2.0 \
--add-include-path=. \
--noclosure \
@@ -98,7 +99,7 @@
endif
Gio-2.0.gir: GObject-2.0.gir $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) Makefile $(srcdir)/gio-2.0.c
- PYTHONPATH=$(top_builddir):$$PYTHONPATH $(G_IR_SCANNER) \
+ PYTHONPATH=$(G_IR_SCANNER_PYTHONPATH) $(G_IR_SCANNER) \
-v --namespace Gio --nsversion=2.0 \
--add-include-path=. \
--noclosure \
Modified: trunk/giscanner/libtoolimporter.py
==============================================================================
--- trunk/giscanner/libtoolimporter.py (original)
+++ trunk/giscanner/libtoolimporter.py Thu Oct 30 02:07:43 2008
@@ -32,10 +32,23 @@
self.path = path
@classmethod
- def find_module(cls, name, path=None):
- modname = name.split('.')[-1]
- for part in path or sys.path:
- full = os.path.join(part, '.libs', modname + '.la')
+ def find_module(cls, name, relpath=None):
+ modparts = name.split('.')
+ filename = modparts.pop() + '.la'
+
+ # Given some.package.module 'path' is where subpackages of some.package
+ # should be looked for. See if we can find a ".libs/module.la" relative
+ # to those directories and failing that look for file
+ # "some/package/.libs/module.la" relative to sys.path
+ if relpath is None:
+ paths = relpath
+ module = ''
+ else:
+ paths = sys.path
+ module = os.path.join(*modparts)
+
+ for path in paths:
+ full = os.path.join(path, module, '.libs', filename)
if os.path.exists(full):
return cls(name, full)
Modified: trunk/giscanner/sourcescanner.py
==============================================================================
--- trunk/giscanner/sourcescanner.py (original)
+++ trunk/giscanner/sourcescanner.py Thu Oct 30 02:07:43 2008
@@ -186,7 +186,7 @@
def __init__(self):
with LibtoolImporter:
- from _giscanner import SourceScanner
+ from giscanner._giscanner import SourceScanner
self._scanner = SourceScanner()
self._filenames = []
self._cpp_options = []
Modified: trunk/tests/everything/Makefile.am
==============================================================================
--- trunk/tests/everything/Makefile.am (original)
+++ trunk/tests/everything/Makefile.am Thu Oct 30 02:07:43 2008
@@ -24,6 +24,7 @@
GIRS =
SCANNER = $(top_srcdir)/tools/g-ir-scanner
+SCANNER_PYTHONPATH = $(top_builddir):$(top_srcdir):$$PYTHONPATH
SCANNER_LIBS = $(top_srcdir)/giscanner/*.py \
$(top_builddir)/giscanner/libgiscanner.la
TYPELIBS = $(GIRS:.gir=.typelib)
@@ -32,7 +33,7 @@
BUILT_SOURCES = $(TYPELIBS) $(TXMLS) $(GIRS)
Everything-$(TYPELIB_VERSION).gir: libgirepository-everything.la gitesttypes.c gitesttypes.h $(SCANNER) $(SCANNER_LIBS)
- PYTHONPATH=$(top_builddir):$$PYTHONPATH $(CHECK_DEBUG) $(SCANNER) -v \
+ PYTHONPATH=$(SCANNER_PYTHONPATH) $(CHECK_DEBUG) $(SCANNER) -v \
--add-include-path=$(top_builddir)/gir \
--include=GObject-2.0 \
--library=girepository-everything \
@@ -44,4 +45,4 @@
%.typelib: %.gir $(top_builddir)/tools/g-ir-compiler$(EXEEXT) Makefile
$(top_builddir)/tools/g-ir-compiler --includedir=. --includedir=$(top_builddir)/gir $< -o $@
- PYTHONPATH=$(top_builddir):$$PYTHONPATH $(SCANNER) --add-include-path=$(top_builddir)/gir --typelib-xml $< > $<.tmp && mv $<.tmp $<.txml
+ PYTHONPATH=$(SCANNER_PYTHONPATH) $(SCANNER) --add-include-path=$(top_builddir)/gir --typelib-xml $< > $<.tmp && mv $<.tmp $<.txml
Modified: trunk/tests/scanner/Makefile.am
==============================================================================
--- trunk/tests/scanner/Makefile.am (original)
+++ trunk/tests/scanner/Makefile.am Thu Oct 30 02:07:43 2008
@@ -26,6 +26,7 @@
# .gir --[scanner]-> .typelib --[generate]-> .tgir
GIRS =
SCANNER = $(top_srcdir)/tools/g-ir-scanner
+SCANNER_PYTHONPATH = $(top_builddir):$(top_srcdir):$$PYTHONPATH
SCANNER_LIBS = \
$(top_srcdir)/giscanner/*.py \
$(top_builddir)/giscanner/libgiscanner.la
@@ -40,7 +41,7 @@
EXTRA_DIST = $(EXPECTEDGIRS) $(EXPECTEDTGIRS)
annotation-1.0.gir: libannotation.la annotation.c annotation.h utility-1.0.gir $(SCANNER) $(SCANNER_LIBS) Makefile
- PYTHONPATH=$(top_builddir):$$PYTHONPATH $(CHECK_DEBUG) $(SCANNER) -v \
+ PYTHONPATH=$(SCANNER_PYTHONPATH) $(CHECK_DEBUG) $(SCANNER) -v \
--add-include-path=$(top_builddir)/gir --add-include-path=. \
--include=GObject-2.0 \
--include=utility-1.0 \
@@ -53,7 +54,7 @@
GIRS += annotation-1.0.gir
drawable-1.0.gir: libdrawable.la drawable.c drawable.h utility-1.0.gir $(SCANNER) $(SCANNER_LIBS) Makefile
- PYTHONPATH=$(top_builddir):$$PYTHONPATH $(CHECK_DEBUG) $(SCANNER) -v \
+ PYTHONPATH=$(SCANNER_PYTHONPATH) $(CHECK_DEBUG) $(SCANNER) -v \
--add-include-path=$(top_builddir)/gir --add-include-path=. \
--include=GObject-2.0 \
--include=utility-1.0 \
@@ -66,13 +67,13 @@
GIRS += drawable-1.0.gir
drawable-injected-1.0.gir: drawable-1.0.gir $(SCANNER) $(SCANNER_LIBS) Makefile
- PYTHONPATH=$(top_builddir):$$PYTHONPATH $(CHECK_DEBUG) $(SCANNER) -v \
+ PYTHONPATH=$(SCANNER_PYTHONPATH) $(CHECK_DEBUG) $(SCANNER) -v \
--inject drawable-1.0.gir $(srcdir)/DrawableAdditions.xml $@
GIRS += drawable-injected-1.0.gir
EXTRA_DIST += DrawableAdditions.xml
foo-1.0.gir: libfoo.la foo.c foo.h utility-1.0.gir $(SCANNER) $(SCANNER_LIBS) Makefile
- PYTHONPATH=$(top_builddir):$$PYTHONPATH $(CHECK_DEBUG) $(SCANNER) -v \
+ PYTHONPATH=$(SCANNER_PYTHONPATH) $(CHECK_DEBUG) $(SCANNER) -v \
--add-include-path=$(top_builddir)/gir --add-include-path=. \
--include=GObject-2.0 \
--include=utility-1.0 \
@@ -85,7 +86,7 @@
GIRS += foo-1.0.gir
utility-1.0.gir: libutility.la utility.h $(SCANNER) $(SCANNER_LIBS) Makefile
- PYTHONPATH=$(top_builddir):$$PYTHONPATH $(CHECK_DEBUG) $(SCANNER) -v \
+ PYTHONPATH=$(SCANNER_PYTHONPATH) $(CHECK_DEBUG) $(SCANNER) -v \
--add-include-path=$(top_builddir)/gir --add-include-path=. \
--include=GObject-2.0 \
--library=utility \
@@ -98,7 +99,7 @@
# This one tests different --namespace and --strip-prefix
GtkFrob-1.0.gir: libgtkfrob.la gtkfrob.h $(SCANNER) $(SCANNER_LIBS) Makefile
- PYTHONPATH=$(top_builddir):$$PYTHONPATH $(CHECK_DEBUG) $(SCANNER) -v \
+ PYTHONPATH=$(SCANNER_PYTHONPATH) $(CHECK_DEBUG) $(SCANNER) -v \
--add-include-path=$(top_builddir)/gir --add-include-path=. \
--include=GObject-2.0 \
--library=gtkfrob \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]