
    "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              yy)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                 :    t               }|j                  |        y )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y)r   z(This class emulates the 'flock' command.c                     t        |      dk  rt        d      d| j                  |d         z  } t        | |      |dd   y)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   sI    
4y1},--,,T!W55FGD&48$r
   c                 B    |j                         j                  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                  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	EB
||u% ;;y%--Aq!QBb;;y%--Aq!QBb	KKEMM2&??8$$r
   N)__name__
__module____qualname____doc__r   r   r1    r
   r   r   r      s    0%0%r
   r   __main__r   )r5   r(   r   r&   r+   r#   r	   objectr   r2   exitargvr6   r
   r   <module>r;      sZ   A  	   

% %@ z
#((4 r
   