gobject-introspection r890 - in trunk: . gir giscanner tools



Author: johan
Date: Wed Nov 12 12:04:54 2008
New Revision: 890
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=890&view=rev

Log:
2008-11-12  Johan Dahlin  <jdahlin async com br>

        * gir/Makefile.am:
        * giscanner/glibtransformer.py:
        * tools/g-ir-scanner:
        Add a GIRepository-2.0.gir. Change the libtool lookup slightly
        so we can just pass in --library=foo/bar/baz.la and the scanner
        does the right thing. 
        Don't warn for _get_type() functions if they don't take any 
        parameters



Modified:
   trunk/ChangeLog
   trunk/gir/   (props changed)
   trunk/gir/Makefile.am
   trunk/giscanner/glibtransformer.py
   trunk/tools/g-ir-scanner

Modified: trunk/gir/Makefile.am
==============================================================================
--- trunk/gir/Makefile.am	(original)
+++ trunk/gir/Makefile.am	Wed Nov 12 12:04:54 2008
@@ -16,7 +16,7 @@
 GLIB_LIBRARY=glib-2.0
 endif
 
-GLib-2.0.gir: $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) Makefile glib-2.0.c
+GLib-2.0.gir: $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) glib-2.0.c
 	PYTHONPATH=$(G_IR_SCANNER_PYTHONPATH) $(G_IR_SCANNER) \
 	    -v --namespace GLib --nsversion=2.0 \
 	    --add-include-path=. \
@@ -47,7 +47,7 @@
 GOBJECT_LIBRARY=gobject-2.0
 endif
 
-GObject-2.0.gir: GLib-2.0.gir $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) Makefile
+GObject-2.0.gir: GLib-2.0.gir $(G_IR_SCANNER) $(G_IR_SCANNER_FILES)
 	PYTHONPATH=$(G_IR_SCANNER_PYTHONPATH) $(G_IR_SCANNER) \
 	    -v --namespace GObject --nsversion=2.0 \
 	    --add-include-path=. \
@@ -98,7 +98,7 @@
 GIO_LIBRARY=gio-2.0
 endif
 
-Gio-2.0.gir: GObject-2.0.gir $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) Makefile $(srcdir)/gio-2.0.c
+Gio-2.0.gir: GObject-2.0.gir $(G_IR_SCANNER) $(G_IR_SCANNER_FILES) $(srcdir)/gio-2.0.c
 	PYTHONPATH=$(G_IR_SCANNER_PYTHONPATH) $(G_IR_SCANNER) \
 	    -v --namespace Gio --nsversion=2.0 \
 	    --add-include-path=. \
