관리-도구
편집 파일: 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: � �/�refsZheadsz3%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�line�revision�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�NotImplementedError�get_distribution�version)� dist_name�distr r r! r I s r )N) � __future__r �os.pathr r"