Your IP : 3.137.175.83


Current Path : /usr/lib/python3.6/site-packages/pip/vcs/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/pip/vcs/__pycache__/subversion.cpython-36.pyc

3

�Pf�$�@s�ddlmZddlZddlZddlZddlmZddlm	Z	ddl
mZmZddl
mZddlmZmZejd�Zejd	�Zejd
�Zejd�Zejd�Zejd
�Zeje�ZGdd�de�Zdd�Zeje�dS)�)�absolute_importN)�parse)�Link)�rmtree�display_path)�
indent_log)�vcs�VersionControlz
url="([^"]+)"zcommitted-rev="(\d+)"z	URL: (.+)zRevision: (.+)z\s*revision="(\d+)"z<url>(.*)</url>cs�eZdZdZdZdZd"Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
�fdd�Zdd�Zdd�Zdd�Zdd�Zed d!��Z�ZS)#�
Subversion�svnz.svn�checkout�svn+ssh�svn+http�	svn+https�svn+svncCs�|jd�j|j�s td|��|jd|gdddid�}tj|�}|sftjdt	|��tj
d	|�d
S|jd�j�}t
j|�}|s�tjdt	|��tj
d	|�|d
fS||jd�fS)z/Returns (url, revision), where both are strings�/zBad directory: %s�infoFZLANG�C)�show_stdoutZ
extra_environz'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�AssertionError�run_command�_svn_url_re�search�logger�warningr�debug�group�strip�_svn_revision_re)�self�location�output�match�url�r(� /usr/lib/python3.6/subversion.py�get_infos,




zSubversion.get_infocCst|j�\}}t||�}|j|�}tjd||�t��6tjj|�rJt	|�|j
dg|||gdd�WdQRXdS)z@Export the svn repository at the url to the destination locationz!Exporting svn repository %s to %s�exportF)rN)�get_url_rev�get_rev_options�remove_auth_from_urlrrr�os�path�existsrr)r#r$r'�rev�rev_optionsr(r(r)r+;s

zSubversion.exportcCs|jdg|||g�dS)N�switch)r)r#�destr'r3r(r(r)r4JszSubversion.switchcCs|jdg||g�dS)N�update)r)r#r5r3r(r(r)r6MszSubversion.updatecCst|j�\}}t||�}|j|�}|r.d|}nd}|j||||�rptjd||t|��|jddg|||g�dS)Nz (to revision %s)�zChecking out %s%s to %srz-q)r,r-r.Zcheck_destinationrrrr)r#r5r'r2r3Zrev_displayr(r(r)�obtainPs



zSubversion.obtaincCsfx`|D]X}t|�j}|sqd|kr@dj|jd�dd��j�}n|}||jkr|jdd�dSqWdS)N�-r�#r���)r�egg_fragment�join�split�lower�key)r#�distZdependency_linksr'r<r@r(r(r)�get_locationas


zSubversion.get_locationc
Cs�d}x�tj|�D]�\}}}|j|kr2g|dd�<q|j|j�tjj||jd�}tjj|�s^q|j|�\}}||kr~|d}	n |s�|j|	�r�g|dd�<qt	||�}qW|S)zR
        Return the maximum revision for all files under a given location
        rN�entriesr)
r/�walkr�remover0r=r1�_get_svn_url_rev�
startswith�max)
r#r$Zrevision�base�dirs�filesZ
entries_fnZdirurlZlocalrevZbase_urlr(r(r)�get_revisionos"

zSubversion.get_revisioncs,tt|�j�\}}|jd�r$d|}||fS)Nzssh://zsvn+)�superr
r,rG)r#r'r2)�	__class__r(r)r,�s
zSubversion.get_url_revcCsV|}xBtjjtjj|d��sF|}tjj|�}||krtjd|�dSqW|j|�dS)Nzsetup.pyzGCould not find setup.py for directory %s (tried all parent directories)r)r/r0r1r=rrrrF)r#r$Z
orig_locationZ
last_locationr(r(r)�get_url�szSubversion.get_urlcCspddlm}tjj||jd�}tjj|�rHt|��}|j�}WdQRXnd}|j	d�sj|j	d�sj|j	d�r�t
ttj
|jd���}|dd=|dd	}d
d�|D�dg}n�|j	d�r�tj|�}|s�td
|��|jd�}dd�tj|�D�dg}n^y<|jdd|gdd�}	tj|	�jd�}dd�tj|	�D�}Wn |k
�rRdg}}YnX|�rdt|�}
nd}
||
fS)Nr)�InstallationErrorrCr7�8�9Z10z

�cSs,g|]$}t|�dkr|drt|d��qS)�	)�len�int)�.0�dr(r(r)�
<listcomp>�sz/Subversion._get_svn_url_rev.<locals>.<listcomp>z<?xmlzBadly formatted data: %rrcSsg|]}t|jd���qS)r)rVr )rW�mr(r(r)rY�srz--xmlF)rcSsg|]}t|jd���qS)r)rVr )rWrZr(r(r)rY�s)Zpip.exceptionsrPr/r0r=rr1�open�readrG�list�map�str�
splitlinesr>�_svn_xml_url_rer�
ValueErrorr �_svn_rev_re�finditerr�_svn_info_xml_url_re�_svn_info_xml_rev_rerH)r#r$rPZentries_path�f�datar'Zrevsr&Zxmlr2r(r(r)rF�s>








zSubversion._get_svn_url_revcCsB|j|�}|dkrdS|j�jdd�d}|j|�}d|||fS)Nr9rrzsvn+%s@%s#egg=%s)rOZegg_namer>rL)r#rAr$ZrepoZegg_project_namer2r(r(r)�get_src_requirement�s

zSubversion.get_src_requirementcCsdS)z&Always assume the versions don't matchFr()r#r5r3r(r(r)�
check_version�szSubversion.check_versioncCs>tj|�}|jjd�d}|j||j|j|jf}tj|�}|S)N�@rr;)	�urllib_parse�urlsplit�netlocr>�schemer0ZqueryZfragmentZ
urlunsplit)r'ZpurlZstripped_netlocZ
url_piecesZsurlr(r(r)r.�s


zSubversion.remove_auth_from_url)rr
rrr)�__name__�
__module__�__qualname__�namerZ	repo_nameZschemesr*r+r4r6r8rBrLr,rOrFrirj�staticmethodr.�
__classcell__r(r()rNr)r
s",	r
cCs�|rd|g}ng}tj|�}t|d�r6|j|j}}nL|d}d|krz|jd�d}d|krn|jdd�\}}q�|d}}nd	\}}|r�|d|g7}|r�|d|g7}|S)
Nz-r�usernamerrkr�:z
--usernamez
--password)NN)rlrm�hasattrrv�passwordr>)r'r2r3�rrvryrnZauthr(r(r)r-�s$


r-)Z
__future__rZloggingr/�reZpip._vendor.six.moves.urllibrrlZ	pip.indexrZ	pip.utilsrrZpip.utils.loggingrZpip.vcsrr	�compilerarcrr"rfreZ	getLoggerrprr
r-�registerr(r(r(r)�<module>s&






Y

?>