U n a>N@sBdZddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z ddl mZmZmZmZmZmZddlmZdd lmZdd lmZdd lmZmZmZmZdd lm Z dd l!m"Z"ddl#m$Z$ddl%m&Z&e"rddl'm(Z(m)Z)m*Z*m+Z+ddl,m-Z-ddl m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddlm9Z9ere-de(e:e)e:ge)e:fe;dddZZ?ddZ@d d!ZAGd"d#d#eBZCd4d$d%ZDd&d'ZEd(d)ZFd5d*d+ZGd6d,d-ZHd.d/ZId0d1ZJGd2d3d3eBZKdS)7z)Prepares a distribution for installation N)requests)PY2))make_distribution_for_install_requirement)InstalledDistribution)DirectoryUrlHashUnsupported HashMismatch HashUnpinnedInstallationErrorPreviousBuildDirErrorVcsHashUnsupported) copy2_fixed) MissingHashes) indent_log) display_pathhide_urlpath_to_displayrmtree) TempDirectory)MYPY_CHECK_RUNNING) unpack_file)vcs)CallableListOptionalTuple) TypedDict)AbstractDistribution) PackageFinder)Link) Downloader)InstallRequirement)RequirementTracker)HashesCopytreeKwargsignoresymlinksF)total) copy_functionr%ignore_dangling_symlinksr&c Cs.t|}|||||W5QRX|S)z-Prepare a distribution for installation. )rtrackprepare_distribution_metadata)req req_trackerfinderbuild_isolation abstract_distr1aC:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-6mt8ur68\pip\_internal\operations\prepare.py_get_prepared_distributionPs  r3cCs0t|j}|dk st|j|t|jddS)N)url)rget_backend_for_schemeschemeAssertionErrorunpackrr4)linklocation vcs_backendr1r1r2unpack_vcs_link_s  r<c@seZdZddZdS)FilecCs||_||_dSN)path content_type)selfr?r@r1r1r2__init__gsz File.__init__N)__name__ __module__ __qualname__rBr1r1r1r2r=fsr=cCsVtddd}d}|r t|||}|r8|}t|d}nt|||j|\}}t||S)Nr8T)kindglobally_managedr)r_check_download_dir mimetypes guess_type_download_http_urlr?r=)r9 downloader download_dirhashestemp_diralready_downloaded_path from_pathr@r1r1r2 get_http_urlms$ rRc CsTzt||Wn@tjk rN}z tdt|t|t|W5d}~XYnXdS)zCopying special files is not supported, but as a convenience to users we skip errors copying them. This supports tools that may create e.g. socket files in the project source directory. z>Ignoring special file error '%s' encountered copying %s to %s.N)r shutilSpecialFileErrorloggerwarningstrr)srcdester1r1r2_copy2_ignoring_special_filessr[cs`tj|}tj|tj|fdd}t|dd}tsLt|d<tj |f|dS)Ncs6g}|kr|ddg7}tj|kr2|g7}|S)Nz.toxz.nox)osr?abspath)dnamesskippedsourcetarget_basenametarget_dirnamer1r2r%s   z!_copy_source_tree..ignoreTr$r() r\r?r]basenamedirnamedictrr[rScopytree)rbtargettarget_abspathr%kwargsr1rar2_copy_source_trees    rlcCsJd}|rt|||}|r|}n|j}|r2||t|d}t||S)z,Get file and optionally check its hash. Nr)rH file_pathcheck_against_pathrIrJr=)r9rMrNrPrQr@r1r1r2 get_file_urls  rocCsz|jrt||dS|r@tj|r0t|t|j|dS|j rVt |||d}nt ||||d}t |j||j |S)a_Unpack link into location, downloading if required. :param hashes: A Hashes object, one of whose embedded hashes must match, or HashMismatch will be raised. If the Hashes is empty, no matches are required, and unhashable types of requirements (like VCS ones, which would ordinarily raise HashUnsupported) are allowed. NrN)is_vcsr<is_existing_dirr\r?isdirrrlrmis_filerorRrr@)r9r:rLrMrNfiler1r1r2 unpack_urls$    rvc Csf||}tj||j}t|d}|jD]}||q*W5QRX|rR||||jj ddfS)z6Download link url into temp_dir using provided sessionwbz content-type) r\r?joinfilenameopenchunkswriternresponseheadersget)r9rLrOrNdownloadrm content_filechunkr1r1r2rK s   rKcCsptj||j}tj|s dStd||rlz||Wn,tk rjt d|t |YdSX|S)z Check download_dir for previously downloaded file with correct hash If a correct file is found return its path else None NzFile was already downloaded %sz;Previously-downloaded file %s has bad hash. Re-downloading.) r\r?ryrzexistsrUinfornrrVunlink)r9rMrN download_pathr1r1r2rH"s   rHcsDeZdZdZfddZeddZddZdd Zd d Z Z S) RequirementPreparerzPrepares a Requirement c sNtt|||_||_||_||_||_||_||_ ||_ | |_ | |_ dSr>) superrrBsrc_dir build_dirr-rLr.rMwheel_download_dirr/require_hashes use_user_site) rArrMrrr/r-rLr.rr __class__r1r2rB@szRequirementPreparer.__init__cCs:|js dStj|jrdStdtd|jdS)NFTz!Could not find download directoryz0Could not find or access download directory '{}')rMr\r?rrUcriticalr format)rAr1r1r2_download_should_savems z)RequirementPreparer._download_should_savec Cs*|js t|j}|jdkr2|j}tdt|ntd|jp@||j}|j r\|j r\|j }|j rr|rld}qvd}nd}t |j dkst| |j|tjtj|j drtd||j |jr|jrtn|rt|js|jst|j|j d }|jr|st}zt||j |j ||d }WnFt!j"k r~}z$t#d ||t$d |||W5d}~XYnX|r|j|_%t&||j'|j(|j)} |r|rtd nB|rtj||j*} tj| st+,|j| tdt| |j-r|jr|.|jW5QRX| S)zCPrepare a requirement that would be obtained from req.link ruz Processing %sz Collecting %sTFNzsetup.pyzpip can't proceed with requirements '{}' due to a pre-existing build directory ({}). This is likely due to a previous installation that failed. pip is being responsible and not assuming it can delete this. Please delete it and try again.)trust_internetrpz4Could not install requirement %s because of error %szDCould not install requirement {} because of HTTP error {} for URL {}z*Link is a directory, ignoring download_dirzSaved %s)/r9r7r6rmrUrrr,rMis_wheelrr source_dirensure_has_source_dirrr\r?rryr rrrqr rrr original_link is_pinnedrrNr rvrLr HTTPErrorrr local_file_pathr3r-r.r/rzrScopyrarchive) rAr,r9r?rMautodelete_unpackedrN local_fileexcr0download_locationr1r1r2prepare_linked_requirement{s         z.RequirementPreparer.prepare_linked_requirementc Cs|jstdtd|tf|jr6td|||j | |j t ||j |j|j}|j rv||j||jW5QRX|S)z(Prepare an editable requirement z-cannot prepare a non-editable req as editablez Obtaining %szoThe editable requirement {} cannot be installed when requiring hashes, because there is no single file to hash.)editabler7rUrrrr rrrupdate_editablerr3r-r.r/rrMcheck_if_existsr)rAr,r0r1r1r2prepare_editable_requirements*   z0RequirementPreparer.prepare_editable_requirementc Csh|jstd|dk s&td|jtd|||jjt|jrRtdt |}W5QRX|S)z1Prepare an already-installed requirement z(req should have been satisfied but isn'tNzAdid not get skip reason skipped but req.satisfied_by is set to {}zRequirement %s: %s (%s)zSince it is already installed, we are trusting this package without checking its hash. To ensure a completely repeatable environment, install into an empty virtualenv.) satisfied_byr7rrUrversionrrdebugr)rAr, skip_reasonr0r1r1r2prepare_installed_requirements& z1RequirementPreparer.prepare_installed_requirement) rCrDrE__doc__rBpropertyrrrr __classcell__r1r1rr2r<s - r)NN)NN)NN)LrloggingrIr\rS pip._vendorrZpip._vendor.sixrpip._internal.distributionsr%pip._internal.distributions.installedrpip._internal.exceptionsrrrr r r pip._internal.utils.filesystemr pip._internal.utils.hashesr pip._internal.utils.loggingrpip._internal.utils.miscrrrrpip._internal.utils.temp_dirrpip._internal.utils.typingrpip._internal.utils.unpackingrpip._internal.vcsrtypingrrrrZmypy_extensionsrr"pip._internal.index.package_finderrpip._internal.models.linkrpip._internal.network.downloadrZpip._internal.req.req_installr pip._internal.req.req_trackerr!r"rWboolr# getLoggerrCrUr3r<objectr=rRr[rlrorvrKrHrr1r1r1r2s|                        " % /