\e[c@sddlmZddlZddlZddlZddlZddlmZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZddlmZmZddlmZmZmZmZmZddlmZddlm Z m!Z!m"Z"dd l#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,dd l-m.Z.m/Z/e j0e1Z2e3a4e5ed rd Z6n9ej7j8d rdZ6nej7dkrdZ6ndZ6ej9dZ:e: r$dej;d Z:nde:Z<e6e:Z=ej#j>j?ddj?ddZ@ej9dZAeAoeAj8dreAj?ddZAndZBeBZA[BejCdejDejEBZFejCdejDejEBZGejCdZHejCdZId ZJd!ZKe jLd"kr*d#ZMn d$ZMd%eNfd&YZOeOZPd'eNfd(YZQd)ZReRZS[Re3d*ZTdS(+i(tunicode_literalsN(tmessage_from_filei(t __version__tDistlibException(t sysconfigtZipFiletfsdecodet text_typetfilter(tInstalledDistribution(tMetadatatMETADATA_FILENAMEtWHEEL_METADATA_FILENAME( t FileOperatort convert_patht CSVReadert CSVWritertCachetcached_propertytget_cache_baset read_exportsttempdir(tNormalizedVersiontUnsupportedVersionErrorupypy_version_infouppujavaujyucliuipucpupy_version_nodotu%s%siupyu-u_u.uSOABIucpython-cCs|dtg}tjdr+|jdntjdrJ|jdntjddkro|jdnd j|S( NucpuPy_DEBUGudu WITH_PYMALLOCumuPy_UNICODE_SIZEiuuu(t VER_SUFFIXRtget_config_vartappendtjoin(tparts((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyt _derive_abi;s uz (?P[^-]+) -(?P\d+[^-]*) (-(?P\d+[^-]*))? -(?P\w+\d+(\.\w+\d+)*) -(?P\w+) -(?P\w+(\.\w+)*) \.whl$ u7 (?P[^-]+) -(?P\d+[^-]*) (-(?P\d+[^-]*))?$ s \s*#![^\r\n]*s^(\s*#!("[^"]+"|\S+))\s+(.*)$s#!pythons #!pythonwu/cCs|S(N((to((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyt]scCs|jtjdS(Nu/(treplacetostsep(R((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyR_stMountercBs8eZdZdZdZddZdZRS(cCsi|_i|_dS(N(t impure_wheelstlibs(tself((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyt__init__cs cCs!||j|<|jj|dS(N(R$R%tupdate(R&tpathnamet extensions((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pytaddgs cCsI|jj|}x0|D](\}}||jkr|j|=qqWdS(N(R$tpopR%(R&R)R*tktv((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pytremovekscCs"||jkr|}nd}|S(N(R%tNone(R&tfullnametpathtresult((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyt find_moduleqs cCs|tjkrtj|}nx||jkrAtd|ntj||j|}||_|jdd}t|dkr|d|_ n|S(Nuunable to find extension for %su.ii( tsystmodulesR%t ImportErrortimpt load_dynamict __loader__trsplittlent __package__(R&R1R3R((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyt load_modulexs N(t__name__t __module__R'R+R/R0R4R>(((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyR#bs     tWheelcBseZdZdZdZdeedZedZ edZ edZ e dZ dZe d Zd Zdd Zd Zd ZdZdddZdZdZdZdZdZedZdZdZddZRS(u@ Class to build and install from Wheel files (PEP 427). iusha256cCs||_||_d|_tg|_dg|_dg|_tj|_ |dkr{d|_ d|_ |j |_nEtj|}|r|jd}|d|_ |djdd |_ |d |_|j |_ntjj|\}}tj|}|s!td |n|r?tjj||_ n||_|jd}|d|_ |d|_ |d |_|d jd |_|djd |_|djd |_dS(uB Initialise an instance using a (valid) filename. uunoneuanyudummyu0.1unmuvnu_u-ubnuInvalid name or filename: %rupyu.ubiuarN(tsignt should_verifytbuildvertPYVERtpyvertabitarchR!tgetcwdtdirnameR0tnametversiontfilenamet _filenametNAME_VERSION_REtmatcht groupdictR R2tsplitt FILENAME_RERtabspath(R&RMRBtverifytmtinfoRJ((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyR'sB                cCs|jrd|j}nd}dj|j}dj|j}dj|j}|jjdd}d|j|||||fS(uJ Build and return a filename from the various components. u-uu.u_u%s-%s%s-%s-%s-%s.whl(RDRRFRGRHRLR RK(R&RDRFRGRHRL((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyRMs cCs+tjj|j|j}tjj|S(N(R!R2RRJRMtisfile(R&R2((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pytexistssccsNxG|jD]<}x3|jD](}x|jD]}|||fVq*WqWq WdS(N(RFRGRH(R&RFRGRH((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyttagssc Csztjj|j|j}d|j|jf}d|}tjd}t |d}|j |}|dj dd}t g|D]}t |^q} | d krttdg} n ttg} d} xu| D]m} yStj|| } |j| ,}||}td |} | r/PnWdQXWqtk rIqXqW| sptd d j| nWdQX| S( Nu%s-%su %s.dist-infouutf-8uru Wheel-Versionu.iuMETADATAtfileobju8Invalid wheel, because metadata is missing: looked in %su, (ii(R!R2RRJRMRKRLtcodecst getreaderRtget_wheel_metadataRRttupletintR R R0t posixpathtopenR tKeyErrort ValueError(R&R)tname_vertinfo_dirtwrappertzftwheel_metadatatwvtit file_versiontfnsR3tfntmetadata_filenametbftwf((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pytmetadatas4 %     cCsud|j|jf}d|}tj|d}|j|(}tjd|}t|}WdQXt|S(Nu%s-%su %s.dist-infouWHEELuutf-8( RKRLRaRRbR\R]Rtdict(R&RhReRfRoRpRqtmessage((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyR^s cCsFtjj|j|j}t|d}|j|}WdQX|S(Nur(R!R2RRJRMRR^(R&R)RhR3((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyRWsc Cstj|}|r|j}|| ||}}d|jkrQt}nt}tj|}|rd|jd}nd}||}||}ns|jd}|jd} |dks|| krd} n&|||d!d krd } nd} t| |}|S( Ntpythonwt its s iis ( t SHEBANG_RERPtendtlowertSHEBANG_PYTHONWtSHEBANG_PYTHONtSHEBANG_DETAIL_REtgroupstfind( R&tdataRVRytshebangtdata_after_shebangtshebang_pythontargstcrtlftterm((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pytprocess_shebangs,      cCs|dkr|j}nytt|}Wn!tk rNtd|nX||j}tj|j dj d}||fS(NuUnsupported hash algorithm: %rt=uascii( R0t hash_kindtgetattrthashlibtAttributeErrorRtdigesttbase64turlsafe_b64encodetrstriptdecode(R&RRthasherR3((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pytget_hash"s   !cCs~t|}ttjj||}|j|ddf|jt|%}x|D]}|j|q]WWdQXdS(Nu( tlisttto_posixR!R2trelpathRtsortRtwriterow(R&trecordst record_pathtbasetptwritertrow((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyt write_record-s   cCsg}|\}}tt|j}xs|D]k\}} t| d} | j} WdQXd|j| } tjj| } |j || | fq+Wtjj |d} |j || |t tjj |d}|j || fdS(Nurbu%s=%suRECORD( RRRRbtreadRR!R2tgetsizeRRRR(R&RWtlibdirt archive_pathsRtdistinfoRfRtapRtfRRtsize((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyt write_records6s c Cs\t|dtjA}x7|D]/\}}tjd|||j||qWWdQXdS(NuwuWrote %s to %s in wheel(Rtzipfilet ZIP_DEFLATEDtloggertdebugtwrite(R&R)RRhRR((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyt build_zipFsc! s|dkri}nttfdd$d}|dkrgd}tg}tg}tg}n!d}tg}dg}dg}|jd ||_|jd ||_ |jd ||_ |} d |j |j f} d | } d| } g} xKd%D]C}|kr qn|}t jj|rx t j|D]\}}}x|D]}tt jj||}t jj||}tt jj| ||}| j||f|dkrb|jd rbt|d}|j}WdQX|j|}t|d}|j|WdQXqbqbWqLWqqW| }d}xt j|D]\}}}||krxUt|D]G\}}t|}|jdrt jj||}||=PqqW|stdnxl|D]d}t|jd&rqnt jj||}tt jj||}| j||fqWqkWt j|}xf|D]^}|d'kr|tt jj||}tt jj| |}| j||fq|q|Wd|p|jdtd |g}x4|j D])\}}}|jd!|||fq Wt jj|d}t|d"}|jd#j|WdQXtt jj| d}| j||f|j!|| f| | t jj|j"|j#} |j$| | | S((u Build a wheel from files in specified paths, and use any specified tags when determining the name of the wheel. cs |kS(N((R(tpaths(s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyRTsupurelibuplatlibiufalseutrueunoneuanyupyveruabiuarchu%s-%su%s.datau %s.dist-infoudatauheadersuscriptsu.exeurbNuwbu .dist-infou(.dist-info directory expected, not foundu.pycu.pyouRECORDu INSTALLERuSHAREDuWHEELuWheel-Version: %d.%duGenerator: distlib %suRoot-Is-Purelib: %su Tag: %s-%s-%suwu (upurelibuplatlib(udatauheadersuscripts(u.pycu.pyo(uRECORDu INSTALLERuSHAREDuWHEEL(%R0RRtIMPVERtABItARCHREtgetRFRGRHRKRLR!R2tisdirtwalkRRRRRtendswithRbRRRt enumeratetAssertionErrortlistdirt wheel_versionRRZRRJRMR(!R&RRZRtlibkeytis_puret default_pyvert default_abit default_archRRetdata_dirRfRtkeyR2troottdirstfilesRnRtrpRRRRRktdnRiRFRGRHR)((Rs8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pytbuildLs  "              %      cCKs |j}|jd}|jdt}tjj|j|j}d|j|j f}d|} d|} t j| t } t j| d} t j| d} t j d}t|d }|j| }||}t|}Wd QX|d jd d }tg|D]}t|^q}||jkrY|rY||j|n|ddkrv|d}n |d}i}|j| D}td|,}x"|D]}|d}||||jd.}6|6r|6jd/}6nWd QXWnt1k rt+j2d0nX|6r|6jd1i}>|6jd2i}?|>s|?r|jdd}@tjj?|@st@d3n|@|_xF|>jAD]8\}:}<d4|:|<f}A|j4|A}4|j5|4q(W|?ritd(6}BxL|?jAD];\}:}<d4|:|<f}A|j4|A|B}4|j5|4qWqqntjj|| }tB|}5tC|}|d=|d=||d5<|5jD||}|r9 |!j/|n|5jE|!|d6||5SWn+t1k r t+jFd7|jGnXWd tHjI|"XWd QXd S(9u Install a wheel to the specified paths. If kwarg ``warner`` is specified, it should be a callable, which will be called with two tuples indicating the wheel version of this software and the wheel version in the file, if there is a discrepancy in the versions. This can be used to issue any warnings to raise any exceptions. If kwarg ``lib_only`` is True, only the purelib/platlib files are installed, and the headers, scripts, data and dist-info metadata are not written. The return value is a :class:`InstalledDistribution` instance unless ``options.lib_only`` is True, in which case the return value is ``None``. uwarnerulib_onlyu%s-%su%s.datau %s.dist-infouWHEELuRECORDuutf-8urNu Wheel-Versionu.iuRoot-Is-Purelibutrueupurelibuplatlibtstreamiuuscriptstdry_runu /RECORD.jwsiusize mismatch for %su=udigest mismatch for %sulib_only: skipping %su.exeu/urbudigest mismatch on write for %su.pyuByte-compilation failedtexc_infoulib_only: returning Noneu1.0uentry_points.txtuconsoleuguiu %s_scriptsuwrap_%su%s:%su %suAUnable to read legacy script metadata, so cannot generate scriptsu extensionsupython.commandsu8Unable to read JSON metadata, so cannot generate scriptsu wrap_consoleuwrap_guiuValid script path not specifiedu%s = %sulibuprefixuinstallation failed.(uconsoleugui(JRRtFalseR!R2RRJRMRKRLRaR R\R]RRbRRRR_R`RRR tTruetrecordR5tdont_write_bytecodettempfiletmkdtempt source_dirR0t target_dirtinfolistt isinstanceRRRtstrt file_sizeRRRt startswithRRRt copy_streamRt byte_compilet Exceptiontwarningtbasenametmaketset_executable_modetextendRWRtvaluestprefixtsuffixtflagstjsontloadRRdtitemsR Rstwrite_shared_locationstwrite_installed_filest exceptiontrollbacktshutiltrmtree(CR&RtmakertkwargsRtwarnertlib_onlyR)ReRRft metadata_nametwheel_metadata_namet record_nameRgRhtbwfRqRtRjRkRlRRRptreaderRRtdata_pfxtinfo_pfxt script_pfxtfileoptbctoutfilestworkdirtzinfotarcnamet u_arcnametkindtvalueRt_Rt is_scripttwhereRtoutfilet newdigesttpycRntworknameRt filenamestdisttcommandsteptepdataRR-tdR.tstconsole_scriptst gui_scriptst script_dirtscripttoptions((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pytinstallsD    %            #   "                            cCsGtdkrCtjjttdtjd }t |antS(Nu dylib-cachei( tcacheR0R!R2RRRR5RLR(R&R((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyt_get_dylib_caches  c Cstjj|j|j}d|j|jf}d|}tj|d}tj d}g}t |dw}y\|j |G}||} t j | } |j} | j|} tjj| j| } tjj| stj| nx| jD]\}}tjj| t|}tjj|sHt}nQtj|j}tjj|}|j|}tj|j}||k}|r|j|| n|j||fqWWdQXWntk rnXWdQX|S(Nu%s-%su %s.dist-infou EXTENSIONSuutf-8ur( R!R2RRJRMRKRLRaR\R]RRbRRRt prefix_to_dirRRtmakedirsRRRYRtstattst_mtimetdatetimet fromtimestamptgetinfot date_timetextractRRc(R&R)ReRfRRgR3RhRpRqR*RRt cache_baseRKRtdestR!t file_timeRWt wheel_time((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyt_get_extensionss>     !  cCs t|S(uM Determine if a wheel is compatible with the running system. (t is_compatible(R&((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyR'scCstS(uP Determine if a wheel is asserted as mountable by its metadata. (R(R&((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyt is_mountablescCs tjjtjj|j|j}|jsLd|}t|n|jsqd|}t|n|t jkrt j d|ns|rt jj |nt jj d||j}|rtt jkrt jj tntj||ndS(Nu)Wheel %s not compatible with this Python.u$Wheel %s is marked as not mountable.u%s already in pathi(R!R2RTRRJRMR'RR(R5RRRtinsertR&t_hookt meta_pathR+(R&RR)tmsgR*((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pytmounts"'     cCstjjtjj|j|j}|tjkrItjd|n]tjj ||t j krxt j |nt j st tj krtj j t qndS(Nu%s not in path( R!R2RTRRJRMR5RRR/R*R$R+(R&R)((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pytunmounts' cCstjj|j|j}d|j|jf}d|}d|}tj|t}tj|d}tj|d}t j d}t |d } | j |} || } t | } WdQX| djd d } tg| D]}t|^q}i}| j |D}td |,}x"|D]}|d }|||Lsu0Cannot update non-compliant (PEP-440) version %rR2tlegacyuVersion updated from %r to %r(R0RRRRR`RRRRR RLRR R( RLR2tupdatedR.RkRRtmdR2((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pytupdate_versionAs(   0 !     u%s-%su %s.dist-infouRECORDuruutf-8u..uinvalid entry in wheel: %rNRu.whlRu wheel-update-tdiruNot a directory: %r(R!R2RRJRMRKRLRaRRRRRRRR!RR0RtmkstemptcloseRRRRRRtcopyfile(R&tmodifiertdest_dirRR0R5R)ReRfRRRhR/RRRR2toriginal_versionRtmodifiedtcurrent_versiontfdtnewpathRRRW((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyR(&sX           (iiN(R?R@t__doc__RRR0RR'tpropertyRMRYRZRRrR^RWRRRRRRRRR&R'R(R-R.RUR((((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyRAs2)    h "    6cCstg}td}xGttjddddD](}|jdj|t|gq1Wg}xLtjD]>\}}}|j drp|j|j dddqpqpW|j t dkr|j dt n|jdg}tg}tjd kr=tjd t}|r=|j\} }}} t|}| g} | dkrg| jd n| dkr| jdn| dkr| jdn| dkr| jdn| dkr| jdnx`|dkr6x@| D]8} d| ||| f} | tkr|j| qqW|d8}qWq=nxH|D]@}x7|D]/} |jdjt|df|| fqQWqDWxwt|D]i\}}|jdjt|fddf|dkr|jdjt|dfddfqqWxwt|D]i\}}|jdjd|fddf|dkr|jdjd|dfddfqqWt|S(uG Return (pyver, abi, arch) tuples compatible with this Python. iiiuu.abiu.iunoneudarwinu(\w+)_(\d+)_(\d+)_(\w+)$ui386uppcufatux86_64ufat3uppc64ufat64uintelu universalu %s_%s_%s_%suanyupy(ui386uppc(ui386uppcux86_64(uppc64ux86_64(ui386ux86_64(ui386ux86_64uinteluppcuppc64(RtrangeR5t version_infoRRRR8t get_suffixesRRRRRR)RtplatformtreRPR~R`t IMP_PREFIXRtset(tversionstmajortminortabisRRR3tarchesRVRKRHtmatchesRPRRGRkRL((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pytcompatible_tagss`  $&$               1% 0% 0cCst|tst|}nt}|dkr9t}nxN|D]F\}}}||jkr@||jkr@||jkr@t}Pq@q@W|S(N( RRARR0tCOMPATIBLE_TAGSRFRGRHR(twheelRZR3tverRGRH((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyR's  -(Ut __future__RRR\Rtdistutils.utilt distutilstemailRRR8RtloggingR!RaRGRR5RRRwRRtcompatRRRRRtdatabaseR RrR R R tutilR RRRRRRRRRLRRt getLoggerR?RR0RthasattrRHRFRRRRDRERt get_platformR RRRtcompilet IGNORECASEtVERBOSERSRORxR}R|R{R"RtobjectR#R*RARPRQR'(((s8/tmp/pip-install-0xiv62/pip/pip/_vendor/distlib/wheel.pyts               (@     '   #  >