
    
_d                      r    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 Z
 G d d	e      Z G d
 de      Zy)zidistutils.command.bdist

Implements the Distutils 'bdist' command (create a built [binary]
distribution).    N   )Command)DistutilsPlatformErrorDistutilsOptionError)get_platformc                      ddl m}  g }t        j                  D ]-  }|j	                  d|z   dt        j                  |   d   f       /  | |      }|j                  d       y)zAPrint list of available formats (arguments to "--format" option).r   )FancyGetoptformats=N   z'List of available distribution formats:)fancy_getoptr	   bdistformat_commandsappend
print_help)r	   formatsformatpretty_printers       E/usr/lib/python3/dist-packages/setuptools/_distutils/command/bdist.pyshow_formatsr      sc    *G'' V
V+T53H3H3PQR3STUV )NGH    c                       e Zd Zd Zy)
ListCompatc                 <    t        j                  dt        d       y )Nz4format_commands is now a dict. append is deprecated.r   )
stacklevel)warningswarnDeprecationWarning)selfitems     r   r   zListCompat.append   s    F	
r   N)__name__
__module____qualname__r    r   r   r   r      s    
r   r   c            
           e Zd ZdZdddd e       z  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 Zd Zd Zy)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)r+   zRPM distribution)
bdist_dumbzgzip'ed tar file)r0   zbzip2'ed tar file)r0   zxz'ed tar file)r0   zcompressed tar file)r0   ztar file)r0   zZIP file)rpmr,   bztarxztarztartarr-   c                 f    d | _         d | _        d | _        d | _        d| _        d | _        d | _        y )Nr   )
bdist_base	plat_namer   dist_dir
skip_buildgroupowner)r   s    r   initialize_optionszbdist.initialize_options^   s3    

r   c                 B   | j                   <| j                  rt               | _         n | j                  d      j                   | _         | j                  M| j                  d      j
                  }t        j                  j                  |d| j                   z         | _        | j                  d       | j                  $	 | j                  t        j                     g| _
        | j                  d| _        y y # t        $ r t        dt        j                  z        w xY w)Nbuildzbdist.r   z;don't know how to create built distributions on platform %sdist)r8   r:   r   get_finalized_commandr7   
build_baseospathjoinensure_string_listr   default_formatnameKeyErrorr   r9   )r   rB   s     r   finalize_optionszbdist.finalize_optionsg   s    >>!!-!%!;!;G!D!N!N
 ??"33G<GGJ ggll:x$..7PQDO	*<< $ 3 3BGG <= == "DM !  ,%')ww/ s    #C8 8&Dc                    g }| j                   D ]$  }	 |j                  | j                  |   d          & t        t        | j                               D ]  }||   }| j                  |      }|| j                  vr| j                   |   |_	        |dk(  r"| j                  |_
        | j                  |_        |||dz   d  v rd|_        | j                  |        y # t        $ r t	        d|z        w xY w)Nr   zinvalid format '%s'r0   r   )r   r   r   rI   r   rangelenreinitialize_commandno_format_optionr   r<   r;   	keep_temprun_command)r   commandsr   icmd_namesub_cmds         r   runz	bdist.run   s   ll 	KFK 4 4V <Q ?@	K s4<<() 	'A{H//9Gt444!%a <' $

 $

 8AEG,,$%!X&	'	  K*+@6+IJJKs   !CC3)r    r!   r"   descriptionr   user_optionsboolean_optionsr   help_optionsrO   rG   r   r   format_commandr=   rJ   rV   r#   r   r   r   r   #   s    8K 	U*n-	
 	N	

 	S	

	
)L6 $nO 
E|TL
 &  'e4N !47859--	

O %N#8'r   r   )__doc__rC   r   corer   errorsr   r   utilr   r   dictr   r   r#   r   r   <module>ra      s;   
 
   A I
 
y'G y'r   