o
    JAf…  ã                   @   sH   d Z ddlZddlmZ ddlT ddlmZ dd„ ZG dd	„ d	eƒZdS )
zidistutils.command.bdist

Implements the Distutils 'bdist' command (create a built [binary]
distribution).é    N)ÚCommand)Ú*)Úget_platformc                  C   sP   ddl m}  g }tjD ]}| d| dtj| d f¡ q| |ƒ}| d¡ dS )zAPrint list of available formats (arguments to "--format" option).r   )ÚFancyGetoptúformats=Né   z'List of available distribution formats:)Zdistutils.fancy_getoptr   ÚbdistÚformat_commandsÚappendÚformat_commandÚ
print_help)r   ÚformatsÚformatZpretty_printer© r   úH/usr/lib/python3.10/site-packages/setuptools/_distutils/command/bdist.pyÚshow_formats   s   
 r   c                
   @   sˆ   e Zd ZdZddddeƒ  fdddd	d
gZdgZdddefgZdZ	dddœZ
g d¢Zddddddddddœ	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=Úpz;platform name to embed in generated filenames (default: %s))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)	Zrpmr   ÚbztarÚxztarZztarÚtarZwininstr   Zmsi)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)Zbdist_wininstzWindows executable installer)r    zZIP file)Z	bdist_msizMicrosoft Installerc                 C   s.   d | _ d | _d | _d | _d| _d | _d | _d S )Nr   )Ú
bdist_baseÚ	plat_namer   Údist_dirÚ
skip_buildÚgroupÚowner)Úselfr   r   r   Úinitialize_options]   s   
zbdist.initialize_optionsc                 C   s²   | j d u r| jrtƒ | _ n|  d¡j | _ | jd u r*|  d¡j}tj |d| j  ¡| _|  	d¡ | j
d u rMz
| jtj g| _
W n tyL   tdtj ƒ‚w | jd u rWd| _d S d S )NÚbuildzbdist.r   z;don't know how to create built distributions on platform %sÚdist)r"   r$   r   Zget_finalized_commandr!   Ú
build_baseÚosÚpathÚjoinZensure_string_listr   Údefault_formatÚnameÚKeyErrorZDistutilsPlatformErrorr#   )r'   r+   r   r   r   Úfinalize_optionsf   s*   




ÿÿÿ

ÿzbdist.finalize_optionsc              	   C   s¾   g }| j D ]}z| | j| d ¡ W q ty    td| ƒ‚w tt| j ƒƒD ]4}|| }|  |¡}|| jvr>| j | |_	|dkrJ| j
|_
| j|_|||d d … v rWd|_|  |¡ q(d S )Nr   zinvalid format '%s'r    r   )r   r
   r   r1   ZDistutilsOptionErrorÚrangeÚlenZreinitialize_commandÚno_format_optionr   r&   r%   Z	keep_tempÚrun_command)r'   Úcommandsr   ÚiÚcmd_nameZsub_cmdr   r   r   Úrun‚   s&   
ÿ

ñz	bdist.run)Ú__name__Ú
__module__Ú__qualname__Údescriptionr   Zuser_optionsZboolean_optionsr   Zhelp_optionsr5   r/   r	   r   r(   r2   r:   r   r   r   r   r      sD    ÿýì
ÿ
÷	r   )	Ú__doc__r,   Zdistutils.corer   Zdistutils.errorsZdistutils.utilr   r   r   r   r   r   r   Ú<module>   s    