ok
Direktori : /opt/alt/python37/lib/python3.7/site-packages/raven/__pycache__/ |
Current File : //opt/alt/python37/lib/python3.7/site-packages/raven/__pycache__/versioning.cpython-37.pyc |
B ��Y( � @ sl d dl mZ d dlZyd dlZW n ek r8 dZY nX d dlmZ ddlm Z dZ ddd�Zd d � ZdS )� )�absolute_importN)� text_type� )�InvalidGitRepository)� fetch_git_sha�fetch_package_versionc C s� |s�t j�| dd�}t j�|�s.td| f ��t|d��}t|�� ��� }W dQ R X |� d�r�|dd� }t jj| df|� d��� }q�|S nt j�| dd d |�}t j�|��s�t j�t j�| d��s�td| f ��t j�| dd�}t j�|��r�t|d���}xx|D ]p}|�� }|�s�q|dd � dk�r.�qy|� dd �\}} W n tk �r\ �wY nX | |k�rt|�S �qW W dQ R X td|f ��t|d�}zt|�� ��� S |� � X dS )z6 >>> fetch_git_sha(os.path.dirname(__file__)) z.gitZHEADz-Cannot identify HEAD for git repository at %s�rNzref: � �/ZrefsZheadsz3%s does not seem to be the root of a git repositoryzpacked-refsr )�#�^� z-Unable to find ref to head "%s" in repository)�os�path�join�existsr �openr �read�strip� startswith�split�rstrip� ValueError�close) r �headZ head_path�fpZ revision_fileZpacked_fileZfh�lineZrevision�ref� r �A/opt/alt/python37/lib/python3.7/site-packages/raven/versioning.pyr sL r c C s t dkrtd��t �| �}|jS )z- >>> fetch_package_version('sentry') Nz5pkg_resources is not available on this Python install)� pkg_resources�NotImplementedErrorZget_distribution�version)Z dist_nameZdistr r r r I s r )N) Z __future__r Zos.pathr r �ImportErrorZraven.utils.compatr � exceptionsr �__all__r r r r r r �<module> s 8