a Re@sUddlZddlZddlZddlZddlZddlmZmZddl m Z m Z m Z m Z mZmZddlmZmZeeZedddZedd d d Zdae eed <ee dd ddZGdddZdae eed<ee ed ddZGdddZeZGdddZ Gddde Z!dS)N) ExitStackcontextmanager)AnyDictIteratorOptionalTypeVarUnion)enumrmtree_T TempDirectory)boundz build-envzephem-wheel-cachez req-build) BUILD_ENVEPHEM_WHEEL_CACHE REQ_BUILD_tempdir_managerreturnccsJt0}t|}azdVW|an|a0Wdn1s<0YdSN)rr)stackold_tempdir_managerr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/temp_dir.pyglobal_tempdir_managers  rc@s@eZdZdZddddZeeddddZeed d d ZdS) TempDirectoryTypeRegistryzManages temp directory behaviorNrcCs i|_dSr_should_deleteselfrrr__init__*sz"TempDirectoryTypeRegistry.__init__)kindvaluercCs||j|<dS)z[Indicate whether a TempDirectory of the given kind should be auto-deleted. Nr)rr!r"rrr set_delete-sz$TempDirectoryTypeRegistry.set_deleter!rcCs|j|dS)z^Get configured auto-delete flag for a given TempDirectory type, default True. T)rget)rr!rrr get_delete3sz$TempDirectoryTypeRegistry.get_delete) __name__ __module__ __qualname____doc__r strboolr#r&rrrrr'sr_tempdir_registryccs$t}taztVW|an|a0dS)zuProvides a scoped global tempdir registry that can be used to dictate whether directories should be deleted. N)r-r)old_tempdir_registryrrrtempdir_registry=s r/c@s eZdZdS)_DefaultN)r'r(r)rrrrr0Ksr0cseZdZdZdeddfeeeede feedfdd Z e edd d Z edd d Z eed ddZeeeddddZeedddZddddZZS)r aMHelper 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. NtempF)pathdeleter!globally_managedcslt|tur$|dur d}nd}|dur6||}||_d|_||_||_|rhtdus^Jt |dS)NF) superr _default_create_path_deletedr3r!r enter_context)rr2r3r!r4 __class__rrr gs   zTempDirectory.__init__rcCs|jrJd|j|jS)Nz"Attempted to access deleted path: )r9r8rrrrr2szTempDirectory.pathcCsd|jjd|jdS)N< >)r<r'r2rrrr__repr__szTempDirectory.__repr__)rrcCs|Srrrrrr __enter__szTempDirectory.__enter__)excr"tbrcCs8|jdur|j}ntr$t|j}nd}|r4|dS)NT)r3r-r&r!cleanup)rrBr"rCr3rrr__exit__s zTempDirectory.__exit__r$cCs,tjtjd|dd}td||S)zs2      ^