-ν
λΆ<c       s  d  Z  d Z d k Z d k l Z d k l Z d k l Z d d d d  Z	 d d d	  Z
 h  e	 d
 d f g d f d <e	 d
 d f g d f d <e	 d
 d
 f g d f d <e	 d
 e f g d f d <e
 g  d f d <Z d   Z e e 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,v 1.11 2001/12/06 20:51:35 fdrake Exp $N(   s   DistutilsExecError(   s   spawn(   s   mkpaths   gzipi    c 	   s  h  d d <d d <d d <} h  d g d <d g d <d g d <} | t j	 o | | i   j o t d	  n |  d
 } t t	 i
 i |  d | d | d d | | g } t | d | d | | o8 t | g | | | g d | d | | | | Sn | 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   .gzs   gzips   .bz2s   bzip2s   .Zs   compresss   -f9s   -fs=   bad value for 'compress': must be None, 'gzip', or 'compress's   .tars   verboses   dry_runs   tars   -cfN(   s   compress_exts   compress_flagss   compresss   Nones   keyss
   ValueErrors	   base_names   archive_names   mkpaths   oss   paths   dirnames   verboses   dry_runs   base_dirs   cmds   spawn(	   s	   base_names   base_dirs   compresss   verboses   dry_runs   archive_names   cmds   compress_flagss   compress_ext(    (    s,   /usr/lib/python2.2/distutils/archive_util.pys   make_tarball s    	 !* 
"c    s  |  d } t t i i |  d | d | y& t d d | | g d | d | Wn΅ t
 j
 o© y d k } Wn( t j
 o t
 d d d	 |  n X| o d
 | | f GHn d   } | o? | i | d d | i } t i i | | |  | i   n n X| Sd S(   su  Create a zip file from all the files under 'base_dir'.  The output
    zip file will be named 'base_dir' + ".zip".  Uses either the InfoZIP
    "zip" utility (if installed and found on the default search path) or
    the "zipfile" Python module (if available).  If neither tool is
    available, raises DistutilsExecError.  Returns the name of the output
    zip file.
    s   .zips   verboses   dry_runs   zips   -rqNs    unable to create zip file '%s': s0   could neither find a standalone zip utility nor s   import the 'zipfile' modules#   creating '%s' and adding '%s' to itc    s]   xV | D]N } t i i t i i | |   } t i i |  o |  i	 | |  n q Wd  S(   N(
   s   namess   names   oss   paths   normpaths   joins   dirnames   isfiles   zs   write(   s   zs   dirnames   namess   paths   name(    (    s,   /usr/lib/python2.2/distutils/archive_util.pys   visit` s
     !s   ws   compression(   s	   base_names   zip_filenames   mkpaths   oss   paths   dirnames   verboses   dry_runs   spawns   base_dirs   DistutilsExecErrors   zipfiles   ImportErrors   visits   ZipFiles   ZIP_DEFLATEDs   zs   walks   close(   s	   base_names   base_dirs   verboses   dry_runs   zs   zipfiles   visits   zip_filename(    (    s,   /usr/lib/python2.2/distutils/archive_util.pys   make_zipfile; s(     
"	s   compresss   gzip'ed tar-files   gztars   bzip2s   bzip2'ed tar-files   bztars   compressed tar files   ztars   uncompressed tar files   tars   ZIP files   zipc    s2   x+ |  D] } t i |  o | Sn q Wt Sd  S(   N(   s   formatss   formats   ARCHIVE_FORMATSs   has_keys   None(   s   formatss   format(    (    s,   /usr/lib/python2.2/distutils/archive_util.pys   check_archive_formatsz s
     c    s@  t  i   } | t j	 oC | o d | GHn t  i i |   }  | o t  i
 |  n n | t j o t  i } n h  | d <| d <} y t | } Wn  t j
 o t d |  n X| d } x" | d D] \ } }
 |
 | | <qΤ Wt | |  | f |  }	 | t j	 o% | o d | GHn t  i
 |  n |	 Sd S(	   st  Create an archive file (eg. zip or tar).  'base_name' is the name
    of the file to create, minus any format-specific extension; 'format'
    is the archive format: one of "zip", "tar", "ztar", or "gztar".
    'root_dir' is a directory that will be the root directory of the
    archive; ie. we typically chdir into 'root_dir' before creating the
    archive.  'base_dir' is the directory where we start archiving from;
    ie. 'base_dir' will be the common prefix of all files and
    directories in the archive.  'root_dir' and 'base_dir' both default
    to the current directory.  Returns the name of the archive file.
    s   changing into '%s's   verboses   dry_runs   unknown archive format '%s'i    i   s   changing back to '%s'N(   s   oss   getcwds   save_cwds   root_dirs   Nones   verboses   paths   abspaths	   base_names   dry_runs   chdirs   base_dirs   curdirs   kwargss   ARCHIVE_FORMATSs   formats   format_infos   KeyErrors
   ValueErrors   funcs   args   vals   applys   filename(   s	   base_names   formats   root_dirs   base_dirs   verboses   dry_runs   format_infos   save_cwds   args   filenames   vals   funcs   kwargs(    (    s,   /usr/lib/python2.2/distutils/archive_util.pys   make_archive s2     
 (   s   __doc__s   __revision__s   oss   distutils.errorss   DistutilsExecErrors   distutils.spawns   spawns   distutils.dir_utils   mkpaths   make_tarballs   make_zipfiles   Nones   ARCHIVE_FORMATSs   check_archive_formatss   make_archive(
   s   spawns   ARCHIVE_FORMATSs   __revision__s   DistutilsExecErrors   mkpaths   check_archive_formatss   make_zipfiles   make_tarballs   make_archives   os(    (    s,   /usr/lib/python2.2/distutils/archive_util.pys   ? s   	,7	