
    "Kb                         d Z ddlZddlZddlZddlZddlZd Z G d de          Ze	dk    r( ej
         eej        dd                              dS dS )zThese functions are executed via gyp-flock-tool when using the Makefile
generator.  Used on systems that don't have a built-in flock.    Nc                 L    t                      }|                    |            d S )N)	FlockToolDispatch)argsexecutors     0/usr/lib/python3/dist-packages/gyp/flock_tool.pymainr	      s%    [[(
D    c                   $    e Zd ZdZd Zd Zd ZdS )r   z(This class emulates the 'flock' command.c                     t          |          dk     rt          d          d|                     |d                   z  } t          | |          |dd           dS )z(Dispatches a string command to a method.   zNot enough argumentszExec%sr   N)len	Exception_CommandifyNamegetattr)selfr   methods      r   r   zFlockTool.Dispatch   sa    
4yy1}},---,,T!W555FGD&48$$$$r
   c                 R    |                                                     dd          S )z<Transforms a tool name like copy-info-plist to CopyInfoPlist- )titlereplace)r   name_strings     r   r   zFlockTool._CommandifyName   s$    &&sB///r
   c           
         t          j        |t           j        t           j        z  t           j        z  d          }t
          j                            d          r&t          j	        dt          j        dddddd          }n%t          j	        dt          j        dddddd          }t          j
        |t          j        |           t          j        |          S )z5Emulates the most basic behavior of Linux's flock(1).i  aixhhIllqqr   hhllhhl)osopenO_WRONLYO_NOCTTYO_CREATsysplatform
startswithstructpackfcntlF_WRLCKF_SETLK
subprocesscall)r   lockfilecmd_listfdops        r   	ExecFlockzFlockTool.ExecFlock#   s     
2;r{22:=u	E	EB
|u%% C ;y%-Aq!QBBbb;y%-Aq!QBBb	KEM2&&&?8$$$r
   N)__name__
__module____qualname____doc__r   r   r1    r
   r   r   r      sG        00% % %0 0 0% % % % %r
   r   __main__r   )r5   r(   r   r&   r+   r#   r	   objectr   r2   exitargvr6   r
   r   <module>r;      s   A A  				      



  
% % % % % % % %@ z
#(44 r
   