o
    bc9                     @   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 )zFPrint list of available formats (arguments to "--format" option).
    r   )FancyGetoptformats=N   z'List of available distribution formats:)distutils.fancy_getoptr   bdistformat_commandsappendformat_command
print_help)r   formatsformatpretty_printer r   ./usr/lib/python3.10/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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)rpmr   bztarxztarztartarr   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)r%   zZIP file)	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_optionsO   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   get_finalized_commandr'   
build_baseospathjoinensure_string_listr   default_formatnameKeyErrorDistutilsPlatformErrorr)   )r-   r2   r   r   r   finalize_optionsX   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   r9   DistutilsOptionErrorrangelenreinitialize_commandno_format_optionr   r,   r+   	keep_temprun_command)r-   commandsr   icmd_namesub_cmdr   r   r   runt   s&   


z	bdist.run)__name__
__module____qualname__descriptionr   user_optionsboolean_optionsr   help_optionsr@   r7   r
   r   r.   r;   rG   r   r   r   r   r	      sH    	r	   )	__doc__r3   distutils.corer   distutils.errorsdistutils.utilr   r   r	   r   r   r   r   <module>   s    