U
    aÊ¹jâ  ã                   @   sh   d Z ddlZddlZddlmZ ddlmZmZ ddlm	Z	 dd„ Z
G d	d
„ d
eƒZG dd„ deƒZdS )zidistutils.command.bdist

Implements the Distutils 'bdist' command (create a built [binary]
distribution).é    Né   )ÚCommand)ÚDistutilsOptionErrorÚDistutilsPlatformError)Úget_platformc                  C   s2   ddl m}  dd„ tjD ƒ}| |ƒ}| d¡ dS )zAPrint list of available formats (arguments to "--format" option).r   )ÚFancyGetoptc                 S   s$   g | ]}d | dt j| d f‘qS )úformats=Né   )ÚbdistÚformat_commands)Ú.0Úformat© r   úb/var/www/html/bwave/python/venv/lib/python3.8/site-packages/setuptools/_distutils/command/bdist.pyÚ
<listcomp>   s   ÿz show_formats.<locals>.<listcomp>z'List of available distribution formats:N)Úfancy_getoptr   r
   r   Ú
print_help)r   ÚformatsZpretty_printerr   r   r   Úshow_formats   s    þr   c                   @   s   e Zd Zdd„ ZdS )Ú
ListCompatc                 C   s   t jdtdd� d S )Nz4format_commands is now a dict. append is deprecated.r   )Ú
stacklevel)ÚwarningsÚwarnÚDeprecationWarning)ÚselfÚitemr   r   r   Úappend   s
    ýzListCompat.appendN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r      s   r   c                	   @   sˆ   e Zd ZdZddddeƒ › d�fddd	d
dgZdgZdddefgZdZ	dddœZ
eddddddddœƒZeZdd„ Zdd„ Zd d!„ ZdS )"r
   z$create a built (binary) distribution)zbdist-base=Úbz4temporary directory for creating built distributionsz
plat-name=Úpz8platform name to embed in generated filenames [default: ú])r   Nz/formats for distribution (comma-separated list))z	dist-dir=Údz=directory to put final built distributions in [default: dist])ú
skip-buildNz2skip rebuilding everything (for testing/debugging))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]r$   zhelp-formatsNz$lists available distribution formats)Ú	bdist_rpmÚgztarÚzip)ÚposixÚnt)r'   zRPM distribution)Ú
bdist_dumbzgzip'ed tar file)r,   zbzip2'ed tar file)r,   zxz'ed tar file)r,   zcompressed tar file)r,   ztar file)r,   zZIP file)Zrpmr(   ÚbztarÚxztarÚztarÚtarr)   c                 C   s.   d | _ d | _d | _d | _d| _d | _d | _d S )NF)Ú
bdist_baseÚ	plat_namer   Údist_dirÚ
skip_buildÚgroupÚowner)r   r   r   r   Úinitialize_options]   s    zbdist.initialize_optionsc                 C   s¶   | j d kr(| jrtƒ | _ n|  d¡j | _ | jd krT|  d¡j}tj |d| j  ¡| _|  	d¡ | j
d kr¢z| jtj g| _
W n$ tk
r    tdtj› �ƒ‚Y nX | jd kr²d| _d S )NÚbuildzbdist.r   z9don't know how to create built distributions on platform Údist)r2   r4   r   Úget_finalized_commandr1   Ú
build_baseÚosÚpathÚjoinÚensure_string_listr   Údefault_formatÚnameÚKeyErrorr   r3   )r   r;   r   r   r   Úfinalize_optionsf   s"    





ÿ

zbdist.finalize_optionsc              	   C   sÊ   g }| j D ]B}z| | j| d ¡ W q
 tk
rJ   td|› d�ƒ‚Y q
X q
tt| j ƒƒD ]h}|| }|  |¡}|| jkrˆ| j | |_	|dkr | j
|_
| j|_|||d d … krºd|_|  |¡ q\d S )Nr   zinvalid format 'ú'r,   r	   T)r   r   r   rB   r   ÚrangeÚlenÚreinitialize_commandÚno_format_optionr   r6   r5   Z	keep_tempÚrun_command)r   Úcommandsr   ÚiÚcmd_nameZsub_cmdr   r   r   Úrun‚   s"    


z	bdist.run)r   r   r   Údescriptionr   Úuser_optionsÚboolean_optionsr   Úhelp_optionsrH   r@   r   r   Zformat_commandr7   rC   rM   r   r   r   r   r
   $   s<   ýì
ÿ
ù	r
   )Ú__doc__r<   r   Úcorer   Úerrorsr   r   Úutilr   r   Údictr   r
   r   r   r   r   Ú<module>   s   
