v]c @@sdZddlmZddlZddlZddlZddlZddlZddlZ ddl Z ddl Z ddl Z ddl Z ddlZddlmZddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lm Z m!Z!m"Z"dd l#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:e8rddl;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEddlFmGZGddlHmIZIddlmJZJddlKmLZLmMZMddlNmOZOddlPmQZQddlRmSZSeAeTdfZUnddfZVejWeXZYd ZZdd!>d"Z[dd!>d#Z\d$Z]d%Z^d&Z_e j`d'e jaZbd(Zcd)Zdd*Zed+Zfd,Zgeheieiejeieheiejd-Zkd.Zld/Zmd0Znd1eofd2YZpe j`d3e jqd4Zrd5Zsd6Ztd7Zud8eofd9YZvdS(:sH Support for installing and building the "wheel" binary package format. i(tabsolute_importN(turlsafe_b64encode(tParser(t pkg_resources(t ScriptMaker(tcanonicalize_name(tStringIO(t pep425tags(t unpack_url(tInstallationErrortInvalidWheelFilenametUnsupportedWheel(tdistutils_scheme(tLink(t indent_log(tPIP_DELETE_MARKER_FILENAME(t LOG_DIVIDERtcall_subprocesstcaptured_stdoutt ensure_dirtformat_command_argst path_to_urlt read_chunks(tmake_setuptools_shim_args(t TempDirectory(tMYPY_CHECK_RUNNING(t open_spinner( tDicttListtOptionaltSequencetMappingtTupletIOtTexttAnytIterable(t Requirement(tInstallRequirement(t PipSession(t FormatControlt PackageFinder(tRequirementPreparer(t WheelCache(t Pep425Tag.icC@s%tjj||jtjjdS(Nt/(tostpathtrelpathtreplacetsep(tsrctp((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pytnormpathBsicC@sntj}d}t|dA}x7t|d|D]#}|t|7}|j|q7WWdQX||fS(s5Return (hash, length) for path using hashlib.sha256()itrbtsizeN(thashlibtsha256topenRtlentupdate(R/t blocksizethtlengthtftblock((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyt hash_fileFs cC@sMt||\}}dt|jjdjd}|t|fS(s?Return (encoded_digest, length) for path using hashlib.sha256()ssha256=tlatin1t=(RBRtdigesttdecodetrstriptstr(R/R=R>R?RE((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pytrehashRs cC@sItjddkr"i}d}nidd6}d}t||||S(Niitbttnewline(tsyst version_infoR:(tnametmodetnltbin((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyt open_for_csv]s   cC@s&|jd}||d(?P.+?)(-(?P.+?))?) \.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. RTt_ROtWHEELsroot-is-purelib: trueN( R1R.tlistdirt dist_info_retmatchtgroupR:R/RVtlowerRGRgR`(ROtwheeldirt name_foldedtitemRrtwheeltline((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pytroot_is_purelibs!  c@stjj|siifSt|N}t}x.|D]&}|j|j|jdq;W|jdWdQXtj j |}|j di}|j di}dt fd|j D}t fd|j D}||fS(Ns itconsole_scriptst gui_scriptscS@st|jddjdS(sRget the string representation of EntryPoint, remove space and split on '='t RKRD(RHR1RU(ts((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyt _split_epsc3@s|]}|VqdS(N((t.0tv(R(s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pys sc3@s|]}|VqdS(N((RR(R(s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pys s(R.R/texistsR:RRftstriptseekRt EntryPointt parse_maptgettdicttvalues(tfilenametfptdataRyt entry_pointstconsoletgui((Rs2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pytget_entrypointss    ""c @s|s dStjt}xC|D];}tjj|}tjj|}||j|q Wgtj j ddj tj D]$}tjj |jtj^qjtjj tjjtjfd|jD}|sdSg}x|jD]\}}t|}t|dkrLdj|d} n(djdj|d d |d } |jd j| |q Wd } t|dkr|j| jd n|j| jddj|S(sDetermine if any scripts are not on PATH and format a warning. Returns a warning message if one or more scripts are not on PATH, otherwise None. tPATHRKc@s7i|]-\}}tjj|kr||qS((R.R/tnormcase(Rt parent_dirtscripts(t not_warn_dirs(s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pys s is script {} isisscripts {} ares, is and s.The {} installed in '{}' which is not on PATH.seConsider adding {} to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.sthis directorysthese directoriess N(Rht collectionst defaultdicttsetR.R/tdirnametbasenametaddtenvironRRUtpathsepRRGR2tappendRMRatitemstsortedR;tformatRV( Rtgrouped_by_dirtdestfileRt script_nametitwarn_fort msg_linestsorted_scriptst start_textt last_line_fmt((Rs2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyt!message_about_scripts_not_on_PATHs8 I( "cC@st|ddS(s; Return the given rows of a RECORD file in sorted order. Each row is a 3-tuple (path, hash, size) and corresponds to a record of a RECORD file (see PEP 376 and PEP 427 for details). For the rows passed to this function, the size can be an integer as an int or string, or the empty string. tkeycS@std|DS(Ncs@s|]}t|VqdS(N(RH(Rtx((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pys s(ttuple(trow((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyt RK(R(toutrows((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pytsorted_outrowssc C@s3g}x|D]}t|dkr>tjdj|nt|}|d}|j||}||d<||krt|\} } | |d<| |dj|ndS(s6Map archive RECORD paths to installation RECORD paths.N(R5R(tsrcfileRtmodifiedtoldpathtnewpath(RRRRu(s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pytrecord_installedbs  c@st|xtj|D]\}}}|t|jtjj}tjj||} |r|jtjjddj drqnx|D]} tjj||| } |r|dkr| j drj | qq|r| j drt | j t j r sBtd| ddjj | qqWxL|D]D} |r{|| r{q]ntjj|| } tjj||| }t| tjj|rtj|ntj| |tj| }ttdr!tj||j|jfntj| tjrvtj| }|jtjBtjBtjB}tj||nt}|r||}n| ||q]WqWdS( Niis.dataRKs .dist-infos!Multiple .dist-info directories: s, tutime( RR.twalkR;tlstripR/R2RVRUtendswithRRR_ROtAssertionErrorRtunlinktshutiltcopyfiletstatthasattrRtst_atimetst_mtimetaccesstX_OKtst_modetS_IXUSRtS_IXGRPtS_IXOTHtchmodR`(tsourcetdesttis_basetfixertfiltertdirtsubdirstfilestbasedirtdestdirR~t destsubdirR@RRtstt permissionsR(t data_dirstinfo_dirRtreq(s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pytclobberjsN + !      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(RtR(ROt matchname(RR(s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pytis_entrypoint_wrappers   RRRRKc@s^|jdkr(td|fnji|jd6|jjddd6|jd6S(NsInvalid script entry point: %s for req: %s - A callable suffix is required. Cf https://packaging.python.org/en/latest/distributing.html#console-scripts for more information.tmodulet.it import_nametfunc(tsuffixRhR tscript_templateRRU(tentry(tmakerR(s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyt_get_script_texts  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 = %sRt INSTALLERs INSTALLER.pipR\spip tRECORDs RECORD.piptrsw+RRRR(8R RzRGR.R/R2RRtwarningstcatch_warningstfilterwarningst compileallt compile_dirRgRtdebugtgetvalueR`RhRRVRRpRmRRtvariantstset_modeRRRRtextendtmakeRRMtversiontreRrR;t make_multipleRRRR:RfRtmoveRRStcsvtreaderRtwriterRtwriterow(+RORRuRRRt pycompiletschemeRRtwarn_script_locationRRtstdoutRtep_fileRtdatadirRRtsubdirRRt pip_scripttspectktpip_epteasy_install_scriptteasy_install_eptkvtgenerated_console_scriptstmsgt installerttemp_installertinstaller_filetrecordt temp_recordt record_int record_outRRRR(( RRRRRRRRRRRus2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pytmove_wheel_files0s       %F %   $    # +  + &     cC@sygtjd|D] }|^qd}|jd}tj|}|dj}ttt |j d}|SWnt k rdSXdS(s Return the Wheel-Version of an extracted wheel, if possible. Otherwise, return None if we couldn't parse / extract it. iRos Wheel-VersionRN( Rt find_on_pathRht get_metadataRtparsestrRRtmaptintRUt Exception(t source_dirtdtdistt wheel_dataR((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyt wheel_versionns) 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(R tVERSION_COMPATIBLERVR3RHRR(RRO((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pytcheck_compatibilitys% cC@s dj|S(s Format three tags in the form "--". :param file_tag: A 3-tuple of tags (python_tag, abi_tag, platform_tag). RT(RV(tfile_tag((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyt format_tagstWheelcB@sMeZdZejdejZdZdZddZ ddZ RS(s A wheel files^(?P(?P.+?)-(?P.*?)) ((-(?P\d[^-]*?))?-(?P.+?)-(?P.+?)-(?P.+?) \.whl|\.dist-info)$c@sjj|}|s+td|n|_|jdjdd_|jdjdd_|jd_|jdj d_ |jd j d_ |jd j d_ fd j D_ d S( sX :raises InvalidWheelFilename: when the filename is invalid for a wheel s!%s is not a valid wheel filename.RORnRTtvertbuildtpyverRtabitplatc@s?h|]5}jD]%}jD]}|||fq qqS((tabistplats(RRtytz(tself(s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pys s N(t wheel_file_reRrR RRsR1RORt build_tagRUt pyversionsRERFt file_tags(RIRt wheel_info((RIs2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyt__init__s cC@std|jDS(sF Return the wheel's tags as a sorted list of strings. cs@s|]}t|VqdS(N(R>(Rttag((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pys s(RRM(RI((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pytget_formatted_file_tagsscC@s`|dkrtj}ng|jD]!}||kr%|j|^q%}|r\t|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(RhRt get_supportedRMtindextmin(RIttagstctindexes((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pytsupport_index_mins 1cC@s7|dkrtj}ntt|j|jS(s'Is this wheel supported on this system?N(RhRRRtboolRt intersectionRM(RIRU((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyt supporteds N( t__name__t __module__t__doc__RtcompiletVERBOSERJRORQRhRXR[(((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyR?s    s([a-z0-9_.]+)-([a-z0-9_.!+-]+)cC@st|j|S(sjDetermine whether the string looks like an egg_info. :param s: The string to parse. E.g. foo-2.1 (RYtsearch(R~t _egg_info_re((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyt_contains_egg_infoscC@s|jr dS|jr6|s2tjd|jndS|s@tS|jsS|j rWdSd|j t |jkrtjd|jdS|j r|j j rt S|j }|j\}}|rt|rtSt S(sZ Return whether to build an InstallRequirement object using the ephemeral cache. :param cache_available: whether a cache directory is available for the autobuilding=True case. :return: True or False to build the requirement with ephem_cache=True or False, respectively; or None not to build the requirement. s(Skipping %s, due to already being wheel.tbinarysCSkipping bdist_wheel for %s, due to binaries being disabled for it.N(t constraintRhtis_wheelRtinfoROR`teditableR6tget_allowed_formatsRtlinkt is_artifactRgtsplitextRc(Rtformat_controlt autobuildingtcache_availableRjtbasetext((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pytshould_use_ephemeral_caches0     cC@st|}dj|}|s.|d7}nTtjtjkrP|d7}n2|jdsl|d7}n|dj|t7}|S(s1 Format command information for logging. sCommand arguments: {} sCommand output: Nones'Command output: [use --verbose to show]s sCommand output: {}{}(RRRtgetEffectiveLeveltloggingtDEBUGRR(t command_argstcommand_outputt command_descttext((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pytformat_command_result,s    cC@st|}|sHdj|j}|t||7}tj|dSt|dkrdj|j|}|t||7}tj|ntj j ||dS(sH Return the path to the wheel in the temporary build directory. s1Legacy build of wheel for {!r} created no files. isZLegacy build of wheel for {!r} created more than one file. Filenames (choosing first): {} iN( RRRORzRRRhR;R.R/RV(tnamesttemp_dirRRvRwR'((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pytget_legacy_build_wheel_pathCs   t WheelBuildercB@sneZdZd d edZd dZd dZdZd dZ d dZ dZ edZ RS( s#Build wheels from a RequirementSet.cC@sR||_||_||_|j|_|p0g|_|p?g|_||_dS(N(tfindertpreparert wheel_cachetwheel_download_dirt _wheel_dirt build_optionstglobal_optionstno_clean(RIRRRRRR((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyROfs    c C@s*|j|j||d|SWdQXdS(siBuild one wheel. :return: The filename of the built wheel, or None if the build failed. t python_tagN(t build_envt_build_one_inside_env(RIRt output_dirR((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyt _build_onezs c C@s tdd}|jr'|j}n |j}|||jd|}|dk rtjj|}tjj||}y\t |\} } t j ||t j d|j|| | jt j d||SWqtk rqXn|j|dSWdQXdS(NtkindRxRs3Created wheel for %s: filename=%s size=%d sha256=%ssStored in directory: %s(Rt use_pep517t_build_one_pep517t_build_one_legacyR/RhR.RRVRBRRRRgROt hexdigestR5t _clean_one( RIRRRR|tbuildert wheel_patht wheel_namet dest_patht wheel_hashR?((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyRs(         cC@s&t|jdt}|t|jS(Ntunbuffered_output(Rt setup_py_pathRgRR(RIRtbase_cmd((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyt_base_setup_argss  cC@s|jdk st|jr9tjd|jfdSyd|jf|_tjd||j j |d|j}|rt ||}t j t jj||t jj|||}nWn%tk rtjd|jdSXt jj||S(sBuild one InstallRequirement using the PEP 517 build process. Returns path to wheel if successfully built. Otherwise, returns None. sGCannot build wheel for %s using PEP 517 when --build-options is presentsBuilding wheel for %s (PEP 517)sDestination directory: %stmetadata_directorysFailed building wheel for %sN(RRhRRRterrorROt spin_messageR tpep517_backendt build_wheelRZR.trenameR/RVR5(RIRttempdRRtnew_name((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyRs*      c C@s|j|}d|jf}t|}tjd||dd|g|j}|dk rw|d|g7}nyt|d|jd|}Wn2t k r|j dtj d |jdSXt j |} td | d |d |d |d|} | SWdQXdS(sBuild one InstallRequirement using the "legacy" build process. Returns path to wheel if successfully built. Otherwise, returns None. s Building wheel for %s (setup.py)sDestination directory: %st bdist_wheels-ds --python-tagtcwdtspinnerRsFailed building wheel for %sR{R|RRvRwN(RRORRR RRhRt setup_py_dirR5tfinishRR.RpR}( RIRRRt base_argsRRt wheel_argstoutputR{R((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyRs,     cC@sy|j|}tjd|j|ddg}yt|d|jtSWn%tk rttjd|jt SXdS(NsRunning setup.py clean for %stcleans--allRs Failed cleaning build dir for %s( RRRgRORR6RgR5RR`(RIRRt clean_args((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyRs c C@s2g}|jj}t|jp'|jj}xQ|D]I}t|d|d|d|}|d krjq4n|j||fq4W|sgSt d|Dr|jp|o|jj} | st nt j ddj g|D]\}} |j^q|j} tgg} } x|D]\}}d }|rtj}|rc| j|j}n| j|j}yt|Wqtk r}t jd|j|| j|q'qXn |j}|j||d|}|r| j||r|jr9tjjtjj |jt r9t d n|j|j|j j!|_t"t#||_|jj$st t%|j|jd t&d |qq'| j|q'WWd QX| rt j d d j g| D]}|j^qn| r.t j dd j g| D]}|j^qn| S(sBuild wheels. :param unpack: If True, replace the sdist we built from with the newly built wheel, in preparation for installation. :return: True if all the wheels built correctly. RmRnRocs@s|]\}}| VqdS(N((RRnt ephem_cache((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pys ss*Building wheels for collected packages: %ss, s Building wheel for %s failed: %sRsbad source dir - missing markertsessionNsSuccessfully built %sR}sFailed to build %s('RRmRYRRt cache_dirRrRhRtanyRRRgRVRORRtimplementation_tagtget_ephem_path_for_linkRjtget_path_for_linkRtOSErrorRRR6R.R/RRtremove_temporary_sourcetbuild_locationRt build_dirR RRfRR`(RIt requirementsRRntbuildsetRmRoRRthave_directory_for_buildRnt_cachet build_successt build_failuretephemRRtet wheel_file((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyRAs      ,               ))N( R\R]R^RhR`RORRRRRRRA(((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyR~cs  " ! (wR^t __future__RRRRR8Rttos.pathR.RRRRMRtbase64Rt email.parserRt pip._vendorRtpip._vendor.distlib.scriptsRtpip._vendor.packaging.utilsRtpip._vendor.sixRt pip._internalRtpip._internal.downloadRtpip._internal.exceptionsR R R tpip._internal.locationsR tpip._internal.models.linkR tpip._internal.utils.loggingRt pip._internal.utils.marker_filesRtpip._internal.utils.miscRRRRRRRt$pip._internal.utils.setuptools_buildRtpip._internal.utils.temp_dirRtpip._internal.utils.typingRtpip._internal.utils.uiRttypingRRRRRR R!R"R#R$t"pip._vendor.packaging.requirementsR%tpip._internal.req.req_installR&R'tpip._internal.indexR(R)t pip._internal.operations.prepareR*tpip._internal.cacheR+tpip._internal.pep425tagsR,RHtInstalledCSVRowR;t getLoggerR\RR5RBRIRSRZRmR_R`RqRzRRRRR`RhRgR/R:R<R>tobjectR?tIRcRrRzR}R~(((s2/tmp/pip-install-vZZv26/pip/pip/_internal/wheel.pyts           4F      =  ( 4   D 6