idUddlZddlZddlZddlZddlZddlmZmZddl m Z m Z m Z m Z mZmZddlmZmZejeZeddZedd d Zdae eed <ed e dfdZGddZdae eed<ed e eddffdZGddZeZGddZ Gdde Z!dS)N) ExitStackcontextmanager)AnyDict GeneratorOptionalTypeVarUnion)enumrmtree_T TempDirectory)boundz build-envzephem-wheel-cachez req-build) BUILD_ENVEPHEM_WHEEL_CACHE REQ_BUILD_tempdir_managerreturn)NNNc#Kt5}t|c}a dV|an#|awxYw ddddS#1swxYwYdSN)rr)stackold_tempdir_managers Q/opt/cloudlinux/venv/lib/python3.11/site-packages/pip/_internal/utils/temp_dir.pyglobal_tempdir_managerrs 30@%-- 3 EEE2  2  2 2 2 2  333333333333333333s 9$9(9==c>eZdZdZd dZdededdfdZdedefdZdS) TempDirectoryTypeRegistryzManages temp directory behaviorrNci|_dSr_should_deleteselfs r__init__z"TempDirectoryTypeRegistry.__init__*s/1kindvaluec||j|<dS)z[Indicate whether a TempDirectory of the given kind should be auto-deleted. Nr)r!r$r%s r set_deletez$TempDirectoryTypeRegistry.set_delete-s%*D!!!r#c8|j|dS)z^Get configured auto-delete flag for a given TempDirectory type, default True. T)rget)r!r$s r get_deletez$TempDirectoryTypeRegistry.get_delete3s"&&tT222r#rN) __name__ __module__ __qualname____doc__r"strboolr'r*r#rrr'sy))2222*s*4*D**** 3s3t333333r#r_tempdir_registryc#ZKt}ta tV|adS#|awxYw)zuProvides a scoped global tempdir registry that can be used to dictate whether directories should be deleted. N)r3r)old_tempdir_registrys rtempdir_registryr6=sJ -1331000000s &*ceZdZdS)_DefaultN)r,r-r.r2r#rr8r8KsDr#r8c eZdZdZdeddfdeedeede fdedeffd Z e d efd Z d efd Z d ed efdZdededed dfdZded efdZddZxZS)raMHelper class that owns and cleans up a temporary directory. This class can be used as a context manager or as an OO representation of a temporary directory. Attributes: path Location to the created temporary directory delete Whether the directory should be deleted when exiting (when used as a contextmanager) Methods: cleanup() Deletes the temporary directory When used as a context manager, if the delete attribute is True, on exiting the context the temporary directory is deleted. NtempFpathdeleter$globally_managedct|tur|d}nd}|||}||_d|_||_||_|r%tJt |dSdS)NF) superr"_default_create_path_deletedr<r$r enter_context)r!r;r<r$r= __class__s rr"zTempDirectory.__init__gs  X   <<<%%D     1#///  * *4 0 0 0 0 0 1 1r#rcB|jrJd|j|jS)Nz"Attempted to access deleted path: )rCrBr s rr;zTempDirectory.paths+=SS"Stz"S"SSSSzr#c2d|jjd|jdS)N< >)rEr,r;r s r__repr__zTempDirectory.__repr__s";4>*;;TY;;;;r#r!c|Srr2r s r __enter__zTempDirectory.__enter__s r#excr%tbc|j|j}n)tr t|j}nd}|r|dSdS)NT)r<r3r*r$cleanup)r!rNr%rOr<s r__exit__zTempDirectory.__exit__sZ ; "[FF  &11$)<t##"NNN  #s3,--.. # #A&D!1 # # !3!33d:t##"NNN  # # #r#r$c*tj|j\}}||D]}tj||} tj|tj|}nc#t$r }|j tj krYd}~}d}~wwxYwtjtj d|d}td||S)NrTrUrVrX)rYr;splitrfrxrsmkdirrZOSErrorerrnoEEXISTr[r\r]r^)r!r$rootrirvr;exs rrAzAdjacentTempDirectory._createsW]]4=11 d--d33 M MI7<<i00D  w''--    8u|++,++++ 7##H$4N4NNN$K$K$KLLD 6=== s B B?B::B?r)r,r-r.r/rrr0rr1r" classmethodrrxrArbrcs@rreres  &&M(((htn(((((((#3#9S$_+E###[#2CCr#re)"r}rploggingos.pathrYr[ contextlibrrtypingrrrrr r pip._internal.utils.miscr r getLoggerr,r]r tempdir_kindsr__annotations__rrr3r6r8r@rrer2r#rrs< 00000000AAAAAAAAAAAAAAAA11111111  8 $ $ WT))) ) )-(9%,,,3 *: ;333333333333&:>856=== 1)$=tT$IJ 1 1 1 1         8::[[[[[[[[|FFFFFMFFFFFr#