2{Yc@s5dZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl mZddlmZmZddlmZmZddlmZdd lmZdd lmZdd lmZmZmZdd lm Z dd l!m"Z"dd lm Z dZ#d$Z$dd%dZ%ye&dZ'Wne(k rdZ'nXdZ)dZ*ej+dej,Z-dZ.dZ/e0dde2dddZ3dZ4e4dZ5dZ6dZ7d e8fd!YZ9d"e8fd#YZ:dS(&sH Support for installing and building the "wheel" binary package format. i(twith_statementN(turlsafe_b64encode(tParser(t ConfigParsertStringIO(tInvalidWheelFilenametUnsupportedWheel(tdistutils_scheme(tlogger(t pep425tags(tcall_subprocesstnormalize_pathtmake_path_relative(t pkg_resources(t ScriptMakers.whliitsha256icCstj|}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:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pytrehash"s  (cCs t|tr|jdS|S(Ntascii(t isinstancetunicodetencode(ts((s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pytbinary1s cCs t|tr|jdSdS(NR$(R%tstrR'(R(((s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pyR)6scCsItjddkr"i}d}nidd6}d}t||||S(Niitbttnewline(tsyst version_infoR(tnametmodetnltbin((s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pyt open_for_csv:s   cCstjj|rt|d}zj|j}|jtdsItStj j tj }td|ttj }|j }Wd|jXt|d}z|j||j|Wd|jXtSdS(sLReplace #!python with #!/path/to/python Return True if file was changed.Rs#!pythons#!Ntwb(tosRtisfileRtreadlinet startswithR)tFalseR.t executableR'tgetfilesystemencodingtlinesepRtclosetwritetTrue(Rtscriptt firstlinetexenametrest((s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pyt fix_scriptCs     sZ^(?P(?P.+?)(-(?P\d.+?))?) \.dist-info$c Cs|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_R0tWHEELsroot-is-purelib: trueN( treplaceR6tlistdirt dist_info_retmatchtgroupRRtjointlowerRR@R:(R0twheeldirt name_foldedtitemRLtwheeltline((s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pytroot_is_purelib]s!  cCstjj|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(R6RtexistsRRR?tstriptseekRtRawConfigParsertreadfpt has_sectiontdicttitems(tfilenametfptdataRTtcptconsoletgui((s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pytget_entrypointsms"     c %sK|s't|d|d|d|}nt| rC|dn |dgg jtjjtjj} itg} |rtj| dt dt ndt  fd  d(d( fd } | | t st d tjj d d } t| \fd} xD]}d(}d(}xtjtjj |D]e}d(}|dkrt}| }ntjj ||} ||}| | |t d|d|qWq^Wtd(|dtd)_t _fd}|_d_jdd(}|rPdtjkrd|}| jj|ntjjdddkrdtjd |f}| jj|ndtjd |f}| jj|gD]}tjd|r|^q}x|D] }|=q<Wnjdd(}|r dtjkrd|}| jj|ndtjd |f}| jj|gD]}tjd |r|^q}x|D] }|=qWntd krU| jj gj!D]}d!|^q8ntd kr| jj gj!D]}d!|^qit d"6ntjj d d#}tjj d d$}t"|d%M}t"|d&5}t#j$|}t#j%|} xj|D]b}!j|!d |!d |!d <|!d krwt&|!d \|!d<|!d'j|ndS(s6Map archive RECORD paths to installation RECORD paths.N(tadd(tsrcfiletdestfiletmodifiedtoldpathtnewpath(tchangedt installedtlib_dirRrRP(s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pytrecord_installeds  c s tjj|s"tj|nxtj|D]\}}}|t|jtjj}tjj||} |r|j tjjddj drq2nx|D]} tjj||| } |r|dkr| j drj | qq|r| j dr| j j jjddj r sQtdj | qqWx|D]} |r|| rqlntjj|| } tjj||| }tjj| stj| ntj| |t}|r||}n| ||qlWq2WdS( Niis.dataR,s .dist-infoRFRGsMultiple .dist-info directories(R6RRXtmakedirstwalkRtlstripRoRNtsplittendswithtappendROR9t project_nameRItAssertionErrortshutiltcopy2R:(tsourcetdesttis_basetfixertfiltertdirtsubdirstfilestbasedirtdestdirR(t destsubdirR!RtRuRy(t data_dirstinfo_dirR|treq(s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pytclobbers:+ ! * s!%s .dist-info directory not foundisentry_points.txtcs|jjdr"|d }nJ|jjdrD|d }n(|jjdrf|d }n|}|kp|kS(Ns.exeis -script.pyis.pya(ROR(R0t matchname(RdRe(s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pytis_entrypoint_wrappers   tscriptsRRR,cs6ji|jd6|jjddd6|jd6S(Ntmodulet.it import_nametfunc(tscript_templatetprefixtsuffixR(tentry(tmaker(s:/opt/alt/python33/lib/python3.3/site-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 = %sRetRECORDs RECORD.piptrsw+iN(R,(,RRURR6RRotsett compileallt compile_dirR@R:tNoneRRNRfRJRERtvariantstset_modeRRtpoptenvirontextendtmaketgetR.tversiontreRLRt make_multipleR_R4tcsvtreadertwriterR#twriterowR9trelpathRtmove(%R0RRPRgRhRit pycompiletschemetstrip_file_prefixRt generatedRtep_fileRtdatadirRRtsubdirRRt pip_scripttspectktpip_epteasy_install_scriptteasy_install_eptkvtrecordt temp_recordt record_int record_outRRtrowR!Rtl(( RyRdRReRRzR{RRrR|RRPs:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pytmove_wheel_filess!    ( %   $  # +    6@ ! * *cs"tjfd}|S(Nc?sHt}x8||D]'}||kr|j||VqqWdS(N(RRs(targstkwtseenRR(tfn(s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pytuniquevs    (t functoolstwraps(RR((Rs:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pyt_uniqueusccsddlm}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(tFakeFileRis.pyis.pycN( tpip.reqRRRtget_metadata_linesR6RRNtlocationRR(tdistRRRRtdnRtbase((s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pytuninstallation_pathss   cCsygtjd|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. iRHs Wheel-VersionRN( R t find_on_pathRt get_metadataRtparsestrRYttupletmaptintRR:(t source_dirtdRt wheel_dataR((s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pyt wheel_versions)cCs|std|n|dtdkrXtd|djtt|fn2|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_COMPATIBLERNRR*Rtwarn(RR0((s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pytcheck_compatibilitys %  tWheelcBsDeZdZejdejZdZddZ ddZ RS(s A wheel files^(?P(?P.+?)-(?P\d.*?)) ((-(?P\d.*?))?-(?P.+?)-(?P.+?)-(?P.+?) \.whl|\.dist-info)$csjj|}|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.R0RGRFtvertpyverRtabitplatc3s>|]4}jD]$}jD]}|||fVqqqdS(N(tabistplats(t.0txtytz(tself(s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pys sN(t wheel_file_reRLRR`RMRIR0RRt pyversionsRRRt file_tags(RR`t wheel_info((Rs:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pyt__init__s cCs]|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(RR tsupported_tagsRtindextmin(Rttagstctindexes((s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pytsupport_index_mins  1cCs4|dkrtj}ntt|j|jS(s'Is this wheel supported on this system?N(RR RtboolRt intersectionR(RR((s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pyt supporteds  N( t__name__t __module__t__doc__RtcompiletVERBOSERRRRR (((s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pyRs   t WheelBuildercBs/eZdZggdZdZdZRS(s#Build wheels from a RequirementSet.cCs7||_||_t||_||_||_dS(N(trequirement_settfinderR t wheel_dirt build_optionstglobal_options(RRRRRR((s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pyRs    cCstjdd|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.R;tsetup_pytlistRRtnotifyR0RRR RR:R@terror(RRt base_argst wheel_args((s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pyt _build_ones  cCs_|jj|j|jjj}g|D]}|js,|^q,}|sQdStjddjg|D]}|j ^qgtj d7_ gg}}x:|D]2}|j |r|j |q|j |qWtj d8_ |r"tjddjg|D]}|j ^qn|r[tjddjg|D]}|j ^q>ndS(s Build wheels.Ns*Building wheels for collected packages: %st,isSuccessfully built %st sFailed to build %s( Rt prepare_filesRt requirementstvaluestis_wheelRRRNR0tindentRR(RtreqsetRtbuildsett build_successt build_failure((s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pytbuilds&"'  3(R R R RRR*(((s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pyRs (iii(;R t __future__RRRRRR6RRR.tbase64Rt email.parserRtpip.backwardcompatRRtpip.exceptionsRRt pip.locationsRtpip.logRRR tpip.utilR R R t pip._vendorR tpip._vendor.distlib.scriptsRt wheel_extRR#R&R)t NameErrorR4RER RRKRURfR:RR@RRRRRtobjectRR(((s:/opt/alt/python33/lib/python3.3/site-packages/pip/wheel.pytsT                   2