U ʗRe@s$UddlZddlZddlZddlZddlZddlmZmZddl m Z m Z m Z m Z mZmZddlmZmZeeZedddZedd d d Zdae eed <ee d dddZGdddZdae eed<ee eddfdddZGdddZeZGdddZ Gddde Z!dS)N) ExitStackcontextmanager)AnyDict GeneratorOptionalTypeVarUnion)enumrmtree_T TempDirectory)boundz build-envzephem-wheel-cachez req-build) BUILD_ENVEPHEM_WHEEL_CACHE REQ_BUILD_tempdir_manager)NNNreturnc cs2t"}t|}az dVW5|aXW5QRXdSN)rr)stackold_tempdir_managerr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/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}taz tVW5|aXdS)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|tkr$|dk r d}nd}|dkr6||}||_d|_||_||_|rhtdk s^t t |dS)NF) superr _default_create_path_deletedr3r!rAssertionError enter_context)rr2r3r!r4 __class__rrr gs   zTempDirectory.__init__rcCs|jrtd|j|jS)Nz"Attempted to access deleted path: )r9r:r8rrrrr2szTempDirectory.pathcCsd|jjd|jdS)N< >)r=r'r2rrrr__repr__szTempDirectory.__repr__)rrcCs|Srrrrrr __enter__szTempDirectory.__enter__)excr"tbrcCs8|jdk r|j}ntr$t|j}nd}|r4|dS)NT)r3r-r&r!cleanup)rrCr"rDr3rrr__exit__s zTempDirectory.__exit__r$cCs,tjtjd|dd}td||S)zs4     ^