9Tc@@s>dZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl mZddlmZddlmZddlmZmZddlmZdd lmZdd lmZmZmZmZmZdd l m!Z!dd l"m#Z#dd l$m%Z%ddl&m'Z'dZ(ddfZ)ej*e+Z,ddd>dZ-dZ.dZ/e j0de j1Z2dZ3dZ4e5e6e6e7e6e5dZ8dZ9e9dZ:dZ;dZ<de=fdYZ>d e=fd!YZ?dS("sH Support for installing and building the "wheel" binary package format. i(tabsolute_importN(turlsafe_b64encode(tParser(tStringIO(tInvalidWheelFilenametUnsupportedWheel(tdistutils_scheme(t pep425tags(tcall_subprocesstnormalize_pathtmake_path_relativetcaptured_stdouttremove_tracebacks(t indent_log(t ScriptMaker(t pkg_resources(t configparsers.whlitsha256icC@stj|}d}t|dO}|j|}x6|rn|t|7}|j||j|}q9WWdQXdt|jjdj d}||fS(s6Return (hash, length) for path using hashlib.new(algo)itrbNssha256=tlatin1t=( thashlibtnewtopentreadtlentupdateRtdigesttdecodetrstrip(tpathtalgot blocksizethtlengthtftblockR((s//usr/lib/python2.7/vendor-packages/pip/wheel.pytrehash)s  cC@sItjddkr"i}d}nidd6}d}t||||S(Niitbttnewline(tsyst version_infoR(tnametmodetnltbin((s//usr/lib/python2.7/vendor-packages/pip/wheel.pyt open_for_csv9s   cC@stjj|rt|dd}|j}|jdsCtStjj tj }d|tj j d}|j }WdQXt|d!}|j ||j |WdQXtSdS(sLReplace #!python with #!/path/to/python Return True if file was changed.Rs#!pythons#!tasciiNtwb(tosRtisfileRtreadlinet startswithtFalseR)t executabletencodetgetfilesystemencodingtlinesepRtwritetTrue(Rtscriptt firstlinetexenametrest((s//usr/lib/python2.7/vendor-packages/pip/wheel.pyt fix_scriptCs  sZ^(?P(?P.+?)(-(?P\d.+?))?) \.dist-info$cC@s|jdd}xtj|D]}tj|}|r"|jd|kr"ttjj||d:}x0|D](}|j j }|dkrzt SqzWWdQXq"q"Wt S(sP Return True if the extracted wheel in wheeldir should go into purelib. t-t_R+tWHEELsroot-is-purelib: trueN( treplaceR2tlistdirt dist_info_retmatchtgroupRRtjointlowerRR<R6(R+twheeldirt name_foldedtitemRHtwheeltline((s//usr/lib/python2.7/vendor-packages/pip/wheel.pytroot_is_purelibXs!  cC@stjj|siifSt|N}t}x.|D]&}|j|j|jdq;W|jdWdQXtj }|j |i}i}|j drt |j d}n|j drt |j d}n||fS(Ns itconsole_scriptst gui_scripts(R2RtexistsRRR;tstriptseekRtRawConfigParsertreadfpt has_sectiontdicttitems(tfilenametfptdataRPtcptconsoletgui((s//usr/lib/python2.7/vendor-packages/pip/wheel.pytget_entrypointshs"     c &@sF|s-t|d|d|d|d|}nt| rI|dn |dgg jtjjtjj} itg} |rt } tj | dt dt Wd QXt j t | jnd t fd  d d  fd } | | t sKtd tjjdd} t| \fd}xD]}d }d }xtjtjj |D]e}d }|dkrt}|}ntjj ||} ||}| | |td|d|qWqWtd |dt _td*_t _fd}|_d_jdd }|rdtjkrd|}| jj|ntjj dddkrdt!j"d |f}| jj|ndt!j"d |f}| jj|gD]}t#j$d|rK|^qK}x|D] }|=qvWnjdd }|rGdtjkrd |}| jj|nd!t!j"d |f}| jj|gD]}t#j$d"|r|^q}x|D] }|=q3Wnt%dkr| jj&gj'D]}d#|^qrnt%dkr| jj&gj'D]}d#|^qit d$6ntjjdd%}tjjdd&}t(|d'}t(|d(}t)j*|} t)j+|}!xj| D]b}"j|"d|"d|"d<|"dkrt,|"d\|"d<|"d)j|ndS(s6Map archive RECORD paths to installation RECORD paths.N(tadd(tsrcfiletdestfiletmodifiedtoldpathtnewpath(tchangedt installedtlib_dirRoRL(s//usr/lib/python2.7/vendor-packages/pip/wheel.pytrecord_installeds  c@stjj|s"tj|nxtj|D]x\}}}|t|jtjj}tjj||} |r|j tjjddj drq2nx|D]} tjj||| } |r|dkr| j drj | qq|r| j dr| j j jjddj r sQtdj | qqWxB|D]:} |r|| rqlntjj|| } tjj||| }tjj| stj| ntj| |tj| }ttd r&tj||j|jfntj| tjr{tj| }|jtjBtjBtjB}tj||nt}|r||}n| ||qlWq2WdS( Niis.dataR's .dist-infoRBRCsMultiple .dist-info directoriestutime( R2RRTtmakedirstwalkRtlstripRlRJtsplittendswithtappendRKR5t project_nameREtAssertionErrortshutiltcopyfiletstatthasattrRztst_atimetst_mtimetaccesstX_OKtst_modetS_IXUSRtS_IXGRPtS_IXOTHtchmodR6(tsourcetdesttis_basetfixertfiltertdirtsubdirstfilestbasedirtdestdirtst destsubdirR#RqRrtstt permissionsRv(t data_dirstinfo_dirRytreq(s//usr/lib/python2.7/vendor-packages/pip/wheel.pytclobbersJ+ !   s!%s .dist-info directory not foundisentry_points.txtc@s|jjdr"|d }nJ|jjdrD|d }n(|jjdrf|d }n|}|kp|kS(Ns.exeis -script.pyis.pya(RKR(R+t matchname(R`Ra(s//usr/lib/python2.7/vendor-packages/pip/wheel.pytis_entrypoint_wrappers   tscriptsRRR'c@s6ji|jd6|jjddd6|jd6S(Ntmodulet.it import_nametfunc(tscript_templatetprefixtsuffixR~(tentry(tmaker(s//usr/lib/python2.7/vendor-packages/pip/wheel.pyt_get_script_text s  s# -*- coding: utf-8 -*- import re import sys from %(module)s import %(import_name)s if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) sys.exit(%(func)s()) tpiptENSUREPIP_OPTIONSspip = t altinstalls pip%s = %siispip(\d(\.\d)?)?$t easy_installseasy_install = seasy_install-%s = %sseasy_install(-\d\.\d)?$s%s = %sRatRECORDs RECORD.piptrsw+i(R'(0RRQRR2RRltsetR t compileallt compile_dirR<tloggertinfoR tgetvalueR6tNoneRRJRbRFRARRtvariantstset_modeRRtpoptenvirontextendtmaketgetR)tversiontreRHRt make_multipleR[R/tcsvtreadertwriterR%twriterowRtmove(&R+RRLRcRdRet pycompiletschemeRfRt generatedtstdoutRtep_fileRtdatadirRRtsubdirRRt pip_scripttspectktpip_epteasy_install_scriptteasy_install_eptkvtrecordt temp_recordt record_int record_outRRtrowR#R!tl(( RvR`RRaRRwRxRRoRyRRLs//usr/lib/python2.7/vendor-packages/pip/wheel.pytmove_wheel_filess$     < %   $   # +  + 0  !  *c@s"tjfd}|S(Nc?@sHt}x8||D]'}||kr|j||VqqWdS(N(RRp(targstkwtseenRN(tfn(s//usr/lib/python2.7/vendor-packages/pip/wheel.pytuniques    (t functoolstwraps(RR((Rs//usr/lib/python2.7/vendor-packages/pip/wheel.pyt_uniquescc@sddlm}tj||jd}x|D]y}tjj|j|d}|V|j dr5tjj |\}}|d }tjj||d}|Vq5q5WdS(s Yield all the uninstallation paths for dist based on RECORD-without-.pyc Yield paths to all the files in RECORD. For each .py file in RECORD, add the .pyc in the same directory. UninstallPathSet.add() takes care of the __pycache__ .pyc. i(tFakeFileRs.pyis.pycN( t pip.utilsRRRtget_metadata_linesR2RRJtlocationRR~(tdistRRRRtdnRtbase((s//usr/lib/python2.7/vendor-packages/pip/wheel.pytuninstallation_pathss   cC@sygtjd|D] }|^qd}|jd}tj|}|dj}ttt |j d}|SWnt SXdS(s Return the Wheel-Version of an extracted wheel, if possible. Otherwise, return False if we couldn't parse / extract it. iRDs Wheel-VersionRN( Rt find_on_pathRt get_metadataRtparsestrRUttupletmaptintR~R6(t source_dirtdRt wheel_dataR((s//usr/lib/python2.7/vendor-packages/pip/wheel.pyt wheel_versions)cC@s|std|n|dtdkrXtd|djtt|fn1|tkrtjddjtt|ndS(s Raises errors or warns if called with an incompatible Wheel-Version. Pip should refuse to install a Wheel-Version that's a major series ahead of what it's compatible with (e.g 2.0 > 1.1); and warn when installing a version only minor version ahead (e.g 1.2 > 1.1). version: a 2-tuple representing a Wheel-Version (Major, Minor) name: name of wheel or package to raise exception about :raises UnsupportedWheel: when an incompatible Wheel-Version is given s(%s is in an unsupported or invalid wheelisB%s's Wheel-Version (%s) is not compatible with this version of pipRs*Installing from a newer Wheel-Version (%s)N(RtVERSION_COMPATIBLERJRtstrRtwarning(RR+((s//usr/lib/python2.7/vendor-packages/pip/wheel.pytcheck_compatibilitys % tWheelcB@sDeZdZejdejZdZddZ ddZ RS(s A wheel files^(?P(?P.+?)-(?P\d.*?)) ((-(?P\d.*?))?-(?P.+?)-(?P.+?)-(?P.+?) \.whl|\.dist-info)$c@sjj|}|s+td|n|_|jdjdd_|jdjdd_|jdjd_ |jdjd_ |jd jd_ t fd j D_ d S( sX :raises InvalidWheelFilename: when the filename is invalid for a wheel s!%s is not a valid wheel filename.R+RCRBtvertpyverRtabitplatc3@s>|]4}jD]$}jD]}|||fVqqqdS(N(tabistplats(t.0txtytz(tself(s//usr/lib/python2.7/vendor-packages/pip/wheel.pys sN(t wheel_file_reRHRR\RIRER+RR~t pyversionsRRRt file_tags(R R\t wheel_info((R s//usr/lib/python2.7/vendor-packages/pip/wheel.pyt__init__s cC@s]|dkrtj}ng|jD]!}||kr"|j|^q"}|rYt|SdS(s" Return the lowest index that one of the wheel's file_tag combinations achieves in the supported_tags list e.g. if there are 8 supported tags, and one of the file tags is first in the list, then return 0. Returns None is the wheel is not supported. N(RRtsupported_tagsR tindextmin(R ttagstctindexes((s//usr/lib/python2.7/vendor-packages/pip/wheel.pytsupport_index_min s  1cC@s4|dkrtj}ntt|j|jS(s'Is this wheel supported on this system?N(RRRtboolRt intersectionR (R R((s//usr/lib/python2.7/vendor-packages/pip/wheel.pyt supporteds  N( t__name__t __module__t__doc__RtcompiletVERBOSER RRRR(((s//usr/lib/python2.7/vendor-packages/pip/wheel.pyRs   t WheelBuildercB@s/eZdZdddZdZdZRS(s#Build wheels from a RequirementSet.cC@sC||_||_t||_|p*g|_|p9g|_dS(N(trequirement_settfinderR t wheel_dirt build_optionstglobal_options(R RR R!R"R#((s//usr/lib/python2.7/vendor-packages/pip/wheel.pyRs   cC@stjdd|jgt|j}tjd|jtjd|j|dd|jg|j }y!t |d|j dt t SWntjd |jt SXd S( sBuild one wheel.s-csjimport setuptools;__file__=%r;exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))s#Running setup.py bdist_wheel for %ssDestination directory: %st bdist_wheels-dtcwdt show_stdoutsFailed building wheel for %sN(R)R7tsetup_pytlistR#RRR+R!R"RRR6R<terror(R Rt base_argst wheel_args((s//usr/lib/python2.7/vendor-packages/pip/wheel.pyt _build_one's  cC@s|jj|j|jjj}g}xY|D]Q}|jrWtjd|jq2|j rvtjd|jq2|j |q2W|st Stjddj g|D]}|j^qt Ogg}}x:|D]2}|j|r|j |q|j |qWWdQX|rRtjddj g|D]}|j^q6n|rtjddj g|D]}|j^qnnt|d kS( s Build wheels.s(Skipping %s, due to already being wheel.s"Skipping %s, due to being editables*Building wheels for collected packages: %ss, NsSuccessfully built %st sFailed to build %si(Rt prepare_filesR t requirementstvaluestis_wheelRRR+teditableRR<RJR R,R(R treqsettbuildsetRt build_successt build_failure((s//usr/lib/python2.7/vendor-packages/pip/wheel.pytbuild<s>   &   ))N(RRRRRR,R7(((s//usr/lib/python2.7/vendor-packages/pip/wheel.pyRs   (@Rt __future__RRRRRtloggingR2RRRR)tbase64Rt email.parserRtpip._vendor.sixRtpip.exceptionsRRt pip.locationsRRRRRR R R R tpip.utils.loggingR tpip._vendor.distlib.scriptsRt pip._vendorRtpip._vendor.six.movesRt wheel_extRt getLoggerRRR%R/RARRRGRQRbR6RR<RRRRRtobjectRR(((s//usr/lib/python2.7/vendor-packages/pip/wheel.pytsR          (        7