ó ïRec@@sÛdZddlmZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z m Z mZmZddlmZddlmZerñddlmZmZmZmZmZdd lmZnejeƒZee ZyddlZee 7ZWne k rDej!d ƒnXyddl"Z"ee7ZWne k rej!d ƒnXd „Z#d „Z$d„Z%d„Z&d„Z'd„Z(e)d„Z*d„Z+dd„Z-dS(sUtilities related archives. i(tabsolute_importN(tInstallationError(tBZ2_EXTENSIONStTAR_EXTENSIONSt XZ_EXTENSIONStZIP_EXTENSIONS(t ensure_dir(tMYPY_CHECK_RUNNING(tIterabletListtOptionaltTexttUnion(tZipInfosbz2 module is not availableslzma module is not availablecC@s tjdƒ}tj|ƒ|S(sBGet the current umask which involves having to set it temporarily.i(tostumask(tmask((sŒ/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pyt current_umask/s cC@s”|jdƒjdƒ}d|krjd|krN|jdƒ|jdƒksZd|krj|jddƒSd|kr†|jddƒS|dgSdS(Nt/s\it(tlstriptfindtsplit(tpath((sŒ/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pytsplit_leading_dir7s *  cC@s\d}xO|D]G}t|ƒ\}}|s/tS|dkrD|}q ||kr tSq WtS(syReturns true if all the paths have the same leading path name (i.e., everything is in one subdirectory in an archive)N(tNoneRtFalsetTrue(tpathst common_prefixRtprefixtrest((sŒ/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pythas_leading_dirGs    cC@sFtjj|ƒ}tjj|ƒ}tjj||gƒ}||kS(sL Return true if the absolute path of target is within the directory (RRtabspatht commonprefix(t directoryttargett abs_directoryt abs_targetR((sŒ/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pytis_within_directoryWscC@s tj|dtƒ@dBƒdS(sx Make file present at path have execute for user/group/world (chmod +x) is no-op on windows per python docs iÿiIN(RtchmodR(R((sŒ/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pyt2set_extracted_file_to_default_mode_plus_executablecscC@s0|jd?}t|o,tj|ƒo,|d@ƒS(NiiI(t external_attrtbooltstattS_ISREG(tinfotmode((sŒ/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pytzip_item_is_executablels c C@sŒt|ƒt|dƒ}zatj|dtƒ}t|jƒƒoF|}x-|jƒD]}|j}|}|r„t |ƒd}nt j j ||ƒ}t j j |ƒ} t||ƒsÞd} t| j|||ƒƒ‚n|jdƒsü|jdƒr t|ƒqVt| ƒ|j|ƒ} z,t|dƒ} tj| | ƒWdQXWd| jƒt|ƒrtt|ƒnXqVWWd|jƒXdS( sŸ Unzip 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. trbt allowZip64isQThe zip file ({}) has a file ({}) trying to install outside target directory ({})Rs\twbN(RtopentzipfiletZipFileRR tnamelisttinfolisttfilenameRRRtjointdirnameR'Rtformattendswithtshutilt copyfileobjtcloseR0R)( R9tlocationtflattentzipfptziptleadingR.tnametfntdirtmessagetfptdestfp((sŒ/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pyt unzip_filets4      c C@s»t|ƒ|jƒjdƒs4|jƒjdƒr=d}np|jƒjtƒr[d}nR|jƒjtƒryd}n4|jƒjdƒr—d}ntjd|ƒd }tj||ƒ}zêt g|j ƒD]}|j ^qÒƒ}x»|j ƒD]­}|j }|rt |ƒd }nt jj||ƒ}t||ƒsgd }t|j|||ƒƒ‚n|jƒr€t|ƒq÷|jƒrÕy|j||ƒWq¤tk rÑ} tjd ||j | ƒq÷q¤Xq÷y|j|ƒ} Wn5ttfk r} tjd ||j | ƒq÷nXtt jj|ƒƒ| dk sHt‚t|d ƒ} tj| | ƒWdQX| jƒ|j ||ƒ|j!d@r÷t"|ƒq÷q÷WWd|jƒXdS(sŸ 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. s.gzs.tgzsr:gzsr:bz2sr:xzs.tartrs-Cannot determine compression type for file %ssr:*isQThe tar file ({}) has a file ({}) trying to install outside target directory ({})s/In the tar file %s the member %s is invalid: %sR3NiI(#RtlowerR=RRtloggertwarningttarfileR4R t getmembersRFRRRR:R'RR<tisdirtissymt_extract_membert Exceptiont extractfiletKeyErrortAttributeErrorR;RtAssertionErrorR>R?R@tutimeR/R)( R9RAR/ttartmemberRERGRRItexcRJRK((sŒ/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pyt untar_file£sf *     %       cC@sÙtjj|ƒ}|dksB|jƒjtƒsBtj|ƒrbt||d|jdƒ ƒns|dksšt j |ƒsš|jƒjt t t ƒrªt||ƒn+tjd|||ƒtdj|ƒƒ‚dS(Nsapplication/zipRBs.whlsapplication/x-gzipsZCannot unpack file %s (downloaded from %s, content-type: %s); cannot detect archive formats%Cannot determine archive format of {}(RRtrealpathRNR=RR5t is_zipfileRLRQt is_tarfileRRRR_ROtcriticalRR<(R9RAt content_type((sŒ/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pyt unpack_fileös$    (.t__doc__t __future__RtloggingRR>R,RQR5tpip._internal.exceptionsRtpip._internal.utils.filetypesRRRRtpip._internal.utils.miscRtpip._internal.utils.typingRttypingRR R R R R t getLoggert__name__ROtSUPPORTED_EXTENSIONStbz2t ImportErrortdebugtlzmaRRR R'R)R0RRLR_RRe(((sŒ/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pytsF      "(          / V