asda?‰PNG  IHDR ? f ??C1 sRGB ??é gAMA ±? üa pHYs ? ??o¨d GIDATx^íüL”÷e÷Y?a?("Bh?_ò???¢§?q5k?*:t0A-o??¥]VkJ¢M??f?±8\k2íll£1]q?ù???T framework.pyc000064400000005101151027355330007257 0ustar00 {fc@sVdZddlZdgZejdZdZdZedkrRendS(s% Generic framework path manipulation iNtframework_infos(?x) (?P^.*)(?:^|/) (?P (?P\w+).framework/ (?:Versions/(?P[^/]+)/)? (?P=shortname) (?:_(?P[^_]+))? )$ cCs#tj|}|sdS|jS(s} A framework name can take one of the following four forms: Location/Name.framework/Versions/SomeVersion/Name_Suffix Location/Name.framework/Versions/SomeVersion/Name Location/Name.framework/Name_Suffix Location/Name.framework/Name returns None if not found, or a mapping equivalent to: dict( location='Location', name='Name.framework/Versions/SomeVersion/Name_Suffix', shortname='Name', version='SomeVersion', suffix='Suffix', ) Note that SomeVersion and Suffix are optional and may be None if not present N(tSTRICT_FRAMEWORK_REtmatchtNonet groupdict(tfilenamet is_framework((s1/usr/lib64/python2.7/ctypes/macholib/framework.pyRscCsKdddddd}tddks0ttddksHttddks`ttddksxttd|ddd ksttd |dd d d d ksttddksttddksttd|ddd dksttd|ddd dd ksGtdS(Nc Ss%td|d|d|d|d|S(Ntlocationtnamet shortnametversiontsuffix(tdict(RRR R R ((s1/usr/lib64/python2.7/ctypes/macholib/framework.pytd-s scompletely/invalidscompletely/invalid/_debugs P/F.frameworksP/F.framework/_debugsP/F.framework/FtPs F.framework/FtFsP/F.framework/F_debugsF.framework/F_debugR tdebugsP/F.framework/VersionssP/F.framework/Versions/AsP/F.framework/Versions/A/FsF.framework/Versions/A/FtAs P/F.framework/Versions/A/F_debugsF.framework/Versions/A/F_debug(RRtAssertionError(R ((s1/usr/lib64/python2.7/ctypes/macholib/framework.pyttest_framework_info,s$*'t__main__(t__doc__tret__all__tcompileRRRt__name__(((s1/usr/lib64/python2.7/ctypes/macholib/framework.pyts      dylib.pyo000064400000003305151027355330006405 0ustar00 {fc@sVdZddlZdgZejdZdZdZedkrRendS(s! Generic dylib path manipulation iNt dylib_infos(?x) (?P^.*)(?:^|/) (?P (?P\w+?) (?:\.(?P[^._]+))? (?:_(?P[^._]+))? \.dylib$ ) cCs#tj|}|sdS|jS(s1 A dylib name can take one of the following four forms: Location/Name.SomeVersion_Suffix.dylib Location/Name.SomeVersion.dylib Location/Name_Suffix.dylib Location/Name.dylib returns None if not found or a mapping equivalent to: dict( location='Location', name='Name.SomeVersion_Suffix.dylib', shortname='Name', version='SomeVersion', suffix='Suffix', ) Note that SomeVersion and Suffix are optional and may be None if not present. N(tDYLIB_REtmatchtNonet groupdict(tfilenametis_dylib((s-/usr/lib64/python2.7/ctypes/macholib/dylib.pyRscCsdddddd}dS(Nc Ss%td|d|d|d|d|S(Ntlocationtnamet shortnametversiontsuffix(tdict(RRR R R ((s-/usr/lib64/python2.7/ctypes/macholib/dylib.pytd.s (R(R ((s-/usr/lib64/python2.7/ctypes/macholib/dylib.pyttest_dylib_info-st__main__(t__doc__tret__all__tcompileRRRt__name__(((s-/usr/lib64/python2.7/ctypes/macholib/dylib.pyts      __init__.pyc000064400000000474151027355330007031 0ustar00 {fc@sdZdZdS(s~ Enough Mach-O to make your head spin. See the relevant header files in /usr/include/mach-o And also Apple's documentation. s1.0N(t__doc__t __version__(((s0/usr/lib64/python2.7/ctypes/macholib/__init__.pytsdyld.pyc000064400000013233151027355330006223 0ustar00 {fc@sIdZddlZddlmZddlmZddlTdddd gZejj d d d d gZ ejj ddddgZ dZ dZ ddZddZddZddZddZddZddZddZddZdddZdddZdZed krEendS(!s dyld emulation iN(tframework_info(t dylib_info(t*t dyld_findtframework_findRRs~/Library/Frameworkss/Library/Frameworkss/Network/Library/Frameworkss/System/Library/Frameworkss~/libs/usr/local/libs/libs/usr/libcCs t|tr|jdS|S(sCNot all of PyObjC and Python understand unicode paths very well yettutf8(t isinstancetunicodetencode(ts((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pyt ensure_utf8s cCsD|dkrtj}n|j|}|dkr7gS|jdS(Nt:(tNonetostenvirontgettsplit(tenvtvartrval((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_env%s    cCs%|dkrtj}n|jdS(NtDYLD_IMAGE_SUFFIX(R R RR(R((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_image_suffix-s  cCs t|dS(NtDYLD_FRAMEWORK_PATH(R(R((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_framework_path2scCs t|dS(NtDYLD_LIBRARY_PATH(R(R((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_library_path5scCs t|dS(NtDYLD_FALLBACK_FRAMEWORK_PATH(R(R((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_fallback_framework_path8scCs t|dS(NtDYLD_FALLBACK_LIBRARY_PATH(R(R((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_fallback_library_path;scCs2t|}|dkr|S||d}|S(s>For a potential path iterator, add DYLD_IMAGE_SUFFIX semanticscssMxF|D]>}|jdr7|td |dVn ||V|VqWdS(Ns.dylib(tendswithtlen(titeratortsuffixtpath((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pyt_injectCs   N(RR (R!RR"R$((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_image_suffix_search>s   ccst|}|dk rJx/t|D]}tjj||dVq%Wnx4t|D]&}tjj|tjj|VqWWdS(Ntname(RR RR R#tjoinRtbasename(R&Rt frameworkR#((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_override_searchLs   ccs@|jdr<|dk r<tjj||tdVndS(Ns@executable_path/(t startswithR R R#R'R (R&texecutable_path((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_executable_path_search]sccs|Vt|}|dk rUt|}x)|D]}tjj||dVq0Wnt|}x.|D]&}tjj|tjj|VqhW|dk r| rx)tD]}tjj||dVqWn|s x1t D]&}tjj|tjj|VqWndS(NR&( RR RR R#R'RR(tDEFAULT_FRAMEWORK_FALLBACKtDEFAULT_LIBRARY_FALLBACK(R&RR)tfallback_framework_pathR#tfallback_library_path((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_default_searchds      $  cCst|}t|}xTttt||t||t|||D]}tjj|rO|SqOWt d|fdS(s: Find a library or framework using dyld semantics sdylib %s could not be foundN( R R%tchainR*R-R2R R#tisfilet ValueError(R&R,RR#((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pyRzs      cCsyt|d|d|SWntk r/}nX|jd}|dkrdt|}|d7}ntjj|tjj|| }yt|d|d|SWntk r|nXdS(s Find a framework using dyld semantics in a very loose manner. Will take input such as: Python Python.framework Python.framework/Versions/Current R,Rs .frameworkiN(RR5trfindR R R#R'R((tfnR,Rtet fmwk_index((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pyRs    % cCs:i}tddksttddks6tdS(NslibSystem.dylibs/usr/lib/libSystem.dylibsSystem.framework/Systems2/System/Library/Frameworks/System.framework/System(RtAssertionError(R((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pyttest_dyld_findst__main__(t__doc__R R)RtdylibRt itertoolst__all__R#t expanduserR.R/R RR RRRRRR%R*R-R2RRR;t__name__(((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pyts<                  dylib.pyc000064400000004413151027355330006372 0ustar00 {fc@sVdZddlZdgZejdZdZdZedkrRendS(s! Generic dylib path manipulation iNt dylib_infos(?x) (?P^.*)(?:^|/) (?P (?P\w+?) (?:\.(?P[^._]+))? (?:_(?P[^._]+))? \.dylib$ ) cCs#tj|}|sdS|jS(s1 A dylib name can take one of the following four forms: Location/Name.SomeVersion_Suffix.dylib Location/Name.SomeVersion.dylib Location/Name_Suffix.dylib Location/Name.dylib returns None if not found or a mapping equivalent to: dict( location='Location', name='Name.SomeVersion_Suffix.dylib', shortname='Name', version='SomeVersion', suffix='Suffix', ) Note that SomeVersion and Suffix are optional and may be None if not present. N(tDYLIB_REtmatchtNonet groupdict(tfilenametis_dylib((s-/usr/lib64/python2.7/ctypes/macholib/dylib.pyRscCsdddddd}tddks0ttddksHttd|dddkslttd|dd dd d ksttd |dd ddksttd|ddddksttd|ddddd kstdS(Nc Ss%td|d|d|d|d|S(Ntlocationtnamet shortnametversiontsuffix(tdict(RRR R R ((s-/usr/lib64/python2.7/ctypes/macholib/dylib.pytd.s scompletely/invalidscompletely/invalide_debugs P/Foo.dylibtPs Foo.dylibtFoosP/Foo_debug.dylibsFoo_debug.dylibR tdebugs P/Foo.A.dylibs Foo.A.dylibtAsP/Foo_debug.A.dylibsFoo_debug.A.dylibt Foo_debugsP/Foo.A_debug.dylibsFoo.A_debug.dylib(RRtAssertionError(R ((s-/usr/lib64/python2.7/ctypes/macholib/dylib.pyttest_dylib_info-s$*''t__main__(t__doc__tret__all__tcompileRRRt__name__(((s-/usr/lib64/python2.7/ctypes/macholib/dylib.pyts      dylib.py000064400000003444151027355330006232 0ustar00""" Generic dylib path manipulation """ import re __all__ = ['dylib_info'] DYLIB_RE = re.compile(r"""(?x) (?P^.*)(?:^|/) (?P (?P\w+?) (?:\.(?P[^._]+))? (?:_(?P[^._]+))? \.dylib$ ) """) def dylib_info(filename): """ A dylib name can take one of the following four forms: Location/Name.SomeVersion_Suffix.dylib Location/Name.SomeVersion.dylib Location/Name_Suffix.dylib Location/Name.dylib returns None if not found or a mapping equivalent to: dict( location='Location', name='Name.SomeVersion_Suffix.dylib', shortname='Name', version='SomeVersion', suffix='Suffix', ) Note that SomeVersion and Suffix are optional and may be None if not present. """ is_dylib = DYLIB_RE.match(filename) if not is_dylib: return None return is_dylib.groupdict() def test_dylib_info(): def d(location=None, name=None, shortname=None, version=None, suffix=None): return dict( location=location, name=name, shortname=shortname, version=version, suffix=suffix ) assert dylib_info('completely/invalid') is None assert dylib_info('completely/invalide_debug') is None assert dylib_info('P/Foo.dylib') == d('P', 'Foo.dylib', 'Foo') assert dylib_info('P/Foo_debug.dylib') == d('P', 'Foo_debug.dylib', 'Foo', suffix='debug') assert dylib_info('P/Foo.A.dylib') == d('P', 'Foo.A.dylib', 'Foo', 'A') assert dylib_info('P/Foo_debug.A.dylib') == d('P', 'Foo_debug.A.dylib', 'Foo_debug', 'A') assert dylib_info('P/Foo.A_debug.dylib') == d('P', 'Foo.A_debug.dylib', 'Foo', 'A', 'debug') if __name__ == '__main__': test_dylib_info() framework.pyo000064400000003523151027355330007301 0ustar00 {fc@sVdZddlZdgZejdZdZdZedkrRendS(s% Generic framework path manipulation iNtframework_infos(?x) (?P^.*)(?:^|/) (?P (?P\w+).framework/ (?:Versions/(?P[^/]+)/)? (?P=shortname) (?:_(?P[^_]+))? )$ cCs#tj|}|sdS|jS(s} A framework name can take one of the following four forms: Location/Name.framework/Versions/SomeVersion/Name_Suffix Location/Name.framework/Versions/SomeVersion/Name Location/Name.framework/Name_Suffix Location/Name.framework/Name returns None if not found, or a mapping equivalent to: dict( location='Location', name='Name.framework/Versions/SomeVersion/Name_Suffix', shortname='Name', version='SomeVersion', suffix='Suffix', ) Note that SomeVersion and Suffix are optional and may be None if not present N(tSTRICT_FRAMEWORK_REtmatchtNonet groupdict(tfilenamet is_framework((s1/usr/lib64/python2.7/ctypes/macholib/framework.pyRscCsdddddd}dS(Nc Ss%td|d|d|d|d|S(Ntlocationtnamet shortnametversiontsuffix(tdict(RRR R R ((s1/usr/lib64/python2.7/ctypes/macholib/framework.pytd-s (R(R ((s1/usr/lib64/python2.7/ctypes/macholib/framework.pyttest_framework_info,st__main__(t__doc__tret__all__tcompileRRRt__name__(((s1/usr/lib64/python2.7/ctypes/macholib/framework.pyts      fetch_macholib000075500000000124151027355330007422 0ustar00#!/bin/sh svn export --force http://svn.red-bean.com/bob/macholib/trunk/macholib/ . __init__.pyo000064400000000474151027355330007045 0ustar00 {fc@sdZdZdS(s~ Enough Mach-O to make your head spin. See the relevant header files in /usr/include/mach-o And also Apple's documentation. s1.0N(t__doc__t __version__(((s0/usr/lib64/python2.7/ctypes/macholib/__init__.pytsframework.py000064400000004231151027355330007117 0ustar00""" Generic framework path manipulation """ import re __all__ = ['framework_info'] STRICT_FRAMEWORK_RE = re.compile(r"""(?x) (?P^.*)(?:^|/) (?P (?P\w+).framework/ (?:Versions/(?P[^/]+)/)? (?P=shortname) (?:_(?P[^_]+))? )$ """) def framework_info(filename): """ A framework name can take one of the following four forms: Location/Name.framework/Versions/SomeVersion/Name_Suffix Location/Name.framework/Versions/SomeVersion/Name Location/Name.framework/Name_Suffix Location/Name.framework/Name returns None if not found, or a mapping equivalent to: dict( location='Location', name='Name.framework/Versions/SomeVersion/Name_Suffix', shortname='Name', version='SomeVersion', suffix='Suffix', ) Note that SomeVersion and Suffix are optional and may be None if not present """ is_framework = STRICT_FRAMEWORK_RE.match(filename) if not is_framework: return None return is_framework.groupdict() def test_framework_info(): def d(location=None, name=None, shortname=None, version=None, suffix=None): return dict( location=location, name=name, shortname=shortname, version=version, suffix=suffix ) assert framework_info('completely/invalid') is None assert framework_info('completely/invalid/_debug') is None assert framework_info('P/F.framework') is None assert framework_info('P/F.framework/_debug') is None assert framework_info('P/F.framework/F') == d('P', 'F.framework/F', 'F') assert framework_info('P/F.framework/F_debug') == d('P', 'F.framework/F_debug', 'F', suffix='debug') assert framework_info('P/F.framework/Versions') is None assert framework_info('P/F.framework/Versions/A') is None assert framework_info('P/F.framework/Versions/A/F') == d('P', 'F.framework/Versions/A/F', 'F', 'A') assert framework_info('P/F.framework/Versions/A/F_debug') == d('P', 'F.framework/Versions/A/F_debug', 'F', 'A', 'debug') if __name__ == '__main__': test_framework_info() dyld.pyo000064400000012715151027355330006243 0ustar00 {fc@sIdZddlZddlmZddlmZddlTdddd gZejj d d d d gZ ejj ddddgZ dZ dZ ddZddZddZddZddZddZddZddZddZdddZdddZdZed krEendS(!s dyld emulation iN(tframework_info(t dylib_info(t*t dyld_findtframework_findRRs~/Library/Frameworkss/Library/Frameworkss/Network/Library/Frameworkss/System/Library/Frameworkss~/libs/usr/local/libs/libs/usr/libcCs t|tr|jdS|S(sCNot all of PyObjC and Python understand unicode paths very well yettutf8(t isinstancetunicodetencode(ts((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pyt ensure_utf8s cCsD|dkrtj}n|j|}|dkr7gS|jdS(Nt:(tNonetostenvirontgettsplit(tenvtvartrval((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_env%s    cCs%|dkrtj}n|jdS(NtDYLD_IMAGE_SUFFIX(R R RR(R((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_image_suffix-s  cCs t|dS(NtDYLD_FRAMEWORK_PATH(R(R((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_framework_path2scCs t|dS(NtDYLD_LIBRARY_PATH(R(R((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_library_path5scCs t|dS(NtDYLD_FALLBACK_FRAMEWORK_PATH(R(R((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_fallback_framework_path8scCs t|dS(NtDYLD_FALLBACK_LIBRARY_PATH(R(R((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_fallback_library_path;scCs2t|}|dkr|S||d}|S(s>For a potential path iterator, add DYLD_IMAGE_SUFFIX semanticscssMxF|D]>}|jdr7|td |dVn ||V|VqWdS(Ns.dylib(tendswithtlen(titeratortsuffixtpath((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pyt_injectCs   N(RR (R!RR"R$((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_image_suffix_search>s   ccst|}|dk rJx/t|D]}tjj||dVq%Wnx4t|D]&}tjj|tjj|VqWWdS(Ntname(RR RR R#tjoinRtbasename(R&Rt frameworkR#((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_override_searchLs   ccs@|jdr<|dk r<tjj||tdVndS(Ns@executable_path/(t startswithR R R#R'R (R&texecutable_path((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_executable_path_search]sccs|Vt|}|dk rUt|}x)|D]}tjj||dVq0Wnt|}x.|D]&}tjj|tjj|VqhW|dk r| rx)tD]}tjj||dVqWn|s x1t D]&}tjj|tjj|VqWndS(NR&( RR RR R#R'RR(tDEFAULT_FRAMEWORK_FALLBACKtDEFAULT_LIBRARY_FALLBACK(R&RR)tfallback_framework_pathR#tfallback_library_path((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_default_searchds      $  cCst|}t|}xTttt||t||t|||D]}tjj|rO|SqOWt d|fdS(s: Find a library or framework using dyld semantics sdylib %s could not be foundN( R R%tchainR*R-R2R R#tisfilet ValueError(R&R,RR#((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pyRzs      cCsyt|d|d|SWntk r/}nX|jd}|dkrdt|}|d7}ntjj|tjj|| }yt|d|d|SWntk r|nXdS(s Find a framework using dyld semantics in a very loose manner. Will take input such as: Python Python.framework Python.framework/Versions/Current R,Rs .frameworkiN(RR5trfindR R R#R'R((tfnR,Rtet fmwk_index((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pyRs    % cCs i}dS(N((R((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pyttest_dyld_findst__main__(t__doc__R R)RtdylibRt itertoolst__all__R#t expanduserR.R/R RR RRRRRR%R*R-R2RRR:t__name__(((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pyts<                  README.ctypes000064400000000450151027355330006735 0ustar00Files in this directory come from Bob Ippolito's py2app. License: Any components of the py2app suite may be distributed under the MIT or PSF open source licenses. This is version 1.0, SVN revision 789, from 2006/01/25. The main repository is http://svn.red-bean.com/bob/macholib/trunk/macholib/dyld.py000064400000012010151027355330006050 0ustar00""" dyld emulation """ import os from framework import framework_info from dylib import dylib_info from itertools import * __all__ = [ 'dyld_find', 'framework_find', 'framework_info', 'dylib_info', ] # These are the defaults as per man dyld(1) # DEFAULT_FRAMEWORK_FALLBACK = [ os.path.expanduser("~/Library/Frameworks"), "/Library/Frameworks", "/Network/Library/Frameworks", "/System/Library/Frameworks", ] DEFAULT_LIBRARY_FALLBACK = [ os.path.expanduser("~/lib"), "/usr/local/lib", "/lib", "/usr/lib", ] def ensure_utf8(s): """Not all of PyObjC and Python understand unicode paths very well yet""" if isinstance(s, unicode): return s.encode('utf8') return s def dyld_env(env, var): if env is None: env = os.environ rval = env.get(var) if rval is None: return [] return rval.split(':') def dyld_image_suffix(env=None): if env is None: env = os.environ return env.get('DYLD_IMAGE_SUFFIX') def dyld_framework_path(env=None): return dyld_env(env, 'DYLD_FRAMEWORK_PATH') def dyld_library_path(env=None): return dyld_env(env, 'DYLD_LIBRARY_PATH') def dyld_fallback_framework_path(env=None): return dyld_env(env, 'DYLD_FALLBACK_FRAMEWORK_PATH') def dyld_fallback_library_path(env=None): return dyld_env(env, 'DYLD_FALLBACK_LIBRARY_PATH') def dyld_image_suffix_search(iterator, env=None): """For a potential path iterator, add DYLD_IMAGE_SUFFIX semantics""" suffix = dyld_image_suffix(env) if suffix is None: return iterator def _inject(iterator=iterator, suffix=suffix): for path in iterator: if path.endswith('.dylib'): yield path[:-len('.dylib')] + suffix + '.dylib' else: yield path + suffix yield path return _inject() def dyld_override_search(name, env=None): # If DYLD_FRAMEWORK_PATH is set and this dylib_name is a # framework name, use the first file that exists in the framework # path if any. If there is none go on to search the DYLD_LIBRARY_PATH # if any. framework = framework_info(name) if framework is not None: for path in dyld_framework_path(env): yield os.path.join(path, framework['name']) # If DYLD_LIBRARY_PATH is set then use the first file that exists # in the path. If none use the original name. for path in dyld_library_path(env): yield os.path.join(path, os.path.basename(name)) def dyld_executable_path_search(name, executable_path=None): # If we haven't done any searching and found a library and the # dylib_name starts with "@executable_path/" then construct the # library name. if name.startswith('@executable_path/') and executable_path is not None: yield os.path.join(executable_path, name[len('@executable_path/'):]) def dyld_default_search(name, env=None): yield name framework = framework_info(name) if framework is not None: fallback_framework_path = dyld_fallback_framework_path(env) for path in fallback_framework_path: yield os.path.join(path, framework['name']) fallback_library_path = dyld_fallback_library_path(env) for path in fallback_library_path: yield os.path.join(path, os.path.basename(name)) if framework is not None and not fallback_framework_path: for path in DEFAULT_FRAMEWORK_FALLBACK: yield os.path.join(path, framework['name']) if not fallback_library_path: for path in DEFAULT_LIBRARY_FALLBACK: yield os.path.join(path, os.path.basename(name)) def dyld_find(name, executable_path=None, env=None): """ Find a library or framework using dyld semantics """ name = ensure_utf8(name) executable_path = ensure_utf8(executable_path) for path in dyld_image_suffix_search(chain( dyld_override_search(name, env), dyld_executable_path_search(name, executable_path), dyld_default_search(name, env), ), env): if os.path.isfile(path): return path raise ValueError("dylib %s could not be found" % (name,)) def framework_find(fn, executable_path=None, env=None): """ Find a framework using dyld semantics in a very loose manner. Will take input such as: Python Python.framework Python.framework/Versions/Current """ try: return dyld_find(fn, executable_path=executable_path, env=env) except ValueError, e: pass fmwk_index = fn.rfind('.framework') if fmwk_index == -1: fmwk_index = len(fn) fn += '.framework' fn = os.path.join(fn, os.path.basename(fn[:fmwk_index])) try: return dyld_find(fn, executable_path=executable_path, env=env) except ValueError: raise e def test_dyld_find(): env = {} assert dyld_find('libSystem.dylib') == '/usr/lib/libSystem.dylib' assert dyld_find('System.framework/System') == '/System/Library/Frameworks/System.framework/System' if __name__ == '__main__': test_dyld_find() __init__.py000064400000000232151027355330006656 0ustar00""" Enough Mach-O to make your head spin. See the relevant header files in /usr/include/mach-o And also Apple's documentation. """ __version__ = '1.0'