3 Re%@stdZddlmZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z m Z mZmZddlmZddlmZerddlmZmZmZmZmZdd lmZejeZee ZyddlZee 7ZWne k rej!d YnXyddl"Z"ee7ZWn e k r"ej!d YnXd d Z#ddZ$ddZ%ddZ&ddZ'ddZ(dddZ)ddZ*d ddZ+dS)!zUtilities related archives. )absolute_importN)InstallationError)BZ2_EXTENSIONSTAR_EXTENSIONS XZ_EXTENSIONSZIP_EXTENSIONS) ensure_dir)MYPY_CHECK_RUNNING)IterableListOptionalTextUnion)ZipInfozbz2 module is not availablezlzma module is not availablecCstjd}tj||S)zBGet the current umask which involves having to set it temporarily.r)osumask)maskr/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el9.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/utils/unpacking.py current_umask/s  rcCsh|jdjd}d|krHd|kr4|jd|jdkslocationflattenzipfpzipleadingr3namefndirmessagefpdestfprrr unzip_filets4         rQc Cs$t||jjds$|jjdr*d}nL|jjtr>d}n8|jjtrRd}n$|jjdrfd}ntjd|d }tj||}zt d d |j D}xr|j D]d}|j }|rt |d }t jj||}t||sd }t|j||||jrt|q|jr\y|j||Wn8tk rX} ztjd||j | wWYdd} ~ XnXqy|j|} Wn<ttfk r} ztjd||j | wWYdd} ~ XnXtt jj|| dk stt|d} tj| | WdQRX| j|j|||j d@rt!|qWWd|jXdS)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.tarrz-Cannot determine compression type for file %szr:*cSsg|] }|jqSr)rK).0memberrrr 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+)"rlowerrBrrloggerwarningtarfiler9r# getmembersrKrrrr?r*rrAisdirissym_extract_member Exception extractfileKeyErrorAttributeErrorr@AssertionErrorrCrDrEutimer4r-) r>rFr4tarrJrTrLrrNexcrOrPrrr untar_filesf            rfcCstjj|}|dks,|jjts,tj|rDt|||jd dnR|dkslt j |sl|jjt 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 {})rrrealpathrVrBrr: is_zipfilerQrY is_tarfilerrrrfrWcriticalrrA)r>rF content_typerrr unpack_files$     rl)T)N),__doc__ __future__rloggingrrCr1rYr:pip._internal.exceptionsrpip._internal.utils.filetypesrrrrpip._internal.utils.miscrpip._internal.utils.typingr typingr r r r rr getLogger__name__rWSUPPORTED_EXTENSIONSbz2 ImportErrordebuglzmarrr#r*r-r5rQrfrlrrrrsF           /V