U ÀÒ.eÒ%ã@sXdZddlmZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z m Z mZmZddlmZddlmZerœddlmZmZmZmZmZe e¡Zee ZzddlZee 7ZWnek ràe  d ¡YnXzddl!Z!ee7ZWn ek re  d ¡YnXd d „Z"d d„Z#dd„Z$dd„Z%ddd„Z&dd„Z'ddd„Z(dS)zUtilities related archives. é)Úabsolute_importN)ÚInstallationError)ÚBZ2_EXTENSIONSÚTAR_EXTENSIONSÚ XZ_EXTENSIONSÚZIP_EXTENSIONS)Ú ensure_dir)ÚMYPY_CHECK_RUNNING)ÚIterableÚListÚOptionalÚTextÚUnionzbz2 module is not availablezlzma module is not availablecCst d¡}t |¡|S)zBGet the current umask which involves having to set it temporarily.r)ÚosÚumask)Úmask©rúA/usr/lib/python3.8/site-packages/pip/_internal/utils/unpacking.pyÚ current_umask2s  rcCsh| d¡ d¡}d|krHd|kr4| d¡| d¡ksd}n8| ¡ t¡rRd}n$| ¡ d¡rfd}nt d|¡d }t ||¡}zÈt d d „|  ¡Dƒƒ}|  ¡D]¢}|j }|rÀt |ƒd }tj ||¡}t||ƒsîd }t| |||¡ƒ‚zt |j|d|¡Wntjk rYnX| ¡r4t|ƒq¤| ¡rz| ||¡Wn>tk rŒ} zt d||j | ¡WY¢q¤W5d} ~ XYnXq¤z| |¡} WnBttfk rà} zt d||j | ¡WY¢q¤W5d} ~ XYnXttj |¡ƒt|dƒ} t  | | ¡W5QRX|   ¡| !||¡|j"d@r¤t #|dt$ƒdB¡q¤W5|  ¡XdS)aŸ Untar the file (with path `filename`) to the destination `location`. All files are written based on system defaults and umask (i.e. permissions are not preserved), except that regular file members with any execute permissions (user, group, or world) have "chmod +x" applied after being written. Note that for windows, any execute changes using os.chmod are no-ops per the python docs. z.gzz.tgzzr:gzzr:bz2zr:xzz.tarÚrz-Cannot determine compression type for file %szr:*cSsg|] }|j‘qSr©r=)Ú.0ÚmemberrrrÚ ³szuntar_file..rzQThe tar file ({}) has a file ({}) trying to install outside target directory ({})rFz/In the tar file %s the member %s is invalid: %sNr*r(r))%rÚlowerr2rrÚloggerZwarningÚtarfiler+r,r!Z getmembersr=rrrr/r%rr1Z data_filterÚreplaceZLinkOutsideDestinationErrorÚisdirZissymZ_extract_memberÚ ExceptionZ extractfileÚKeyErrorÚAttributeErrorr0r6r7ÚutimerBr5r) r.r8rBZtarr;rHr>rr@ÚexcrArCrrrÚ untar_file™s‚ ÿ ÿ  ÿ ÿ   þþ   rTcCsštj |¡}|dks,| ¡ t¡s,t |¡rDt||| d¡ dnR|dkslt   |¡sl| ¡ t t t ¡rxt||ƒnt d|||¡td |¡ƒ‚dS)Nzapplication/zipz.whl)r9zapplication/x-gzipzZCannot unpack file %s (downloaded from %s, content-type: %s); cannot detect archive formatz%Cannot determine archive format of {})rrÚrealpathrJr2rr-Z is_zipfilerDrLZ is_tarfilerrrrTrKZcriticalrr1)r.r8Z content_typerrrÚ unpack_fileôs< ÿ þý ýÿþ ÿý ýÿrV)T)N))Ú__doc__Z __future__rZloggingrr6r3rLr-Zpip._internal.exceptionsrZpip._internal.utils.filetypesrrrrZpip._internal.utils.miscrZpip._internal.utils.typingr Útypingr r r r rZ getLoggerÚ__name__rKZSUPPORTED_EXTENSIONSÚbz2Ú ImportErrorÚdebugZlzmarrr!r%rDrTrVrrrrÚsB        4^ý