Ńň §ÚęLc @ sý d Z d Z d d k Z d d k l Z d d k l Z d d k l Z d d k l Z d d d d Z d d d Z h e d g d f d 6e d g d f d 6e d g d f d 6e d g d f d 6e g d f d 6Z d Z d d d d d Z d S( so distutils.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( t DistutilsExecError( t spawn( t mkpath( t logt gzipi c C sň h d d 6d d 6d d 6} h d g d 6d g d 6d g d 6} | d j o | | i j o t d n | d } t t i i | d | d d | | g } t | d | | o/ t | g | | | g d | | | | S| Sd S( 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 .gzR s .bz2t bzip2s .Zt compresss -f9s -fs= bad value for 'compress': must be None, 'gzip', or 'compress's .tart dry_runt tars -cfN( t Nonet keyst ValueErrorR t ost patht dirnameR ( t base_namet base_dirR t verboseR t compress_extt compress_flagst archive_namet cmd( ( s. /usr/lib64/python2.6/distutils/archive_util.pyt make_tarball s$ c C s y d d k } Wn t j o d } n X| d } t t i i | d | | d j o^ | o d } n d } y t d | | | g d | Wqt j o t d | qXnŃ t i d | | | pś | i | d d | i } x t i | D]y \ } } } xg | D]_ } t i i t i i | | } t i i | o% | i | | t i d | qqWqW| i n | S( sq Create 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 .zipR s -rs -rqt zipsk unable to create zip file '%s': could neither import the 'zipfile' module nor find a standalone zip utilitys# creating '%s' and adding '%s' to itt wt compressions adding '%s'( t zipfilet ImportErrorR R R R R R R R t infot ZipFilet ZIP_DEFLATEDt walkt normpatht joint isfilet writet close( R R R R R t zip_filenamet zipoptionst zt dirpatht dirnamest filenamest nameR ( ( s. /usr/lib64/python2.6/distutils/archive_util.pyt make_zipfile<