B š•Re%ã@stdZddlmZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z m Z mZmZddlmZddlmZer¨ddlmZmZmZmZmZdd lmZe e¡Zee ZyddlZee 7ZWne k rìe !d ¡YnXyddl"Z"ee7ZWn e k r"e !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 availablecCst d¡}t |¡|S)zBGet the current umask which involves having to set it temporarily.r)ÚosÚumask)Úmask©rúŒ/builddir/build/BUILDROOT/alt-python37-pip-20.2.4-6.el8.x86_64/opt/alt/python37/lib/python3.7/site-packages/pip/_internal/utils/unpacking.pyÚ current_umask/s  rcCsh| d¡ d¡}d|krHd|kr4| d¡| d¡ksÚlocationÚflattenÚzipfpÚzipÚleadingr3ÚnameÚfnÚdirÚmessageÚfpÚdestfprrrÚ unzip_filets4         rQc Cs$t|ƒ| ¡ d¡s$| ¡ d¡r*d}nL| ¡ t¡r>d}n8| ¡ t¡rRd}n$| ¡ d¡rfd}nt d|¡d }t ||¡}zt d d „|  ¡Dƒƒ}xr|  ¡D]d}|j }|rÄt |ƒd }t j ||¡}t||ƒsòd }t| |||¡ƒ‚| ¡rt|ƒq¨| ¡r\y| ||¡Wn8tk rX} zt d||j | ¡w¨Wdd} ~ XYnXq¨y| |¡} Wn<ttfk r¦} zt d||j | ¡w¨Wdd} ~ XYnXtt j |¡ƒ| dk sÆt‚t|dƒ} t | | ¡WdQRX|  ¡| ||¡|j d@r¨t!|ƒq¨WWd| ¡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štj |¡}|dks,| ¡ t¡s,t |¡rDt||| d¡ dnR|dkslt   |¡sl| ¡ t t t ¡rxt||ƒnt d|||¡td |¡ƒ‚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