summaryrefslogtreecommitdiff
path: root/giscanner/libtoolimporter.py
diff options
context:
space:
mode:
authorJohan Dahlin <jdahlin@async.com.br>2008-10-30 02:07:43 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-10-30 02:07:43 +0000
commit845f179db5ec240316f960c8c77b31a69aecc561 (patch)
tree6df15f283cbbec2581f189a7ae2d8d41fc673718 /giscanner/libtoolimporter.py
parent7a89d675ec370fd824be73a33750b1089e48c835 (diff)
downloadgobject-introspection-845f179db5ec240316f960c8c77b31a69aecc561.tar.gz
Bug 558383 – builddir != srcdir build fails if giscanner python module
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 svn path=/trunk/; revision=833
Diffstat (limited to 'giscanner/libtoolimporter.py')
-rw-r--r--giscanner/libtoolimporter.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/giscanner/libtoolimporter.py b/giscanner/libtoolimporter.py
index 19112e27..36e7f521 100644
--- a/giscanner/libtoolimporter.py
+++ b/giscanner/libtoolimporter.py
@@ -32,10 +32,23 @@ class LibtoolImporter(object):
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)