File: //proc/self/root/lib/python3.6/site-packages/gyp/__pycache__/flock_tool.cpython-36.opt-1.pyc
3
��S]� � @ sh d Z ddlZddlZddlZddlZddlZdd� ZG dd� de�Ze dkrdej
eejdd� �� dS ) z�These functions are executed via gyp-flock-tool when using the Makefile
generator. Used on systems that don't have a built-in flock.� Nc C s t � }|j| � d S )N)� FlockTool�Dispatch)�args�executor� r � /usr/lib/python3.6/flock_tool.py�main s r c @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) r z(This class emulates the 'flock' command.c C s@ t |�dk rtd��d| j|d � }t| |�|dd� � dS )z(Dispatches a string command to a method.� zNot enough argumentszExec%sr N)�len� Exception�_CommandifyName�getattr)�selfr �methodr r r r s zFlockTool.Dispatchc C s |j � jdd�S )z<Transforms a tool name like copy-info-plist to CopyInfoPlist�-� )�title�replace)r Zname_stringr r r r s zFlockTool._CommandifyNamec G sx t j|t jt jB t jB d�}tjjd�rDtj dt
jdddddd�}ntj dt
jdddddd�}t
j
|t
j|� t
j|�S )z5Emulates the most basic behavior of Linux's flock(1).i� �aixZhhIllqqr Zhhllhhl)�os�open�O_WRONLY�O_NOCTTY�O_CREAT�sys�platform�
startswith�struct�pack�fcntlZF_WRLCKZF_SETLK�
subprocessZcall)r ZlockfileZcmd_list�fd�opr r r � ExecFlock"