Ńň §ÚęLc @sýdZdZddkZddklZddklZddklZddk l Z dd d d „Z d d d „Z he dgd fd6e dgdfd6e dgdfd6e dgdfd6e gdfd6Zd„Zddd d d„ZdS(sodistutils.archive_util Utility functions for creating archive files (tarballs, zip files, that sort of thing).s>$Id: archive_util.py 83648 2010-08-03 07:51:50Z ezio.melotti $i˙˙˙˙N(tDistutilsExecError(tspawn(tmkpath(tlogtgzipic Csňhdd6dd6dd6}hdgd6dgd6dgd6}|dj o ||iƒjo td ‚n|d }ttii|ƒd |ƒd d ||g}t|d |ƒ|o/t|g|||gd |ƒ|||S|SdS(sŢCreate a (possibly compressed) tar file from all the files under 'base_dir'. 'compress' must be "gzip" (the default), "compress", "bzip2", or None. Both "tar" and the compression utility named by 'compress' must be on the default program search path, so this is probably Unix-specific. The output tar file will be named 'base_dir' + ".tar", possibly plus the appropriate compression extension (".gz", ".bz2" or ".Z"). Return the output filename. s.gzRs.bz2tbzip2s.Ztcompresss-f9s-fs=bad value for 'compress': must be None, 'gzip', or 'compress's.tartdry_runttars-cfN(tNonetkeyst ValueErrorRtostpathtdirnameR( t base_nametbase_dirRtverboseRt compress_exttcompress_flagst archive_nametcmd((s./usr/lib64/python2.6/distutils/archive_util.pyt make_tarballs$         c Cs‘yddk}Wntj o d}nX|d}ttii|ƒd|ƒ|djo^|o d}nd}y td|||gd|ƒWqtj otd|‚qXnŃt i d ||ƒ|pś|i |d d |i ƒ}xŠti |ƒD]y\}} } xg| D]_} tiitii|| ƒƒ} tii| ƒo%|i| | ƒt i d | ƒqqWqW|iƒn|S( sqCreate a zip file from all the files under 'base_dir'. The output zip file will be named 'base_dir' + ".zip". Uses either the "zipfile" Python module (if available) or the InfoZIP "zip" utility (if installed and found on the default search path). If neither tool is available, raises DistutilsExecError. Returns the name of the output zip file. i˙˙˙˙Ns.zipRs-rs-rqtzipskunable to create zip file '%s': could neither import the 'zipfile' module nor find a standalone zip utilitys#creating '%s' and adding '%s' to ittwt compressions adding '%s'(tzipfilet ImportErrorR RR R RRRRtinfotZipFilet ZIP_DEFLATEDtwalktnormpathtjointisfiletwritetclose( RRRRRt zip_filenamet zipoptionstztdirpathtdirnamest filenamestnameR ((s./usr/lib64/python2.6/distutils/archive_util.pyt make_zipfile<s@        !Rsgzip'ed tar-filetgztarRsbzip2'ed tar-filetbztarscompressed tar filetztarsuncompressed tar fileRsZIP fileRcCs+x$|D]}|tjo|SqWdSdS(N(tARCHIVE_FORMATSR (tformatstformat((s./usr/lib64/python2.6/distutils/archive_util.pytcheck_archive_formats{s   c Cs<tiƒ}|dj o>tid|ƒtii|ƒ}|pti|ƒqWn|djo ti}nh|d6}yt |}Wn t j ot d|‚nX|d} x"|dD]\} } | || s$ +7