U ÀÒ.e{ ã@sªddlmZddlZddlZddlZddlZddlZddlmZddl m Z e rŒddl m Z ddl mZmZmZmZddlmZddlmZe e¡ZGd d „d eƒZdS) é)Úabsolute_importN)Ú TempDirectory)ÚMYPY_CHECK_RUNNING)Ú TracebackType)ÚIteratorÚOptionalÚSetÚType)ÚInstallRequirement)ÚLinkc@sReZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z e j dd„ƒZ dS)ÚRequirementTrackercCsjtj d¡|_|jdkrJtddd|_|jj|_tjd<t d|j¡nd|_t d|j¡t ƒ|_ dS)NZPIP_REQ_TRACKERFz req-tracker)ÚdeleteZkindzCreated requirements tracker %rz Re-using requirements tracker %r) ÚosÚenvironÚgetÚ_rootrÚ _temp_dirÚpathÚloggerÚdebugÚsetÚ_entries©Úself©rúA/usr/lib/python3.8/site-packages/pip/_internal/req/req_tracker.pyÚ__init__s zRequirementTracker.__init__cCs|S©NrrrrrÚ __enter__&szRequirementTracker.__enter__cCs | ¡dSr)Úcleanup)rÚexc_typeZexc_valZexc_tbrrrÚ__exit__*szRequirementTracker.__exit__cCs$t |j ¡¡ ¡}tj |j|¡Sr) ÚhashlibZsha224Zurl_without_fragmentÚencodeZ hexdigestrrÚjoinr)rÚlinkZhashedrrrÚ _entry_path3szRequirementTracker._entry_pathc Cs¶|j}t|ƒ}| |¡}z,t|ƒ}td|| ¡fƒ‚W5QRXWnltk r°}zN|jtjkrd‚t|dƒ}|  |¡W5QRX|j   |¡t   d||j¡W5d}~XYnXdS)Nz%s is already being built: %sÚwzAdded %s to build tracker %r)r%Ústrr&ÚopenÚ LookupErrorÚreadÚIOErrorÚerrnoZENOENTÚwriterÚaddrrr)rÚreqr%ÚinfoZ entry_pathÚfpÚerrrr/8s   ÿ   zRequirementTracker.addcCs6|j}|j |¡t | |¡¡t d||j¡dS)Nz Removed %s from build tracker %r) r%rÚremoverÚunlinkr&rrr)rr0r%rrrr4Ks zRequirementTracker.removecCsNt|jƒD]}| |¡q |jdk }|r2|j ¡t d|r@dnd|j¡dS)Nz%s build tracker %rZRemovedZCleaned)rrr4rrrrr)rr0r4rrrrRs    þzRequirementTracker.cleanupccs| |¡dV| |¡dSr)r/r4)rr0rrrÚtrack]s zRequirementTracker.trackN) Ú__name__Ú __module__Ú __qualname__rrr!r&r/r4rÚ contextlibÚcontextmanagerr6rrrrr s   r )Z __future__rr:r-r"ZloggingrZpip._internal.utils.temp_dirrZpip._internal.utils.typingrÚtypesrÚtypingrrrr Zpip._internal.req.req_installr Zpip._internal.models.linkr Z getLoggerr7rÚobjectr rrrrÚs