Your IP : 18.117.168.40


Current Path : /opt/alt/python33/lib64/python3.3/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/distutils/__pycache__/archive_util.cpython-33.pyc

�
��f�c@sJdZddlZddlmZddlZyddlZWnek
rXdZYnXddlm	Z	ddl
mZddlm
Z
ddlmZdddd	d
�Zdddd�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|�tdkr�|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 ituwucompressionuadding '%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�td|��YnX|d}	x"|dD]\}
}|||
<q�Wz|	|||�}Wd|dk	rtjd|�tj|�nX|S(uyCreate 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.
    uchanging into '%s'udry_runuunknown archive format '%s'iiNuchanging back to '%s'(uosugetcwduNoneulogudebugupathuabspathuchdirucurdiruARCHIVE_FORMATSuKeyErroru
ValueError(
u	base_nameuformaturoot_dirubase_diruverboseudry_runusave_cwdukwargsuformat_infoufuncuarguvalufilename((u;/opt/alt/python33/lib64/python3.3/distutils/archive_util.pyumake_archive�s,


umake_archive(ucompressugzip(ucompressubzip2(ucompressucompress(ucompressN(u__doc__uosuwarningsuwarnusysuzipfileuImportErroruNoneudistutils.errorsuDistutilsExecErrorudistutils.spawnuspawnudistutils.dir_utilumkpathu	distutilsulogumake_tarballumake_zipfileuARCHIVE_FORMATSucheck_archive_formatsumake_archive(((u;/opt/alt/python33/lib64/python3.3/distutils/archive_util.pyu<module>s,
34
	

?>