ok
Direktori : /opt/alt/python37/lib/python3.7/site-packages/clcommon/__pycache__/ |
Current File : //opt/alt/python37/lib/python3.7/site-packages/clcommon/__pycache__/lock.cpython-37.pyc |
B E!wd� � @ sF d dl mZ d dlZd dlZd dlZdd� Zdd� Zejdd� �ZdS ) � )�absolute_importNc C s| t j�| �}|dkr2t j�|�s2t �t j�| �� t| d�}t�|tj� |� dd� |� � |�tt � � �� |�� |S )N� za+r )�os�path�dirname�exists�makedirs�open�fcntl�flockZLOCK_EX�seek�truncate�write�str�getpid�flush)� lockfile_pathZ lock_file_dir�fd� r �>/opt/alt/python37/lib/python3.7/site-packages/clcommon/lock.py� setup_lock s r c C s t �| �� t j� | �� d S )N)r r �filenoZLOCK_UN�close)r r r r �release_lock s r c c s t | �}dV t|� dS )zE Usage: with acquire_lock(): ... do something ... N)r r )r r r r r �acquire_lock% s r ) Z __future__r � contextlibr r r r �contextmanagerr r r r r �<module> s