3 ”Re%ã@stdZddlmZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z m Z mZmZddlmZddlmZer¨ddlmZmZmZmZmZdd lmZejeƒZee ZyddlZee 7ZWne k rìej!d ƒYnXyddl"Z"ee7ZWn e k �r"ej!d ƒYnXd d „Z#dd„Z$dd„Z%dd„Z&dd„Z'dd„Z(ddd„Z)dd„Z*d dd„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ÚUnion)ÚZipInfozbz2 module is not availablezlzma module is not availablecCstjdƒ}tj|ƒ|S)zBGet the current umask which involves having to set it temporarily.r)ÚosÚumask)Úmask©rúŒ/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/utils/unpacking.pyÚ current_umask/s  rcCsh|jdƒjdƒ}d|krHd|kr4|jdƒ|jdƒksÚlocationÚflattenÚzipfpÚzipÚleadingr3ÚnameÚfnÚdirÚmessageÚfpÚdestfprrrÚ unzip_filets4         rQc Cs$t|ƒ|jƒjdƒs$|jƒjdƒr*d}nL|jƒjtƒr>d}n8|jƒjtƒrRd}n$|jƒjdƒrfd}ntjd|ƒd }tj||ƒ}�z�t d d „|j ƒDƒƒ}�xr|j ƒD�]d}|j }|rÄt |ƒd }t jj||ƒ}t||ƒsòd }t|j|||ƒƒ‚|jƒ�rt|ƒq¨|jƒ�r\y|j||ƒWn8tk �rX} ztjd||j | ƒw¨WYdd} ~ XnXq¨y|j|ƒ} Wn<ttfk �r¦} ztjd||j | ƒw¨WYdd} ~ XnXtt jj|ƒƒ| dk �sÆt‚t|dƒ�} tj| | ƒWdQRX| jƒ|j||ƒ|j d@r¨t!|ƒq¨WWd|jƒ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)rK)Ú.0Úmemberrrrú ¾szuntar_file..rzQThe tar file ({}) has a file ({}) trying to install outside target directory ({})z/In the tar file %s the member %s is invalid: %sNr8r+)"rÚlowerrBrrÚloggerÚwarningÚtarfiler9r#Ú getmembersrKrrrr?r*rrAÚisdirÚissymÚ_extract_memberÚ ExceptionÚ extractfileÚKeyErrorÚAttributeErrorr@ÚAssertionErrorrCrDrEÚutimer4r-) r>rFr4ÚtarrJrTrLrrNÚexcrOrPrrrÚ untar_file£sf            rfcCsštjj|ƒ}|dks,|jƒjtƒs,tj|ƒrDt|||jdƒ d�nR|dkslt j |ƒsl|jƒjt t t ƒrxt||ƒntjd|||ƒtdj|ƒƒ‚dS)Nzapplication/zipz.whl)rGzapplication/x-gzipzZCannot unpack file %s (downloaded from %s, content-type: %s); cannot detect archive formatz%Cannot determine archive format of {})rrÚrealpathrVrBrr:Ú is_zipfilerQrYÚ is_tarfilerrrrfrWÚcriticalrrA)r>rFÚ content_typerrrÚ unpack_fileös$     rl)T)N),Ú__doc__Ú __future__rÚloggingrrCr1rYr:Úpip._internal.exceptionsrÚpip._internal.utils.filetypesrrrrÚpip._internal.utils.miscrÚpip._internal.utils.typingr Útypingr r r r rrÚ getLoggerÚ__name__rWÚSUPPORTED_EXTENSIONSÚbz2Ú ImportErrorÚdebugÚlzmarrr#r*r-r5rQrfrlrrrrÚsF           /V