o
    Zh/                     @   s   d Z ddl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
mZ dd	 ZG d
d deeeeef f ZG dd deZdS )zidistutils.command.bdist

Implements the Distutils 'bdist' command (create a built [binary]
distribution).    N)ClassVar   )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   Z/var/www/html/lang_env/lib/python3.10/site-packages/setuptools/_distutils/command/bdist.py
<listcomp>   s    z show_formats.<locals>.<listcomp>z'List of available distribution formats:N)Z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U 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	e
eedf  ed< 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.no_format_option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)   bztarZxztarZ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 u r| jrt | _ n| dj | _ | jd u r*| dj}tj|d| j  | _| 	d | j
d u rNz
| jtj g| _
W n tyM   tdtj w | jd u rXd| _d S d S )Nbuildzbdist.r   z9don't know how to create built distributions on platform dist)r1   r3   r   Zget_finalized_commandr0   
build_baseospathjoinZensure_string_listr   default_formatnameKeyErrorr   r2   )r   r9   r   r   r   finalize_optionsg   s*   






zbdist.finalize_optionsc              	   C   s   g }| j D ]}z|| j| d  W q ty"   td| dw tt| j D ]4}|| }| |}|| jvr@| j | |_	|dkrL| j
|_
| j|_|||d d  v rYd|_| | q*d S )Nr   zinvalid format ''r-   r
   T)r   r   r   r?   r   rangelenZreinitialize_commandr(   r   r5   r4   Z	keep_temprun_command)r   commandsr   icmd_nameZsub_cmdr   r   r   run   s&   


z	bdist.run)r   r   r   descriptionr   Zuser_optionsZboolean_optionsr   Zhelp_optionsr(   r   tuplestr__annotations__r=   r   r   Zformat_commandr6   r@   rH   r   r   r   r   r   %   sB   
 

	r   )__doc__r:   r   typingr   corer   errorsr   r   utilr   r   dictrK   rJ   r   r   r   r   r   r   <module>   s     
