î
i f$ ã @ s\ d Z d d l Z d g Z e j d ƒ Z d d „ Z d d „ Z e d k rX e ƒ n d S) z!
Generic dylib path manipulation
é NÚ
dylib_infoz‹(?x)
(?P^.*)(?:^|/)
(?P
(?P\w+?)
(?:\.(?P[^._]+))?
(?:_(?P[^._]+))?
\.dylib$
)
c C s# t j | ƒ } | s d S| j ƒ S)a1
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)ÚDYLIB_REÚmatchÚ groupdict)ÚfilenameZis_dylib© r ú:/opt/alt/python34/lib64/python3.4/ctypes/macholib/dylib.pyr s c C s d d d d d d d „ } t d ƒ d k s3 t ‚ t d ƒ d k sK t ‚ t d ƒ | d d d ƒ k so t ‚ t d ƒ | d d
d d d ƒk s™ t ‚ t d
ƒ | d d d d ƒ k sÀ t ‚ t d ƒ | d d d d ƒ k sç t ‚ t d ƒ | d d d d d ƒ k st ‚ d S)Nc S s% t d | d | d | d | d | ƒ S)NÚlocationÚnameÚ shortnameÚversionÚsuffix)Údict)r r
r r r
r r r Úd. s ztest_dylib_info..dzcompletely/invalidzcompletely/invalide_debugzP/Foo.dylibÚPz Foo.dylibZFoozP/Foo_debug.dylibzFoo_debug.dylibr
Údebugz
P/Foo.A.dylibzFoo.A.dylibÚAzP/Foo_debug.A.dylibzFoo_debug.A.dylibZ Foo_debugzP/Foo.A_debug.dylibzFoo.A_debug.dylib)r ÚAssertionError)r r r r Útest_dylib_info- s $*''r Ú__main__)Ú__doc__ÚreÚ__all__Úcompiler r r Ú__name__r r r r Ú s