AlkantarClanX12

Your IP : 18.218.95.236


Current Path : /opt/alt/python34/lib/python3.4/site-packages/pip/vcs/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib/python3.4/site-packages/pip/vcs/__pycache__/subversion.cpython-34.pyc

�
�Re�)�@sddlZddlZddlmZddlmZddlmZmZm	Z	ddl
mZddlm
Z
mZejd�Zejd�Zejd	�Zejd
�Zejd�Zejd�ZGd
d�de�Zdd�Ze
je�dS)�N)�urlparse)�Link)�rmtree�display_path�call_subprocess)�logger)�vcs�VersionControlz
url="([^"]+)"zcommitted-rev="(\d+)"z	URL: (.+)zRevision: (.+)z\s*revision="(\d+)"z<url>(.*)</url>cs�eZdZdZdZdZd'ZdZd	Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Z�fdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%d&�Z�S)(�
Subversion�svnz.svn�checkout�svn+ssh�svn+http�	svn+https�svn+svnzsvn-checkout.txtzg# This was an svn checkout; to make it a checkout again run:
svn checkout --force -r %(rev)s %(url)s .
cCs|jd�j|j�s,td|��t|jd|gdddidd6�}tj|�}|s�tj	d	t
|��tjd
|�dS|jd�j
�}tj|�}|s�tj	d
t
|��tjd
|�|dfS||jd�fS)z/Returns (url, revision), where both are strings�/zBad directory: %s�info�show_stdoutF�
extra_environ�C�LANGz'Cannot determine URL of svn checkout %sz!Output that cannot be parsed: 
%sN�z,Cannot determine revision of svn checkout %s)NN)�rstrip�endswith�dirname�AssertionErrorr�cmd�_svn_url_re�searchr�warnrr�group�strip�_svn_revision_re)�self�location�output�match�url�r(�-/tmp/pip-ztkk0jow-build/pip/vcs/subversion.py�get_infos,(
zSubversion.get_infocCs�x�|j�D]�}|j�s
|j�jd�r;q
ntjd|�}|sWdS|jd�}||j�d�j�jdd�d}||fSWdS)N�#z
^-r\s*([^ ])?rr)NN)NN)�
splitlinesr!�
startswith�rerr �end�split)r#�content�liner&�rev�restr(r(r)�parse_vcs_bundle_file,s",z Subversion.parse_vcs_bundle_filecCs�|j�\}}t||�}tjd||f�tjd7_zStjj|�rit|�nt	|j
dg|||gd|jdd�Wdtjd8_XdS)z@Export the svn repository at the url to the destination locationz!Exporting svn repository %s to %s��export�
filter_stdoutrFN)�get_url_rev�get_rev_optionsr�notify�indent�os�path�existsrrr�_filter)r#r$r'r3�rev_optionsr(r(r)r78s
zSubversion.exportcCs%t|jdg|||g�dS)N�switch)rr)r#�destr'rAr(r(r)rBIszSubversion.switchcCs"t|jdg||g�dS)N�update)rr)r#rCrAr(r(r)rDMszSubversion.updatecCs�|j�\}}t||�}|r4d|}nd}|j||||�r�tjd||t|�f�t|jddg|||g�ndS)Nz (to revision %s)�zChecking out %s%s to %srz-q)r9r:�check_destinationrr;rrr)r#rCr'r3rA�rev_displayr(r(r)�obtainQs
	zSubversion.obtaincCs�x�|D]�}t|�j}|s(qnd|kr_dj|jd�dd��j�}n|}||jkr|jdd�dSqWdS)N�-rr+r���)r�egg_fragment�joinr0�lower�key)r#�dist�dependency_linksr'rKrNr(r(r)�get_location^s
+zSubversion.get_locationc
Cs�d}x�tj|�D]�\}}}|j|krJg|dd�<qn|j|j�tjj||jd�}tjj|�s�qn|j|�\}}||kr�|d}	n-|s�|j|	�r�g|dd�<qnt	||�}qW|S)zR
        Return the maximum revision for all files under a given location
        rN�entriesr)
