chose extension basing on OS
authorAlexey Zakhlestin <indeyets@gmail.com>
Wed, 6 Oct 2010 11:02:46 +0000 (15:02 +0400)
committerJohan Dahlin <johan@gnome.org>
Wed, 6 Oct 2010 12:37:07 +0000 (09:37 -0300)
https://bugzilla.gnome.org/show_bug.cgi?id=606686

giscanner/libtoolimporter.py

index e149ec46dd4ef8035cfa63ecab680efa08ff06c5..84c62f93cf4dc3179b3ae8b86205e56bf2cbdfc4 100644 (file)
@@ -20,6 +20,7 @@
 
 import imp
 import os
+import platform
 import sys
 
 from .utils import extract_libtool
@@ -49,8 +50,16 @@ class LibtoolImporter(object):
 
     def load_module(self, name):
         realpath = extract_libtool(self.path)
-        mod = imp.load_module(name, open(realpath), realpath,
-                              ('.so', 'rb', 3))
+        platform_system = platform.system()
+
+        if platform_system == 'Darwin':
+            extension = '.dylib'
+        elif platform_system == 'Windows':
+            extension = '.dll'
+        else:
+            extension = '.so'
+
+        mod = imp.load_module(name, open(realpath), realpath, (extension, 'rb', 3))
         mod.__loader__ = self
         return mod