@@ -116,16 +116,43 @@
 	    $(GLIB_INCLUDEDIR)/gio/*.h
 BUILT_SOURCES += Gio-2.0.gir
 EXTRA_DIST += gio-2.0.c
-CLEANFILES = $(BUILT_SOURCES)
 
+# girepository
+GIREPOSITORY_INCLUDEDIR=`pkg-config --variable=includedir girepository-2.0`/glib-2.0
+GIREPOSITORY_LIBDIR=`pkg-config --variable=libdir girepository-2.0`
+
+GIRepository-2.0.gir: GObject-2.0.gir $(G_IR_SCANNER) $(G_IR_SCANNER_FILES)
+	PYTHONPATH=$(G_IR_SCANNER_PYTHONPATH) $(G_IR_SCANNER) \
+	    -v --namespace GIRepository --nsversion=1.0\
+	    --add-include-path=. \
+	    --noclosure \
+	    --output $@ \
+	    --strip-prefix=g \
+            --include=GObject-2.0 \
+	    --library=$(top_builddir)/girepository/libgirepository.la \
+	    -I$(srcdir)/girepository \
+            --pkg glib-2.0 \
+            --pkg gobject-2.0 \
+	    $(top_srcdir)/girepository/girepository.c \
+	    $(top_srcdir)/girepository/girepository.h
+BUILT_SOURCES += GIRepository-2.0.gir
+
+# Generic rules
+CLEANFILES = $(BUILT_SOURCES)
 girdir=$(datadir)/gir
 dist_gir_DATA = $(BUILT_SOURCES)
 
-%.typelib: %.gir $(top_builddir)/tools/g-ir-compiler$(EXEEXT) Makefile
+%.typelib: %.gir $(top_builddir)/tools/g-ir-compiler$(EXEEXT)
 	$(DEBUG) $(top_builddir)/tools/g-ir-compiler$(EXEEXT) --includedir=. $(G_IR_COMPILER_OPTS) $< -o $@
 
 typelibsdir = $(libdir)/girepository
-typelibs_DATA = GLib-2.0.typelib GModule-2.0.typelib GObject-2.0.typelib Gio-2.0.typelib
+typelibs_DATA = 		\
+	GLib-2.0.typelib 	\
+	GModule-2.0.typelib	\
+	GObject-2.0.typelib	\
+	Gio-2.0.typelib		\
+	GIRepository-2.0.typelib
+
 CLEANFILES += $(typelibs_DATA)
 
 # Check that typelib -> gir -> typelib transformation is lossless.
@@ -133,10 +160,10 @@
 # values, etc.) but the typelibs should identical as long as the gir files are
 # semantically equivalent.
 
-%.test.gir: %.typelib $(top_builddir)/tools/g-ir-generate$(EXEEXT) Makefile
+%.test.gir: %.typelib $(top_builddir)/tools/g-ir-generate$(EXEEXT)
 	$(DEBUG) $(top_builddir)/tools/g-ir-generate$(EXEEXT) --includedir=. $< -o $@
 
-testlib-%: %.test.gir $(top_builddir)/tools/g-ir-generate$(EXEEXT) Makefile
+testlib-%: %.test.gir $(top_builddir)/tools/g-ir-generate$(EXEEXT)
 	$(DEBUG) $(top_builddir)/tools/g-ir-compiler$(EXEEXT) --includedir=. $(G_IR_COMPILER_OPTS) $< -o $*.test.typelib
 	cmp $*.typelib $*.test.typelib && rm $*.test.typelib
 

Modified: trunk/giscanner/glibtransformer.py
==============================================================================
--- trunk/giscanner/glibtransformer.py	(original)
+++ trunk/giscanner/glibtransformer.py	Wed Nov 12 12:04:54 2008
@@ -84,13 +84,17 @@
             found_libname = os.path.abspath(libname)
         elif os.path.exists(libtool_libname):
             found_libname = extract_libtool(libtool_libname)
-        elif libname.endswith('.la'):
-            found_libname = extract_libtool(libname)
+            libname = os.path.basename(found_libname)
         else:
             found_libname = find_library(libname)
+
+        if libname.endswith('.la'):
+            found_libname = extract_libtool(libname)
+            libname = os.path.basename(found_libname)
         if not found_libname:
             raise ValueError("Failed to find library: %r" % (libname, ))
         self._libraries.append(ctypes.cdll.LoadLibrary(found_libname))
+        return libname
 
     def _print_statistics(self):
         nodes = list(self._names.names.itervalues())
@@ -267,6 +271,8 @@
         if self._namespace_name == 'GLib':
             # No GObjects in GLib
             return False
+        if func.parameters:
+            return False
         # GType *_get_type(void)
         if func.retval.type.name not in ['Type',
                                          'GType',
@@ -275,8 +281,6 @@
             print ("Warning: *_get_type function returns '%r'"
                    ", not GObject.Type") % (func.retval.type.name, )
             return False
-        if func.parameters:
-            return False
 
         if not self._libraries:
             print "Warning: No libraries loaded, cannot call %s" % (symbol, )

Modified: trunk/tools/g-ir-scanner
==============================================================================
--- trunk/tools/g-ir-scanner	(original)
+++ trunk/tools/g-ir-scanner	Wed Nov 12 12:04:54 2008
@@ -211,7 +211,6 @@
 
     if not options.libraries:
         _error("Must specify --library at least one primary library")
-    libraries = options.libraries
 
     for package in options.packages:
         output = subprocess.Popen(['pkg-config', '--cflags', package],
@@ -252,7 +251,6 @@
         os.environ['LPATH'] = ':'.join([lpath, library_path])
     else:
         os.environ['LPATH'] = library_path
-
     filenames = []
     for arg in args:
         if (arg.endswith('.c') or
@@ -290,9 +288,10 @@
     # Transform the C AST nodes into higher level
     # GLib/GObject nodes
     glibtransformer = GLibTransformer(transformer, noclosure=options.noclosure)
+    libraries = []
     if options.libraries:
         for library in options.libraries:
-            glibtransformer.add_library(library)
+            libraries.append(glibtransformer.add_library(library))
 
     namespace = glibtransformer.parse()
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]