ok
Direktori : /lib64/python3.6/distutils/__pycache__/ |
Current File : //lib64/python3.6/distutils/__pycache__/archive_util.cpython-36.pyc |
3 \F! � @ sD d Z ddlZddlmZ ddlZyddlZW n ek rD dZY nX ddlmZ ddl m Z ddlmZ ddl mZ yddlmZ W n ek r� dZY nX ydd lmZ W n ek r� dZY nX d d� Zdd � Zd!dd�Zd"dd�Zed#gdfed$gdfed%gdfed&gdfed'gdfeg dfd�Zdd� Zd(dd �ZdS ))zodistutils.archive_util Utility functions for creating archive files (tarballs, zip files, that sort of thing).� N)�warn)�DistutilsExecError)�spawn)�mkpath)�log)�getpwnam)�getgrnamc C sN t dks| dkrdS yt | �}W n tk r8 d}Y nX |dk rJ|d S dS )z"Returns a gid, given a group name.N� )r �KeyError)�name�result� r �./usr/lib64/python3.6/distutils/archive_util.py�_get_gid s r c C sN t dks| dkrdS yt | �}W n tk r8 d}Y nX |dk rJ|d S dS )z"Returns an uid, given a user name.Nr )r r )r r r r r �_get_uid+ s r �gzipc s. dddddd�}dddd d �}|dk r:||j � kr:td��| d } |dkrZ| |j|d�7 } ttjj| �|d� ddl} tj d� t ���t��� � ���fdd�}|s�| j| d|| �}z|j ||d� W d|j� X |dk�r*tdt� | || } tjdk�r|| | g}n |d| g}t||d� | S | S )a= Create a (possibly compressed) tar file from all the files under 'base_dir'. 'compress' must be "gzip" (the default), "bzip2", "xz", "compress", or None. ("compress" will be deprecated in Python 3.2) 'owner' and 'group' can be used to define an owner and a group for the archive that is being built. If not provided, the current owner and group will be used. The output tar file will be named 'base_dir' + ".tar", possibly plus the appropriate compression extension (".gz", ".bz2", ".xz" or ".Z"). Returns the output filename. Zgz�bz2�xz� )r �bzip2r N�compressz.gzz.bz2z.xzz.Z)r r r r NzKbad value for 'compress': must be None, 'gzip', 'bzip2', 'xz' or 'compress'z.tarr )�dry_runr zCreating tar archivec s, � d k r� | _ �| _�d k r(�| _�| _| S )N)�gidZgname�uid�uname)Ztarinfo)r �group�ownerr r r �_set_uid_gida s z"make_tarball.<locals>._set_uid_gidzw|%s)�filterz'compress' will be deprecated.Zwin32z-f)�keys� ValueError�getr �os�path�dirname�tarfiler �infor r �open�add�closer �PendingDeprecationWarning�sys�platformr )� base_name�base_dirr �verboser r r Ztar_compressionZcompress_extZarchive_namer% r �tarZcompressed_name�cmdr )r r r r r �make_tarball7 s<