r=�walkr�remover>rLr?�_get_svn_url_revr-�max)
r#r$�revision�base�dirs�files�
entries_fn�dirurl�localrev�base_urlr(r(r)�get_revisionls"
zSubversion.get_revisioncsAtt|�j�\}}|jd�r7d|}n||fS)Nzssh://zsvn+)�superr
r9r-)r#r'r3)�	__class__r(r)r9�s
zSubversion.get_url_revcCsx|}x^tjjtjj|d��sf|}tjj|�}||kr	tjd|�dSq	W|j|�dS)Nzsetup.pyzGCould not find setup.py for directory %s (tried all parent directories)r)r=r>r?rLrrrrU)r#r$�
orig_location�
last_locationr(r(r)�get_url�s$	zSubversion.get_urlc
Cs�ddlm}ttjj||jd��}|j�}|j�|j	d�st|j	d�st|j	d�r�t
ttj
|jd���}|dd=|dd}d	d
�|D�dg}n�|j	d�r7tj|�}|std|��n|jd
�}dd
�tj|�D�dg}n{yYt|jdd|gdd�}tj|�jd
�}dd
�tj|�D�}Wn|k
r�dg}}YnX|r�t|�}	nd}	||	fS)Nr)�InstallationErrorrR�8�9�10z

�cSs<g|]2}t|�dkr|drt|d��qS)�	)�len�int)�.0�dr(r(r)�
<listcomp>�s	z/Subversion._get_svn_url_rev.<locals>.<listcomp>z<?xmlzBadly formatted data: %rrcSs%g|]}t|jd���qS)r)rlr )rm�mr(r(r)ro�s	rz--xmlrFcSs%g|]}t|jd���qS)r)rlr )rmrpr(r(r)ro�s	)�pip.exceptionsre�openr=r>rLr�read�closer-�list�map�strr,r0�_svn_xml_url_rer�
ValueErrorr �_svn_rev_re�finditerrr�_svn_info_xml_url_re�_svn_info_xml_rev_rerV)
r#r$re�f�datar'�revsr&�xmlr3r(r(r)rU�s2!
-!&! 
zSubversion._get_svn_url_revcCs�t|jdd|gdd�}g}xV|j�D]H}|j�}t|d�}|djd�}|j||f�q4W|S)	N�lsz-vrFrrrrJ)rrr,r0rlr!�append)r#�svn_tag_url�stdout�resultsr2�partsr3�tagr(r(r)�get_tag_revs�szSubversion.get_tag_revscCsZd}d}xG|D]?\}}||kr|dksC||kr|}|}qqW|S)Nr()r#r3�tag_revs�best_match_rev�best_tagr��tag_revr(r(r)�find_tag_match�s
zSubversion.find_tag_matchFcCs�|j|�}|dkrdS|jd�}|j�jdd�d}|j|�}|ddkr�d||df}n�|ddkr�d|j�|d|f}n�|ddkrZd
|j�|f}|r{dj|dd��d}	|j|	�}
|j||
�}|rWtjd|�d|	|f}d||f}qWq{n!tj	d|�d
||f}d|||fS)NrrIrrr6�tagsr�z%s-%s�branches�branchz	%s-%s-r%s�trunkz
%s-dev_r%sz/tagsz2trunk checkout %s seems to be equivalent to tag %sz%s/%sz?svn URL does not fit normal structure (tags/branches/trunk): %szsvn+%s@%s#egg=%s���)ztagsztagrJr�)zbrancheszbranchrJrJrJ)
rdr0�egg_namer_rLr�r�rr;r)r#rOr$�	find_tags�repor��egg_project_namer3�
full_egg_name�tag_urlr�r&r(r(r)�get_src_requirement�s. zSubversion.get_src_requirement)zsvnr
rrr)�__name__�
__module__�__qualname__�namer�	repo_name�schemes�bundle_file�guider*r5r7rBrDrHrQr_r9rdrUr�r�r�r(r()rar)r
s(
!r
cCs�|rd|g}ng}tj|�}t|d�rO|j|j}}nl|d}d|kr�|jd�d}d|kr�|jdd�\}}q�|d}}nd	\}}|r�|d|g7}n|r�|d|g7}n|S)
Nz-r�usernamer�@r�:z
--usernamez
--password)NN)r�urlsplit�hasattrr��passwordr0)r'r3rA�rr�r��netloc�authr(r(r)r:�s$
r:)r=r.Zpip.backwardcompatr�	pip.indexr�pip.utilrrr�pip.logr�pip.vcsrr	�compilerxrzrr"r}r|r
r:�registerr(r(r(r)�<module>s