a
XC?h$ � @ s> d Z ddlZdgZe�d�Zdd� Zdd� Zedkr:e� dS ) z!
Generic dylib path manipulation
� N�
dylib_infoz�(?x)
(?P^.*)(?:^|/)
(?P
(?P\w+?)
(?:\.(?P[^._]+))?
(?:_(?P[^._]+))?
\.dylib$
)
c C s t �| �}|sdS |�� 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/python39/lib64/python3.9/ctypes/macholib/dylib.pyr s
c C s� ddd�} t d�d u sJ �t d�d u s*J �t d�| ddd�ksBJ �t d �| dd
ddd�ks^J �t d
�| dddd�ksxJ �t d�| dddd�ks�J �t d�| ddddd�ks�J �d S )Nc S s t | ||||d�S )N��location�nameZ shortname�version�suffix)�dictr r r r �d. s �ztest_dylib_info..dzcompletely/invalidzcompletely/invalide_debugzP/Foo.dylib�Pz Foo.dylibZFoozP/Foo_debug.dylibzFoo_debug.dylib�debug)r
z
P/Foo.A.dylibzFoo.A.dylib�AzP/Foo_debug.A.dylibzFoo_debug.A.dylibZ Foo_debugzP/Foo.A_debug.dylibzFoo.A_debug.dylib)NNNNN)r )r r r r �test_dylib_info- s
r �__main__)�__doc__�re�__all__�compiler r r �__name__r r r r � s