U ÀÒ.e,ã@sdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z m Z mZmZmZddlmZdd lmZdd lmZdd lmZdd lmZmZdd lmZerøddlmZddlm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(e )e*¡Z+dd„Z,Gdd„de-ƒZ.dS)z)Prepares a distribution for installation éN)Úrequests)Ú)make_distribution_for_install_requirement)ÚInstalledDistribution)Ú unpack_url)ÚDirectoryUrlHashUnsupportedÚ HashUnpinnedÚInstallationErrorÚPreviousBuildDirErrorÚVcsHashUnsupported)Ú expanduser)Ú MissingHashes)Ú indent_log)Úwrite_delete_marker_file)Ú display_pathÚnormalize_path)ÚMYPY_CHECK_RUNNING)ÚOptional)ÚAbstractDistribution)Ú PackageFinder)Ú PipSession)ÚInstallRequirement)ÚRequirementTrackerc Cs.t|ƒ}| |¡�| ||¡W5QRX|S)z-Prepare a distribution for installation. )rZtrackZprepare_distribution_metadata)ÚreqÚ req_trackerÚfinderÚbuild_isolationÚ abstract_dist©rúD/usr/lib/python3.8/site-packages/pip/_internal/operations/prepare.pyÚ_get_prepared_distribution,s rcsDeZdZdZ‡fdd„Zedd„ƒZdd„Zdd „Zd d „Z ‡Z S) ÚRequirementPreparerzPrepares a Requirement csTtt|ƒ ¡||_||_||_|r,t|ƒ}||_|r>t|ƒ}||_ ||_ ||_ dS)N) Úsuperr Ú__init__Úsrc_dirÚ build_dirrr Ú download_dirrÚwheel_download_dirÚ progress_barr)Úselfr$r%r#r&r'rr©Ú __class__rrr"9s zRequirementPreparer.__init__cCs<|js dStj |j¡rdSt d¡tdt|jƒƒ‚dS)NFTz!Could not find download directoryz0Could not find or access download directory '%s')r%ÚosÚpathÚexistsÚloggerÚcriticalrr)r(rrrÚ_download_should_saveas ÿÿz)RequirementPreparer._download_should_savec Cs®|j}|jdkr(|j}t dt|ƒ¡nt d|jp6|¡tƒ��b| |j ¡t j   t j   |jd¡¡rztd||jfƒ‚|r¬|jrŒtƒ‚n| ¡rštƒ‚|js¬|js¬tƒ‚|j| d�}|rÈ|sÈtƒ}|j}|jrà|jrà|j}zt||j||||jd�WnFtjk �rB} z$t  d|| ¡t!d || |fƒ‚W5d } ~ XYnX|j�r^|�rXd } nd } nd } | �rrt"|jƒt#||j$||j%ƒ} |j&�r |j�r | '|j¡W5QRX| S) zCPrepare a requirement that would be obtained from req.link Úfilez Processing %sz Collecting %szsetup.pyzípip can't proceed with requirements '%s' due to a pre-existing build directory (%s). 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.)Ztrust_internet)ÚsessionÚhashesr'z4Could not install requirement %s because of error %szDCould not install requirement %s because of HTTP error %s for URL %sNTF)(ÚlinkZschemeZ file_pathr.Úinforrr Úensure_has_source_dirr$r+r,r-ÚjoinZ source_dirr Zis_vcsr Zis_existing_dirrZ original_linkZ is_pinnedrr3r r%Zis_wheelr&rr'rZ HTTPErrorr/rrrrrr0Úarchive) r(rr2rÚrequire_hashesr4r,r3r%ÚexcZautodelete_unpackedrrrrÚprepare_linked_requirementos~    ûÿ   ý ýþÿ ÿz.RequirementPreparer.prepare_linked_requirementc Cszt d|¡tƒ�^|r$td|ƒ‚| |j¡| |j ¡t||j ||j ƒ}|jrb|  |j ¡|  |¡W5QRX|S)z(Prepare an editable requirement z Obtaining %szoThe editable requirement %s cannot be installed when requiring hashes, because there is no single file to hash.)r.r5r rr6r#Zupdate_editabler0rrrr8r%Zcheck_if_exists)r(rr9Z use_user_siterrrrrÚprepare_editable_requirementés( þÿ ÿ z0RequirementPreparer.prepare_editable_requirementc Cs@t d|||jj¡tƒ�|r*t d¡t|ƒ}W5QRX|S)z1Prepare an already-installed requirement zRequirement %s: %s (%s)z§Since it is already installed, we are trusting this package without checking its hash. To ensure a completely repeatable environment, install into an empty virtualenv.)r.r5Z satisfied_byÚversionr Údebugr)r(rr9Z skip_reasonrrrrÚprepare_installed_requirement sþÿz1RequirementPreparer.prepare_installed_requirement) Ú__name__Ú __module__Ú __qualname__Ú__doc__r"Úpropertyr0r;r<r?Ú __classcell__rrr)rr 5s ( z"r )/rCZloggingr+Z pip._vendorrZpip._internal.distributionsrZ%pip._internal.distributions.installedrZpip._internal.downloadrZpip._internal.exceptionsrrrr r Zpip._internal.utils.compatr Zpip._internal.utils.hashesr Zpip._internal.utils.loggingr Z pip._internal.utils.marker_filesrZpip._internal.utils.miscrrZpip._internal.utils.typingrÚtypingrrZpip._internal.indexrZpip._internal.network.sessionrZpip._internal.req.req_installrZpip._internal.req.req_trackerrZ getLoggerr@r.rÚobjectr rrrrÚs.