Mercurial > cpython-lru_cache-weakref
annotate Lib/ctypes/util.py @ 58925:eecf1bef052d 2.6
Merged revisions 78207 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78207 | ezio.melotti | 2010-02-17 01:26:09 +0200 (Wed, 17 Feb 2010) | 1 line
#7930: fix stripid
........
| author | Ezio Melotti <ezio.melotti@gmail.com> |
|---|---|
| date | Tue, 16 Feb 2010 23:29:44 +0000 |
| parents | a85e6756ded2 |
| children | 109c4e62ec23 db21c3c009db |
| rev | line source |
|---|---|
|
38780
381a72ab5fb8
Add pep-291 compatibility markers.
Thomas Heller <theller@ctypes.org>
parents:
38743
diff
changeset
|
1 ###################################################################### |
|
381a72ab5fb8
Add pep-291 compatibility markers.
Thomas Heller <theller@ctypes.org>
parents:
38743
diff
changeset
|
2 # This file should be kept compatible with Python 2.3, see PEP 291. # |
|
381a72ab5fb8
Add pep-291 compatibility markers.
Thomas Heller <theller@ctypes.org>
parents:
38743
diff
changeset
|
3 ###################################################################### |
|
38166
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
4 import sys, os |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
5 |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
6 # find_library(name) returns the pathname of a library, or None. |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
7 if os.name == "nt": |
|
47113
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
8 |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
9 def _get_build_version(): |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
10 """Return the version of MSVC that was used to build Python. |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
11 |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
12 For Python 2.3 and up, the version number is included in |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
13 sys.version. For earlier versions, assume the compiler is MSVC 6. |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
14 """ |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
15 # This function was copied from Lib/distutils/msvccompiler.py |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
16 prefix = "MSC v." |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
17 i = sys.version.find(prefix) |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
18 if i == -1: |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
19 return 6 |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
20 i = i + len(prefix) |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
21 s, rest = sys.version[i:].split(" ", 1) |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
22 majorVersion = int(s[:-2]) - 6 |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
23 minorVersion = int(s[2:3]) / 10.0 |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
24 # I don't think paths are affected by minor version in version 6 |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
25 if majorVersion == 6: |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
26 minorVersion = 0 |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
27 if majorVersion >= 6: |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
28 return majorVersion + minorVersion |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
29 # else we don't know what version of the compiler this is |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
30 return None |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
31 |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
32 def find_msvcrt(): |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
33 """Return the name of the VC runtime dll""" |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
34 version = _get_build_version() |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
35 if version is None: |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
36 # better be safe than sorry |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
37 return None |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
38 if version <= 6: |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
39 clibname = 'msvcrt' |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
40 else: |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
41 clibname = 'msvcr%d' % (version * 10) |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
42 |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
43 # If python was built with in debug mode |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
44 import imp |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
45 if imp.get_suffixes()[0][0] == '_d.pyd': |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
46 clibname += 'd' |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
47 return clibname+'.dll' |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
48 |
|
38166
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
49 def find_library(name): |
|
47113
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
50 if name in ('c', 'm'): |
|
6af64512294a
Issue 1793: Add ctypes.util.find_msvcrt() function (on Windows).
Thomas Heller <theller@ctypes.org>
parents:
43371
diff
changeset
|
51 return find_msvcrt() |
|
38166
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
52 # See MSDN for the REAL search order. |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
53 for directory in os.environ['PATH'].split(os.pathsep): |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
54 fname = os.path.join(directory, name) |
|
53807
a85e6756ded2
Merged revisions 72352 via svnmerge from
Thomas Heller <theller@ctypes.org>
parents:
50704
diff
changeset
|
55 if os.path.isfile(fname): |
|
38166
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
56 return fname |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
57 if fname.lower().endswith(".dll"): |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
58 continue |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
59 fname = fname + ".dll" |
|
53807
a85e6756ded2
Merged revisions 72352 via svnmerge from
Thomas Heller <theller@ctypes.org>
parents:
50704
diff
changeset
|
60 if os.path.isfile(fname): |
|
38166
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
61 return fname |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
62 return None |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
63 |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
64 if os.name == "ce": |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
65 # search path according to MSDN: |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
66 # - absolute path specified by filename |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
67 # - The .exe launch directory |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
68 # - the Windows directory |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
69 # - ROM dll files (where are they?) |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
70 # - OEM specified search path: HKLM\Loader\SystemPath |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
71 def find_library(name): |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
72 return name |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
73 |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
74 if os.name == "posix" and sys.platform == "darwin": |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
75 from ctypes.macholib.dyld import dyld_find as _dyld_find |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
76 def find_library(name): |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
77 possible = ['lib%s.dylib' % name, |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
78 '%s.dylib' % name, |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
79 '%s.framework/%s' % (name, name)] |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
80 for name in possible: |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
81 try: |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
82 return _dyld_find(name) |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
83 except ValueError: |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
84 continue |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
85 return None |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
86 |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
87 elif os.name == "posix": |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
88 # Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump |
|
38743
e8464afef4a4
Fix errors found by pychecker
Neal Norwitz <nnorwitz@gmail.com>
parents:
38166
diff
changeset
|
89 import re, tempfile, errno |
|
38166
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
90 |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
91 def _findLib_gcc(name): |
|
40612
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
92 expr = r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name) |
|
39075
e4b6a4f2ce14
Fix #1521375. When running with root priviledges, 'gcc -o /dev/null'
Thomas Heller <theller@ctypes.org>
parents:
38780
diff
changeset
|
93 fdout, ccout = tempfile.mkstemp() |
|
e4b6a4f2ce14
Fix #1521375. When running with root priviledges, 'gcc -o /dev/null'
Thomas Heller <theller@ctypes.org>
parents:
38780
diff
changeset
|
94 os.close(fdout) |
|
50704
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
95 cmd = 'if type gcc >/dev/null 2>&1; then CC=gcc; elif type cc >/dev/null 2>&1; then CC=cc;else exit 10; fi;' \ |
|
39075
e4b6a4f2ce14
Fix #1521375. When running with root priviledges, 'gcc -o /dev/null'
Thomas Heller <theller@ctypes.org>
parents:
38780
diff
changeset
|
96 '$CC -Wl,-t -o ' + ccout + ' 2>&1 -l' + name |
|
38166
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
97 try: |
|
40612
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
98 f = os.popen(cmd) |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
99 trace = f.read() |
|
50704
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
100 rv = f.close() |
|
38166
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
101 finally: |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
102 try: |
|
39075
e4b6a4f2ce14
Fix #1521375. When running with root priviledges, 'gcc -o /dev/null'
Thomas Heller <theller@ctypes.org>
parents:
38780
diff
changeset
|
103 os.unlink(ccout) |
|
e4b6a4f2ce14
Fix #1521375. When running with root priviledges, 'gcc -o /dev/null'
Thomas Heller <theller@ctypes.org>
parents:
38780
diff
changeset
|
104 except OSError, e: |
|
e4b6a4f2ce14
Fix #1521375. When running with root priviledges, 'gcc -o /dev/null'
Thomas Heller <theller@ctypes.org>
parents:
38780
diff
changeset
|
105 if e.errno != errno.ENOENT: |
|
e4b6a4f2ce14
Fix #1521375. When running with root priviledges, 'gcc -o /dev/null'
Thomas Heller <theller@ctypes.org>
parents:
38780
diff
changeset
|
106 raise |
|
50704
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
107 if rv == 10: |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
108 raise OSError, 'gcc or cc command not found' |
|
38166
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
109 res = re.search(expr, trace) |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
110 if not res: |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
111 return None |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
112 return res.group(0) |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
113 |
|
43371
fdff48f87f35
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Thomas Heller <theller@ctypes.org>
parents:
40612
diff
changeset
|
114 |
|
fdff48f87f35
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Thomas Heller <theller@ctypes.org>
parents:
40612
diff
changeset
|
115 if sys.platform == "sunos5": |
|
fdff48f87f35
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Thomas Heller <theller@ctypes.org>
parents:
40612
diff
changeset
|
116 # use /usr/ccs/bin/dump on solaris |
|
fdff48f87f35
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Thomas Heller <theller@ctypes.org>
parents:
40612
diff
changeset
|
117 def _get_soname(f): |
|
fdff48f87f35
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Thomas Heller <theller@ctypes.org>
parents:
40612
diff
changeset
|
118 if not f: |
|
fdff48f87f35
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Thomas Heller <theller@ctypes.org>
parents:
40612
diff
changeset
|
119 return None |
|
fdff48f87f35
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Thomas Heller <theller@ctypes.org>
parents:
40612
diff
changeset
|
120 cmd = "/usr/ccs/bin/dump -Lpv 2>/dev/null " + f |
|
fdff48f87f35
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Thomas Heller <theller@ctypes.org>
parents:
40612
diff
changeset
|
121 res = re.search(r'\[.*\]\sSONAME\s+([^\s]+)', os.popen(cmd).read()) |
|
fdff48f87f35
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Thomas Heller <theller@ctypes.org>
parents:
40612
diff
changeset
|
122 if not res: |
|
fdff48f87f35
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Thomas Heller <theller@ctypes.org>
parents:
40612
diff
changeset
|
123 return None |
|
fdff48f87f35
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Thomas Heller <theller@ctypes.org>
parents:
40612
diff
changeset
|
124 return res.group(1) |
|
fdff48f87f35
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Thomas Heller <theller@ctypes.org>
parents:
40612
diff
changeset
|
125 else: |
|
fdff48f87f35
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Thomas Heller <theller@ctypes.org>
parents:
40612
diff
changeset
|
126 def _get_soname(f): |
|
fdff48f87f35
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Thomas Heller <theller@ctypes.org>
parents:
40612
diff
changeset
|
127 # assuming GNU binutils / ELF |
|
fdff48f87f35
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Thomas Heller <theller@ctypes.org>
parents:
40612
diff
changeset
|
128 if not f: |
|
fdff48f87f35
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Thomas Heller <theller@ctypes.org>
parents:
40612
diff
changeset
|
129 return None |
|
50704
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
130 cmd = 'if ! type objdump >/dev/null 2>&1; then exit 10; fi;' \ |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
131 "objdump -p -j .dynamic 2>/dev/null " + f |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
132 f = os.popen(cmd) |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
133 dump = f.read() |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
134 rv = f.close() |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
135 if rv == 10: |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
136 raise OSError, 'objdump command not found' |
|
43371
fdff48f87f35
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Thomas Heller <theller@ctypes.org>
parents:
40612
diff
changeset
|
137 res = re.search(r'\sSONAME\s+([^\s]+)', os.popen(cmd).read()) |
|
fdff48f87f35
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Thomas Heller <theller@ctypes.org>
parents:
40612
diff
changeset
|
138 if not res: |
|
fdff48f87f35
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Thomas Heller <theller@ctypes.org>
parents:
40612
diff
changeset
|
139 return None |
|
fdff48f87f35
ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris.
Thomas Heller <theller@ctypes.org>
parents:
40612
diff
changeset
|
140 return res.group(1) |
|
38166
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
141 |
|
40612
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
142 if (sys.platform.startswith("freebsd") |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
143 or sys.platform.startswith("openbsd") |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
144 or sys.platform.startswith("dragonfly")): |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
145 |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
146 def _num_version(libname): |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
147 # "libxyz.so.MAJOR.MINOR" => [ MAJOR, MINOR ] |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
148 parts = libname.split(".") |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
149 nums = [] |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
150 try: |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
151 while parts: |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
152 nums.insert(0, int(parts.pop())) |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
153 except ValueError: |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
154 pass |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
155 return nums or [ sys.maxint ] |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
156 |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
157 def find_library(name): |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
158 ename = re.escape(name) |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
159 expr = r':-l%s\.\S+ => \S*/(lib%s\.\S+)' % (ename, ename) |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
160 res = re.findall(expr, |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
161 os.popen('/sbin/ldconfig -r 2>/dev/null').read()) |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
162 if not res: |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
163 return _get_soname(_findLib_gcc(name)) |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
164 res.sort(cmp= lambda x,y: cmp(_num_version(x), _num_version(y))) |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
165 return res[-1] |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
166 |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
167 else: |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
168 |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
169 def _findLib_ldconfig(name): |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
170 # XXX assuming GLIBC's ldconfig (with option -p) |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
171 expr = r'/[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name) |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
172 res = re.search(expr, |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
173 os.popen('/sbin/ldconfig -p 2>/dev/null').read()) |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
174 if not res: |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
175 # Hm, this works only for libs needed by the python executable. |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
176 cmd = 'ldd %s 2>/dev/null' % sys.executable |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
177 res = re.search(expr, os.popen(cmd).read()) |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
178 if not res: |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
179 return None |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
180 return res.group(0) |
|
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
181 |
|
50704
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
182 def _findSoname_ldconfig(name): |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
183 import struct |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
184 if struct.calcsize('l') == 4: |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
185 machine = os.uname()[4] + '-32' |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
186 else: |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
187 machine = os.uname()[4] + '-64' |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
188 mach_map = { |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
189 'x86_64-64': 'libc6,x86-64', |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
190 'ppc64-64': 'libc6,64bit', |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
191 'sparc64-64': 'libc6,64bit', |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
192 's390x-64': 'libc6,64bit', |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
193 'ia64-64': 'libc6,IA-64', |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
194 } |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
195 abi_type = mach_map.get(machine, 'libc6') |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
196 |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
197 # XXX assuming GLIBC's ldconfig (with option -p) |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
198 expr = r'(\S+)\s+\((%s(?:, OS ABI:[^\)]*)?)\)[^/]*(/[^\(\)\s]*lib%s\.[^\(\)\s]*)' \ |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
199 % (abi_type, re.escape(name)) |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
200 res = re.search(expr, |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
201 os.popen('/sbin/ldconfig -p 2>/dev/null').read()) |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
202 if not res: |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
203 return None |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
204 return res.group(1) |
|
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
205 |
|
40612
cf8af6b7598b
patch #1610795: BSD version of ctypes.util.find_library, by Martin
Thomas Heller <theller@ctypes.org>
parents:
39075
diff
changeset
|
206 def find_library(name): |
|
50704
3b5be0ee32ea
Merge r68487 from svn+ssh://pythondev@svn.python.org/python/trunk:
Matthias Klose <doko@ubuntu.com>
parents:
47113
diff
changeset
|
207 return _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name)) |
|
38166
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
208 |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
209 ################################################################ |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
210 # test code |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
211 |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
212 def test(): |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
213 from ctypes import cdll |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
214 if os.name == "nt": |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
215 print cdll.msvcrt |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
216 print cdll.load("msvcrt") |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
217 print find_library("msvcrt") |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
218 |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
219 if os.name == "posix": |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
220 # find and load_version |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
221 print find_library("m") |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
222 print find_library("c") |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
223 print find_library("bz2") |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
224 |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
225 # getattr |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
226 ## print cdll.m |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
227 ## print cdll.bz2 |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
228 |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
229 # load |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
230 if sys.platform == "darwin": |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
231 print cdll.LoadLibrary("libm.dylib") |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
232 print cdll.LoadLibrary("libcrypto.dylib") |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
233 print cdll.LoadLibrary("libSystem.dylib") |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
234 print cdll.LoadLibrary("System.framework/System") |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
235 else: |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
236 print cdll.LoadLibrary("libm.so") |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
237 print cdll.LoadLibrary("libcrypt.so") |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
238 print find_library("crypt") |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
239 |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
240 if __name__ == "__main__": |
|
574ffc4d7bf6
Add missing svn properties.
Thomas Heller <theller@ctypes.org>
parents:
37906
diff
changeset
|
241 test() |
