U e5d|!@s@ddlZddlmZddlZz ddlZWnek r@dZYnXddlmZddlm Z ddl m Z ddl m Z zddlmZWnek rdZYnXzddlmZWnek rdZYnXd d Zd d Zd"ddZd#ddZedgdfedgdfedgdfedgdfedgdfegdfdZddZd$d d!ZdS)%N)warn)DistutilsExecError)spawn)mkpath)log)getpwnam)getgrnamcCsNtdks|dkrdSz t|}Wntk r8d}YnX|dk rJ|dSdSN)rKeyErrornameresultr./usr/lib64/python3.8/distutils/archive_util.py_get_gids  rcCsNtdks|dkrdSz t|}Wntk r8d}YnX|dk rJ|dSdSr )rr r rrr_get_uid+s  rgzipcs.dddddd}dddd d }|dk r:||kr:td |d } |d krZ| ||d7} ttj| |dddl} t dt t fdd} |s| | d||} z| j|| dW5| X|d kr*tdt| ||} tjdkr|| | g}n |d| g}t||d| S| S)NZgzbz2xz)rbzip2rNcompressz.gzz.bz2z.xzz.Z)rrrrzKbad value for 'compress': must be None, 'gzip', 'bzip2', 'xz' or 'compress'z.tarrdry_runrzCreating tar archivecs,dk r|_|_dk r(|_|_|SN)gidZgnameuiduname)Ztarinforgroupownerrrr _set_uid_gidasz"make_tarball.._set_uid_gidzw|%s)filterz'compress' will be deprecated.Zwin32z-f)keys ValueErrorgetrospathdirnametarfilerinforropencloseaddrPendingDeprecationWarningsysplatformr) base_namebase_dirrverboserr!r Ztar_compressionZ compress_extZ archive_namer*r"tarZcompressed_namecmdrrr make_tarball7sB          r7c Cs|d}ttj||dtdkrp|r.d}nd}ztd|||g|dWn tk rjtd|YnXn8td|||sztj |dtj d }Wn&t k rtj |dtj d }YnX||tj krtjtj|d }|||td |t|D]\}} } | D]6} tjtj|| d }|||td |q| D]B} tjtj|| }tj|rV|||td |qVq W5QRX|S) Nz.ziprz-rz-rqzipzkunable to create zip file '%s': could neither import the 'zipfile' module nor find a standalone zip utilityz#creating '%s' and adding '%s' to itw)Z compressionrz adding '%s')rr'r(r)zipfilerrrr+ZZipFileZ ZIP_DEFLATED RuntimeErrorZ ZIP_STOREDcurdirnormpathjoinwritewalkisfile) r2r3r4rZ zip_filenameZ zipoptionsr8r(dirpathZdirnames filenamesr rrr make_zipfilesV          rD)rrzgzip'ed tar-file)rrzbzip2'ed tar-file)rrzxz'ed tar-file)rrzcompressed tar file)rNzuncompressed tar filezZIP file)ZgztarZbztarZxztarZztarr5r8cCs|D]}|tkr|SqdSr)ARCHIVE_FORMATS)Zformatsformatrrrcheck_archive_formatss rGc Cst}|dk r6td|tj|}|s6t||dkrDtj}d|i} z t|} Wn t k rxt d|YnX| d} | dD]\} } | | | <q|dkr|| d<|| d<z| ||f| }W5|dk rtd |t|X|S) Nzchanging into '%s'rzunknown archive format '%s'rr8r!r zchanging back to '%s') r'getcwdrdebugr(abspathchdirr<rEr r%)r2rFZroot_dirr3r4rr!r Zsave_cwdkwargsZ format_infofuncargvalfilenamerrr make_archives2       rR)rrrNN)rr)NNrrNN)r'warningsrr0r: ImportErrorZdistutils.errorsrZdistutils.spawnrZdistutils.dir_utilrZ distutilsrpwdrZgrprrrr7rDrErGrRrrrrsL            H =