Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib/python3.5/site-packages/raven/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib/python3.5/site-packages/raven/__pycache__/versioning.cpython-35.pyc



��Y(
�@s�ddlmZddlZyddlZWnek
rFdZYnXddlmZddlm	Z	d
Z
ddd�Zd	d�ZdS)�)�absolute_importN)�	text_type�)�InvalidGitRepository�
fetch_git_sha�fetch_package_versionc
Cs<|s�tjj|dd�}tjj|�sCtd|f��t|d��}t|j��j�}WdQRX|j	d�r�|dd�}tjj|d|j
d��}q�|Sntjj|dd	d
|�}tjj|�stjjtjj|d��s"td|f��tjj|dd�}tjj|�r�t|d���}x�|D]~}|j�}|s�qe|dd
�dkr�qey|j
dd
�\}}	Wntk
r�weYnX|	|kret|�SqeWWdQRXtd|f��t|d�}zt|j��j�SWd|j
�XdS)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)rr
)�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/python35/lib/python3.5/site-packages/raven/versioning.pyrsL	!

cCs.tdkrtd��tj|�}|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!rIs)rr)
�
__future__r�os.pathrr"�ImportErrorZraven.utils.compatr�
exceptionsr�__all__rrr r r r!�<module>s
8