summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Dahlin <jdahlin@async.com.br>2008-11-25 13:01:58 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-11-25 13:01:58 +0000
commit5f9faf55884a8a32c47ff56165020b6988cc7aa0 (patch)
treec3b71263bd2a19cf84e367c14e33128fc630450c
parent6087c1a763f19363789854525796e9e062043948 (diff)
downloadgobject-introspection-5f9faf55884a8a32c47ff56165020b6988cc7aa0.tar.gz
Execute the dumper program through libtool if it's installed, so we avoid
2008-11-25 Johan Dahlin <jdahlin@async.com.br> * giscanner/glibtransformer.py: * tools/g-ir-scanner: Execute the dumper program through libtool if it's installed, so we avoid loading the installed version. svn path=/trunk/; revision=964
-rw-r--r--ChangeLog7
-rw-r--r--giscanner/glibtransformer.py27
-rwxr-xr-xtools/g-ir-scanner4
3 files changed, 32 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index ca93f70e..d3f1a211 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-11-25 Johan Dahlin <jdahlin@async.com.br>
+
+ * giscanner/glibtransformer.py:
+ * tools/g-ir-scanner:
+ Execute the dumper program through libtool if it's installed,
+ so we avoid loading the installed version.
+
2008-11-24 Johan Dahlin <jdahlin@async.com.br>
* girepository/gdump.c (dump_type): Remove a warning,
diff --git a/giscanner/glibtransformer.py b/giscanner/glibtransformer.py
index 263f6dcb..33983e36 100644
--- a/giscanner/glibtransformer.py
+++ b/giscanner/glibtransformer.py
@@ -82,8 +82,10 @@ class UnknownTypeError(Exception):
class GLibTransformer(object):
- def __init__(self, transformer, noclosure=False):
+ def __init__(self, transformer, noclosure=False, nolibtool=False):
self._transformer = transformer
+ self._noclosure = noclosure
+ self._nolibtool = nolibtool
self._transformer.set_container_types(['GList*', 'GSList*'],
['GHashTable*'])
self._namespace_name = None
@@ -95,7 +97,6 @@ class GLibTransformer(object):
self._failed_types = {}
self._boxed_types = {}
self._private_internal_types = {}
- self._noclosure = noclosure
self._validating = False
# Public API
@@ -213,6 +214,19 @@ class GLibTransformer(object):
except KeyError, e:
return Unresolved(gtype_name)
+ def _use_libtool_infection(self):
+ libtool_infection = not self._nolibtool
+ if not libtool_infection:
+ return False
+
+ try:
+ subprocess.check_call(['libtool', '--version'])
+ except subprocess.CalledProcessError, e:
+ # If libtool's not installed, assume we don't need it
+ return False
+
+ return True
+
def _execute_binary(self):
in_path = os.path.join(self._binary.tmpdir, 'types.txt')
f = open(in_path, 'w')
@@ -222,9 +236,12 @@ class GLibTransformer(object):
f.close()
out_path = os.path.join(self._binary.tmpdir, 'dump.xml')
- introspect_arg = '--introspect-dump=%s,%s' % (in_path, out_path)
- args = self._binary.args
- args.append(introspect_arg)
+ args = []
+ if self._use_libtool_infection():
+ args.extend(['libtool', '--mode=execute'])
+ args.extend(self._binary.args)
+ args.append('--introspect-dump=%s,%s' % (in_path, out_path))
+
# Invoke the binary, having written our get_type functions to types.txt
subprocess.check_call(args, stdout=sys.stdout, stderr=sys.stderr)
self._read_introspect_dump(out_path)
diff --git a/tools/g-ir-scanner b/tools/g-ir-scanner
index 0f460183..0e2d4148 100755
--- a/tools/g-ir-scanner
+++ b/tools/g-ir-scanner
@@ -304,7 +304,9 @@ def main(args):
# Transform the C AST nodes into higher level
# GLib/GObject nodes
- glibtransformer = GLibTransformer(transformer, noclosure=options.noclosure)
+ glibtransformer = GLibTransformer(transformer,
+ noclosure=options.noclosure,
+ nolibtool=options.nolibtool)
glibtransformer.set_introspection_binary(binary)
namespace = glibtransformer.parse()