
    eO                    V    d dl mZ 	 d dlZd dlZddlmZ ddlmZ	 dgZ
 G d de	      Zy)    )annotationsN   )MesonException)BuildDirLockr   c                      e Zd ZddZddZy)r   c                   t        | j                  dd      | _        	 t        j                  | j                  t        j
                  t        j                  z         y # t        t        f$ r& | j                  j                          t        d      t        $ r7}| j                  j                          t        d|j                         d }~ww xY w)Nwzutf-8)encodingzHSome other Meson process is already using this build directory. Exiting.z$Failed to lock the build directory: )openlockfilenamelockfilefcntlflockLOCK_EXLOCK_NBBlockingIOErrorPermissionErrorcloser   OSErrorstrerror)selfes     8/usr/lib/python3/dist-packages/mesonbuild/utils/posix.py	__enter__zBuildDirLock.__enter__   s    T..gF	VKKu}}u}}'DE1 	mMM! !kll 	VMM! #G

|!TUU	Vs   ?A <C2CCc                    t        j                  | j                  t         j                         | j                  j	                          y )N)r   r   r   LOCK_UNr   )r   argss     r   __exit__zBuildDirLock.__exit__)   s(    DMM5==1    N)returnNone)r   zT.Anyr    r!   )__name__
__module____qualname__r   r    r   r   r   r      s    	Vr   )
__future__r   r   typingTcorer   platformr   BuildDirLockBase__all__r%   r   r   <module>r-      s.     # ?     6
# r   