summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--giscanner/shlibs.py57
1 files changed, 32 insertions, 25 deletions
diff --git a/giscanner/shlibs.py b/giscanner/shlibs.py
index 6a9d2846..b367d8e1 100644
--- a/giscanner/shlibs.py
+++ b/giscanner/shlibs.py
@@ -19,6 +19,7 @@
# 02110-1301, USA.
#
+import os
import re
import platform
import subprocess
@@ -67,34 +68,40 @@ def _resolve_non_libtool(options, binary, libraries):
if not libraries:
return []
- args = []
- libtool = get_libtool_command(options)
- if libtool:
- args.extend(libtool)
- args.append('--mode=execute')
- platform_system = platform.system()
- if platform_system == 'Darwin':
- args.extend(['otool', '-L', binary.args[0]])
+ if os.name == 'nt':
+ shlibs = []
+
+ for library in libraries:
+ shlibs.append(library + '.dll')
else:
- args.extend(['ldd', binary.args[0]])
- proc = subprocess.Popen(args, stdout=subprocess.PIPE)
- patterns = {}
- for library in libraries:
- patterns[library] = _ldd_library_pattern(library)
+ args = []
+ libtool = get_libtool_command(options)
+ if libtool:
+ args.extend(libtool)
+ args.append('--mode=execute')
+ platform_system = platform.system()
+ if platform_system == 'Darwin':
+ args.extend(['otool', '-L', binary.args[0]])
+ else:
+ args.extend(['ldd', binary.args[0]])
+ proc = subprocess.Popen(args, stdout=subprocess.PIPE)
+ patterns = {}
+ for library in libraries:
+ patterns[library] = _ldd_library_pattern(library)
- shlibs = []
- for line in proc.stdout:
- for library, pattern in patterns.iteritems():
- m = pattern.search(line)
- if m:
- del patterns[library]
- shlibs.append(m.group(1))
- break
+ shlibs = []
+ for line in proc.stdout:
+ for library, pattern in patterns.iteritems():
+ m = pattern.search(line)
+ if m:
+ del patterns[library]
+ shlibs.append(m.group(1))
+ break
- if len(patterns) > 0:
- raise SystemExit(
- "ERROR: can't resolve libraries to shared libraries: " +
- ", ".join(patterns.keys()))
+ if len(patterns) > 0:
+ raise SystemExit(
+ "ERROR: can't resolve libraries to shared libraries: " +
+ ", ".join(patterns.keys()))
return shlibs