ž {yMa³c@sJdZddlZddlmZddlZyddlZWnek rXdZYnXddlm Z ddl m Z ddl m Z ddlmZdddd d „Zddd d „Ziedgdfd6edgdfd6edgdfd6ed gdfd6egdfd6Zdd„Zdddddd„ZdS(!uodistutils.archive_util Utility functions for creating archive files (tarballs, zip files, that sort of thing).iN(uwarn(uDistutilsExecError(uspawn(umkpath(ulogugzipc Csidd6dd6dd6dd6}idd6dd6d d6}|dk rj||jƒkrjtd ƒ‚n|d }|dkr™||j|dƒ7}nttjj|ƒd |ƒd dl}t j dƒ|s|j |d||ƒ} z| j |ƒWd| j ƒXn|dkr{tdtƒ|||} tjdkrX||| g} n|d|g} t| d |ƒ| S|S(uα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"). Returns the output filename. ugzugzipubz2ubzip2uucompressu.gzu.bz2u.ZuEbad value for 'compress': must be None, 'gzip', 'bzip2' or 'compress'u.tarudry_runiNuCreating tar archiveuw|%su'compress' will be deprecated.uwin32u-f(uNoneukeysu ValueErrorugetumkpathuosupathudirnameutarfileuloguinfouopenuadducloseuwarnuPendingDeprecationWarningusysuplatformuspawn( u base_nameubase_dirucompressuverboseudry_runutar_compressionu compress_extu archive_nameutarfileutarucompressed_nameucmd((u;/opt/alt/python33/lib64/python3.3/distutils/archive_util.pyu make_tarballs2 "       u make_tarballc Cs“|d}ttjj|ƒd|ƒtd kr|rAd}nd}y td|||gd|ƒWqtk r‹td|ƒ‚YqXntj d||ƒ|sytj |dd tj ƒ}Wn-t k rφtj |dd tj ƒ}YnXxˆtj|ƒD]w\}}} xe| D]]} tjjtjj|| ƒƒ} tjj| ƒr|j| | ƒtj d | ƒqqWqW|jƒn|S( uvCreate a zip file from all the files under 'base_dir'. The output zip file will be named 'base_name' + ".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. u.zipudry_runu-ru-rquzipukunable to create zip file '%s': could neither import the 'zipfile' module nor find a standalone zip utilityu#creating '%s' and adding '%s' to ituwu compressionu adding '%s'N(umkpathuosupathudirnameuzipfileuNoneuspawnuDistutilsExecErroruloguinfouZipFileu ZIP_DEFLATEDu RuntimeErroru ZIP_STOREDuwalkunormpathujoinuisfileuwriteuclose( u base_nameubase_diruverboseudry_runu zip_filenameu zipoptionsuzipudirpathudirnamesu filenamesunameupath((u;/opt/alt/python33/lib64/python3.3/distutils/archive_util.pyu make_zipfileHs:         ! u make_zipfileucompressugzip'ed tar-fileugztarubzip2ubzip2'ed tar-fileubztarucompressed tar fileuztaruuncompressed tar fileutaruZIP fileuzipcCs%x|D]}|tkr|SqWdS(uqReturns the first format from the 'format' list that is unknown. If all formats are known, returns None N(uARCHIVE_FORMATSuNone(uformatsuformat((u;/opt/alt/python33/lib64/python3.3/distutils/archive_util.pyucheck_archive_formats„s  ucheck_archive_formatsc Cs$tjƒ}|dk rStjd|ƒtjj|ƒ}|sStj|ƒqSn|dkrktj}ni|d6}yt |}Wn"t k rͺt d|ƒ‚YnX|d} x"|dD]\} } | || s,    34