B
     S]1                 @   sh   d Z ddlZddlmZ ddlmZ ddlmZmZ ddl	T ddl
mZ ddlmZ G d	d
 d
eZdS )zdistutils.command.bdist_dumb

Implements the Distutils 'bdist_dumb' command (create a "dumb" built
distribution -- i.e., just an archive to be unpacked under $prefix or
$exec_prefix).    N)Command)get_platform)remove_treeensure_relative)*)get_python_version)logc            	   @   s^   e Zd ZdZdddde  fdddd	d
ddg	ZdddgZdddZdd Zdd Z	dd Z
dS )
bdist_dumbz"create a "dumb" built distribution)z
bdist-dir=dz1temporary directory for creating the distributionz
plat-name=pz;platform name to embed in generated filenames (default: %s))zformat=fz>archive format to create (tar, gztar, bztar, xztar, ztar, zip))z	keep-tempkzPkeep the pseudo-installation tree around after creating the distribution archive)z	dist-dir=r
   z-directory to put final built distributions in)z
skip-buildNz2skip rebuilding everything (for testing/debugging))relativeNz7build the archive using relative paths (default: false))zowner=uz@Owner name used when creating a tar file [default: current user])zgroup=gzAGroup name used when creating a tar file [default: current group]z	keep-tempz
skip-buildr   Zgztarzip)posixntc             C   s:   d | _ d | _d | _d| _d | _d | _d| _d | _d | _d S )Nr   )		bdist_dir	plat_nameformat	keep_tempdist_dir
skip_buildr   ownergroup)self r   -lib/python3.7/distutils/command/bdist_dumb.pyinitialize_options2   s    zbdist_dumb.initialize_optionsc             C   sz   | j d kr&| dj}tj|d| _ | jd krfy| jtj | _W n" t	k
rd   t
dtj Y nX | dddd d S )NZbdistZdumbz@don't know how to create dumb built distributions on platform %s)r   r   )r   r   )r   r   )r   Zget_finalized_command
bdist_baseospathjoinr   default_formatnameKeyErrorDistutilsPlatformErrorZset_undefined_options)r   r    r   r   r   finalize_options=   s    

zbdist_dumb.finalize_optionsc             C   s(  | j s| d | jddd}| j|_| j |_ d|_td| j | d d| j	 | j
f }tj| j|}| js~| j}nJ| j r|j|jkrtdt|jt|jf ntj| jt|j}| j|| j|| j| jd	}| j rt }nd
}| jjd||f | js$t| j| jd d S )NZbuildinstall   )Zreinit_subcommandsr   zinstalling to %sz%s.%szScan't make a dumb built distribution where base and platbase are different (%s, %s))Zroot_dirr   r   anyr	   )dry_run) r   Zrun_commandZreinitialize_commandr   rootZwarn_dirr   infoZdistributionZget_fullnamer   r!   r"   r#   r   r   Zhas_ext_modulesZinstall_baseZinstall_platbaser'   reprr   Zmake_archiver   r   r   r   Z
dist_filesappendr   r   r,   )r   r)   Zarchive_basenameZpseudoinstall_rootZarchive_rootfilenameZ	pyversionr   r   r   runO   s>    






zbdist_dumb.runN)__name__
__module____qualname__Zdescriptionr   Zuser_optionsZboolean_optionsr$   r   r(   r2   r   r   r   r   r	      s$   
r	   )__doc__r!   Zdistutils.corer   Zdistutils.utilr   Zdistutils.dir_utilr   r   Zdistutils.errorsZdistutils.sysconfigr   Z	distutilsr   r	   r   r   r   r   <module>   s   