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ƒ‚W5QRXWnztk r¾}z\|jtjkrd‚||j ksrt ‚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ÚerrnoZENOENTrÚAssertionErrorÚwriteÚaddrrr)rÚreqr%ÚinfoZ entry_pathÚfpÚerrrr08s    ÿ   zRequirementTracker.addcCs6|j}|j |¡t | |¡¡t d||j¡dS)Nz Removed %s from build tracker %r) r%rÚremoverÚunlinkr&rrr)rr1r%rrrr5Ks zRequirementTracker.removecCsNt|jƒD]}| |¡q |jdk }|r2|j ¡t d|r@dnd|j¡dS)Nz%s build tracker %rZRemovedZCleaned)rrr5rrrrr)rr1r5rrrrRs    þzRequirementTracker.cleanupccs| |¡dV| |¡dSr)r0r5)rr1rrrÚtrack]s zRequirementTracker.trackN) Ú__name__Ú __module__Ú __qualname__rrr!r&r0r5rÚ contextlibÚcontextmanagerr7rrrrr 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 getLoggerr8rÚobjectr rrrrÚs