Your IP : 18.223.209.114


Current Path : /opt/alt/python33/lib/python3.3/site-packages/setuptools/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib/python3.3/site-packages/setuptools/__pycache__/svn_utils.cpython-33.pyc

�
�Re�Ec@siddlZddlZddlZddlmZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZyddlZWn!ek
r�ddljZYnXddlmZmZeedddd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Ze�Z ddd�Z!dd�Z"ddd�Z#dd�Z$dd�Z%Gdd�de&�Z'Gdd �d e'�Z(Gd!d"�d"e(�Z)Gd#d$�d$e'�Z*dd%d&�Z+Gd'd(�d(e&�Z,Gd)d*�d*e,�Z-Gd+d,�d,e,�Z.e/d-krex(e+ej0d.�D]Z1e2e1�qNWndS(/iN(ulog(uunicode(uunescape(uPopenuPIPEcCspy;t|d|d|dtjdk�}|j�|}Wntk
rSdSYnXt||�}|j|fS(Nustdoutustderrushelluwin32iu(iu(u_PopenusysuplatformucommunicateuOSErrorudecode_as_stringu
returncode(uargsustdoutustderruencodingustreamuprocudata((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu_run_commands
	u_run_commandcCs0|jd�d}djdd�|jD��S(NuscheduleiucSs+g|]!}|j|jkr|j�qS((unodeTypeu	TEXT_NODEu	nodeValue(u.0ut((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu
<listcomp>2s	u'_get_entry_schedule.<locals>.<listcomp>(ugetElementsByTagNameujoinu
childNodes(uentryuschedule((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu_get_entry_schedule0su_get_entry_schedulecCs0|jd�d}djdd�|jD��S(NupropertyiucSs+g|]!}|j|jkr|j�qS((unodeTypeu	TEXT_NODEu	nodeValue(u.0ut((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu
<listcomp>9s	u(_get_target_property.<locals>.<listcomp>(ugetElementsByTagNameujoinu
childNodes(utargetu
property_text((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu_get_target_property7su_get_target_propertycCs+tjdkr!|jd�}n|}|S(Niiuutf-8(ii(usysuversion_infouencode(udecoded_strudata((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu
_get_xml_data>su
_get_xml_datacGs6|s|dkr#tjj|�Stjj||�S(Nu.(uosupathujoin(uprefixusuffix((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyujoinpathGsujoinpathcCs�yLtj�}|s"|dkr5tj�d}n|rKtj|�nWn!tjtfk
rod}YnXtj	dk}|s�ddg|S|j
d�r�|r�dS|SdS(NuUS-ASCIIiudarwinuutf-8umac-(ulocaleugetpreferredencodingugetdefaultlocaleucodecsulookupuErroruLookupErroruNoneusysuplatformu
startswith(uencodinguis_osx((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyudetermine_console_encodingLsudetermine_console_encodingcCsL|dkrt}nt|t�s6|j|�}ntjd|�}|S(u�
    Decode the console or file output explicitly using getpreferredencoding.
    The text paraemeter should be a encoded string, if not no decode occurs
    If no encoding is given, getpreferredencoding is used.  If encoding is
    specified, that is used instead.  This would be needed for SVN --xml
    output.  Unicode is explicitly put in composed NFC form.

    --xml should be UTF-8 (SVN Issue 2938) the discussion on the Subversion
    DEV List from 2007 seems to indicate the same.
    uNFCN(uNoneu_console_encodingu
isinstanceuunicodeudecodeuunicodedatau	normalize(utextuencoding((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyudecode_as_stringis
	udecode_as_stringcCs�tjjjt|��}t�}x||D]t\}}|dkr+|jdkr+|j|�t|�j	d�s�|j
|jd�|jd�f�q�q+q+W|dd�S(u+Parse the entries from a recursive info xmlu
START_ELEMENTuentryudeleteupathukindiN(uxmludomupulldomuparseStringu
_get_xml_dataulistunodeNameu
expandNodeu_get_entry_scheduleu
startswithuappendugetAttribute(udecoded_strudocuentriesueventunode((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuparse_dir_entries�s	
uparse_dir_entriesuc	Cstjj|�}tjj|�}tjjjt|��}t	�}x�|D]�\}}|dkrO|j
dkrO|j|�tjj|jd��}tjj|�j
|�r�|t|�dd�}nt|�}x-t|�D]}|jt||��q�WqOqOW|S(u!Parse a propget svn:externals xmlu
START_ELEMENTutargetupathiN(uosupathunormpathunormcaseuxmludomupulldomuparseStringu
_get_xml_dataulistunodeNameu
expandNodeugetAttributeu
startswithulenu_get_target_propertyuparse_external_propuappendujoinpath(	udecoded_struprefixudocu	externalsueventunodeupathudatauexternal((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuparse_externals_xml�s	
!uparse_externals_xmlcCs�g}x�|j�D]�}|j�}|s1qntjdkrR|jd�}ntj|�}tjd	kr�dd�|D�}ntj|d
�dr�|d}n
|d}t	|dd�}|j
tjj
|��qW|S(u�
    Parse the value of a retrieved svn:externals entry.

    possible token setups (with quotng and backscaping in laters versions)
        URL[@#] EXT_FOLDERNAME
        [-r#] URL EXT_FOLDERNAME
        EXT_FOLDERNAME [-r#] URL
    iiuutf-8cSsg|]}|jd��qS(uutf-8(udecode(u.0ux((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu
<listcomp>�s	u'parse_external_prop.<locals>.<listcomp>iuencoding(ii(iii����i����(u
splitlinesulstripusysuversion_infouencodeushlexusplituurlparseuurlsplitudecode_as_stringuappenduosupathunormpath(ulinesu	externalsulineuexternal((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuparse_external_prop�s 	

uparse_external_propc	
Cs�d}t|d�}d}z�x�t|jd�D]}|j�}t|�dkr1|\}}|jt|��}|dkr�||kr�d}q�|dkr�|r�Pq�q1q1WWd|j	�X|S(NurtuiuKuVFT(
uFalseuopenuiterureadlineusplitulenureaduintuTrueuclose(	ufilenameukeyufoundufudataulineupartsukindulength((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuparse_prop_file�s	uparse_prop_filecBs�|EeZdZdZedd��Zejdej�Z	e
ddd��Zddd	�Zd
d�Z
edd
��Zedd��Zdd�Zdd�Zddd�Zdd�Zdd�ZdS(uSvnInfou�
    Generic svn_info object.  No has little knowledge of how to extract
    information.  Use cls.load to instatiate according svn version.

    Paths are not filesystem encoded.
    cCs?tdddg�\}}|dkr7|r7|j�SdSdS(Nusvnu	--versionu--quietiu(u_run_commandustrip(ucodeudata((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuget_svn_version�s
uSvnInfo.get_svn_versionu!(?:([\-0-9]+):)?(\d+)([a-z]*)\s*$uc	Cshtjj|�}tdd|g�\}}tjj|d�}tjjtjj|d��p�tjjtjj|d��p�tjjtjj|d��}t|j�jd��}y'tdd	�|dd
�D��}Wnt	k
rt�}YnX|st
|�S|s.|s.|dkrHtjd
t
�t|�S|dkr^t|�St|�S(Nusvnuinfou.svnuentriesu	dir-propsu
dir-prop-baseu.css|]}t|�VqdS(N(uint(u.0ux((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu	<genexpr>suSvnInfo.load.<locals>.<genexpr>iiiu?No SVN 1.3+ command found: falling back on pre 1.7 .svn parsingi(ii(ii(uosupathunormpathu_run_commandujoinuisfileutupleuget_svn_versionusplitu
ValueErroruSvnInfouwarningsuwarnuDeprecationWarninguSvnFileInfou	Svn13Infou	Svn15Info(	uclsudirnameunormdirucodeudatausvn_diruhas_svnusvn_versionubase_svn_version((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuload�s(!!!'

	

uSvnInfo.loadcCs||_d|_d|_dS(N(upathuNoneu_entriesu
_externals(uselfupath((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu__init__s		uSvnInfo.__init__cCshtdd|jg�\}}|r5tjd�dS|jj|�}|r`t|jd��SdSdS(u<Retrieve the directory revision informatino using svnversionu
svnversionu-cusvnversion failediiN(u_run_commandupathuloguwarnurevision_reumatchuintugroup(uselfucodeudatauparsed((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuget_revisions
uSvnInfo.get_revisioncCs(|jdkr!|j�|_n|jS(N(u_entriesuNoneuget_entries(uself((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuentries(suSvnInfo.entriescCs(|jdkr!|j�|_n|jS(N(u
_externalsuNoneu
get_externals(uself((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu	externals.suSvnInfo.externalsccsx|jD]}|Vq
WdS(uR
        Iterate over the svn:external references in the repository path.
        N(u	externals(uselfuitem((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuiter_externals4suSvnInfo.iter_externalsccs8x1|jD]&\}}|j�dkr
|Vq
q
WdS(uR
        Iterate over the non-deleted file entries in the repository path
        ufileN(uentriesulower(uselfuitemukind((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu
iter_files;suSvnInfo.iter_filesccsI|r|jVnx1|jD]&\}}|j�dkr|VqqWdS(uR
        Iterate over the non-deleted file entries in the repository path
        udirN(upathuentriesulower(uselfuinclude_rootuitemukind((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu	iter_dirsCs
uSvnInfo.iter_dirscCsgS(N((uself((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuget_entriesMsuSvnInfo.get_entriescCsgS(N((uself((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu
get_externalsPsuSvnInfo.get_externalsNT(u__name__u
__module__u__qualname__u__doc__ustaticmethoduget_svn_versionureucompileuIurevision_reuclassmethoduloadu__init__uget_revisionupropertyuentriesu	externalsuiter_externalsu
iter_filesuTrueu	iter_dirsuget_entriesu
get_externals(u
__locals__((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuSvnInfo�s


uSvnInfocBs,|EeZdZdd�Zdd�ZdS(u	Svn13InfocCsKtdddd|jgdd�\}}|rAtjd�gSt|�S(Nusvnuinfou-Ru--xmluencodinguutf-8usvn info failed(u_run_commandupathulogudebuguparse_dir_entries(uselfucodeudata((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuget_entriesUs
uSvn13Info.get_entriescCs�dddg}g}x�|j�D]�}t||gdd�\}}|dkrdtjd�gSxKt|�D]=}|r�tjj||�}n|jtjj	|��qqWq"W|S(Nusvnupropgetu
svn:externalsuencodinguutf-8iusvn propget failed(
u	iter_dirsu_run_commanduloguwarnuparse_external_propuosupathujoinuappendunormpath(uselfucmduresultufolderucodeulinesuexternal((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu
get_externals_s
!uSvn13Info.get_externalsN(u__name__u
__module__u__qualname__uget_entriesu
get_externals(u
__locals__((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu	Svn13InfoTs
u	Svn13InfocBs |EeZdZdd�ZdS(u	Svn15InfocCsiddd|jddg}t|dd�\}}|rJtjd�gSt|d	tjj|j��S(
Nusvnupropgetu
svn:externalsu-Ru--xmluencodinguutf-8usvn propget faileduprefix(upathu_run_commandulogudebuguparse_externals_xmluosuabspath(uselfucmducodeulines((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu
get_externalsss
uSvn15Info.get_externalsN(u__name__u
__module__u__qualname__u
get_externals(u
__locals__((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu	Svn15Inforsu	Svn15Infocse|EeZdZd�fdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z�S(uSvnFileInfoucs,tt|�j|�d|_d|_dS(N(usuperuSvnFileInfou__init__uNoneu_directoriesu	_revision(uselfupath(u	__class__(u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu__init__~s	uSvnFileInfo.__init__ccs�t|dd�}tjj|�r�tj|�}|d|j�fVx�|j�D]x}t	|�}t||�}tjj|�r�|ddfVqTtjj|�rTx|j
|�D]}|Vq�WqTqTWndS(Nu.svnuentriesFT(ujoinpathuosupathuisfileuSVNEntriesFileuloaduFalseuparse_revisionuget_undeleted_recordsudecode_as_stringuTrueuNoneuisdiru	_walk_svn(uselfubaseu
entry_fileuentriesupathuitem((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu	_walk_svn�suSvnFileInfo._walk_svncCs�t�}d}xa|j|j�D]M\}}}|rM|j|df�q"|j|df�t||�}q"W||_||_dS(Niufileudir(ulistu	_walk_svnupathuappendumaxu_entriesu	_revision(uselfuentriesurevupathuisfileudir_rev((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu_build_entries�s	"	uSvnFileInfo._build_entriescCs#|jdkr|j�n|jS(N(u_entriesuNoneu_build_entries(uself((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuget_entries�s
uSvnFileInfo.get_entriescCs#|jdkr|j�n|jS(N(u	_revisionuNoneu_build_entries(uself((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuget_revision�s
uSvnFileInfo.get_revisioncCs�ddgddgg}g}x�|j�D]�}d}x8|D]0}t||�}tjj|�r>|}q>q>W|dk	r+t|d�}t|dd�}|jt	|��q+q+W|S(Nu.svnu
dir-prop-baseu	dir-propsu
svn:externalsuencodinguutf-8(
u	iter_dirsuNoneujoinpathuosupathuisfileuparse_prop_fileudecode_as_stringuextenduparse_external_prop(uselfu
prop_filesu	externalsudirnameu	prop_fileu	rel_partsufilenameuext_prop((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu
get_externals�s	

uSvnFileInfo.get_externals(	u__name__u
__module__u__qualname__u__init__u	_walk_svnu_build_entriesuget_entriesuget_revisionu
get_externals(u
__locals__((u	__class__u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuSvnFileInfo|suSvnFileInfoccsqtj|�}x|j�D]}|VqWx?|j�D]1}tj|�}x|j�D]}|VqZWq8WdS(N(uSvnInfouloadu
iter_filesuiter_externals(udirnameuinfoupathusub_infousub_path((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu
svn_finder�s	u
svn_findercBsP|EeZdZdd�Zedd��Zedd��Zdd�Zd	S(
uSVNEntriesFilecCs
||_dS(N(udata(uselfudata((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu__init__�suSVNEntriesFile.__init__c
CsItjj|dd�}t|�}ztj|�}Wd|j�X|S(Nu.svnuentries(uosupathujoinuopenuSVNEntriesFileureaduclose(uclass_ubaseufilenameufuresult((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuload�suSVNEntriesFile.loadcCs5|j�}|jd�}ttg|}||�S(Nu<?xml(ureadu
startswithuSVNEntriesFileTextuSVNEntriesFileXML(uclass_ufileobjudatauis_xml((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuread�suSVNEntriesFile.readcCs|j�dg}t|�S(Ni(uparse_revision_numbersumax(uselfuall_revs((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuparse_revision�suSVNEntriesFile.parse_revisionN(u__name__u
__module__u__qualname__u__init__uclassmethoduloadureaduparse_revision(u
__locals__((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuSVNEntriesFile�s
uSVNEntriesFilecBsw|EeZdZidd6dd6dd6Zdd�Zd	d
�Zdd�Zd
d�Zdd�Zdd�Z	dS(uSVNEntriesFileTextiu1.4.xi	u1.5.xi
u1.6.xcCs|jS(N(usections(uself((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu__get_cached_sections�su(SVNEntriesFileText.__get_cached_sectionscCs�d}|jj|�}dd�ttj|�D�}yEt|djd��}||jj�kr{t	j
d|�nWntk
r�dSYnX||_|j
|_|jS(Nu
cSsg|]}|�qS(((u.0ux((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu
<listcomp>�s	u3SVNEntriesFileText.get_sections.<locals>.<listcomp>iuUnknown subversion verson %d(udatausplitumapustru
splitlinesuintupopuknown_svn_versionsuvaluesuloguwarnu
ValueErrorusectionsu(_SVNEntriesFileText__get_cached_sectionsuget_sections(uselfuSECTION_DIVIDERusectionsusvn_version((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuget_sections�s
		uSVNEntriesFileText.get_sectionscCst|j��S(N(ubooluget_sections(uself((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuis_valid�suSVNEntriesFileText.is_validcCs|j�ddS(Nii(uget_sections(uself((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuget_urlsuSVNEntriesFileText.get_urlcs)d��fdd�|j�D�}|S(Ni	cs<g|]2}t|��kr|�rt|���qS((ulenuint(u.0usection(urevision_line_number(u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu
<listcomp>s	u=SVNEntriesFileText.parse_revision_numbers.<locals>.<listcomp>(uget_sections(uselfurev_numbers((urevision_line_numberu-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuparse_revision_numberssu)SVNEntriesFileText.parse_revision_numberscs/dd���fdd�|j�D�}|S(NcSs0|o/|do/t|�dkp/|ddkS(Niiiudelete(ulen(us((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu<lambda>su:SVNEntriesFileText.get_undeleted_records.<locals>.<lambda>cs&g|]}�|�r|d�qS(i((u.0usection(u	undeleted(u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu
<listcomp>s	u<SVNEntriesFileText.get_undeleted_records.<locals>.<listcomp>(uget_sections(uselfuresult((u	undeletedu-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuget_undeleted_recordssu(SVNEntriesFileText.get_undeleted_recordsN(
u__name__u
__module__u__qualname__uknown_svn_versionsu(_SVNEntriesFileText__get_cached_sectionsuget_sectionsuis_validuget_urluparse_revision_numbersuget_undeleted_records(u
__locals__((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuSVNEntriesFileText�s

uSVNEntriesFileTextcBsD|EeZdZdd�Zdd�Zdd�Zdd�Zd	S(
uSVNEntriesFileXMLcCsdS(NT(uTrue(uself((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuis_validsuSVNEntriesFileXML.is_validcCs(tjd�}|j|j�jd�S(uGet repository URLu
url="([^"]+)"i(ureucompileusearchudataugroup(uselfuurlre((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuget_urlsuSVNEntriesFileXML.get_urlcCs,tjd�}dd�|j|j�D�S(Nucommitted-rev="(\d+)"cSs%g|]}t|jd���qS(i(uintugroup(u.0um((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu
<listcomp>$s	u<SVNEntriesFileXML.parse_revision_numbers.<locals>.<listcomp>(ureucompileufinditerudata(uselfurevre((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuparse_revision_numbers!s	u(SVNEntriesFileXML.parse_revision_numberscCs8tjdtj�}dd�|j|j�D�}|S(Nu%name="([^"]+)"(?![^>]+deleted="true")cSs%g|]}t|jd���qS(i(uunescapeugroup(u.0umatch((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu
<listcomp>,s	u;SVNEntriesFileXML.get_undeleted_records.<locals>.<listcomp>(ureucompileuIufinditerudata(uselfuentries_patternuresults((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuget_undeleted_records(s	u'SVNEntriesFileXML.get_undeleted_recordsN(u__name__u
__module__u__qualname__uis_validuget_urluparse_revision_numbersuget_undeleted_records(u
__locals__((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyuSVNEntriesFileXMLsuSVNEntriesFileXMLu__main__i(3uosureusysu	distutilsuloguxml.dom.pulldomuxmlushlexulocaleucodecsuunicodedatauwarningsusetuptools.compatuunicodeuxml.sax.saxutilsuunescapeuurlparseuImportErroruurllib.parseuparseu
subprocessuPopenu_PopenuPIPEu_PIPEuNoneu_run_commandu_get_entry_scheduleu_get_target_propertyu
_get_xml_dataujoinpathudetermine_console_encodingu_console_encodingudecode_as_stringuparse_dir_entriesuparse_externals_xmluparse_external_propuparse_prop_fileuobjectuSvnInfou	Svn13Infou	Svn15InfouSvnFileInfou
svn_finderuSVNEntriesFileuSVNEntriesFileTextuSVNEntriesFileXMLu__name__uargvunameuprint(((u-/tmp/pip-k8wh6o-build/setuptools/svn_utils.pyu<module>sN
		$t
B
3

?>