
(°hº  ã               @   sb   d  Z  d d l Z d d l m Z d d l Td d l m Z d d „  Z Gd d	 „  d	 e ƒ Z d S)
zidistutils.command.bdist

Implements the Distutils 'bdist' command (create a built [binary]
distribution).é    N)ÚCommand)Ú*)Úget_platformc              C   sl   d d l  m }  g  } x6 t j D]+ } | j d | d t j | d f ƒ q  W|  | ƒ } | j d ƒ d S)zFPrint list of available formats (arguments to "--format" option).
    r   )ÚFancyGetoptzformats=Né   z'List of available distribution formats:)Údistutils.fancy_getoptr   ÚbdistÚformat_commandsÚappendÚformat_commandÚ
print_help)r   ÚformatsÚformatZpretty_printer© r   úI/tmp/pip-build-kmztzv_d/setuptools/setuptools/_distutils/command/bdist.pyÚshow_formats   s    r   c               @   sø   e  Z d  Z d Z d6 d d d e ƒ  f d7 d8 d9 d: d; g Z d g Z d d	 d e f g Z d< Z	 d d d d i Z
 d d d d d  d! d" d d# g	 Z d d= d d> d d? d d@ d  dA d! dB d" dC d dD d# dE i	 Z d0 d1 „  Z d2 d3 „  Z d4 d5 „  Z d	 S)Fr   z$create a built (binary) distributionúbdist-base=Úbú4temporary directory for creating built distributionsz
plat-name=Úpz;platform name to embed in generated filenames (default: %s)úformats=Nú/formats for distribution (comma-separated list)ú	dist-dir=Údú=directory to put final built distributions in [default: dist]ú
skip-buildú2skip rebuilding everything (for testing/debugging)úowner=Úuú@Owner name used when creating a tar file [default: current user]úgroup=ÚgúAGroup name used when creating a tar file [default: current group]zhelp-formatsz$lists available distribution formatsÚ	bdist_rpmÚposixÚgztarÚntÚzipZrpmÚbztarÚxztarÚztarÚtarZwininstZmsiúRPM distributionÚ
bdist_dumbúgzip'ed tar fileúbzip2'ed tar fileúxz'ed tar fileúcompressed tar fileútar fileÚbdist_wininstúWindows executable installerúZIP fileÚ	bdist_msiúMicrosoft Installerc             C   sC   d  |  _  d  |  _ d  |  _ d  |  _ d |  _ d  |  _ d  |  _ d  S)Nr   )Ú
bdist_baseÚ	plat_namer   Údist_dirÚ
skip_buildÚgroupÚowner)Úselfr   r   r   Úinitialize_optionsQ   s    						zbdist.initialize_optionsc             C   sö   |  j  d  k r< |  j r' t ƒ  |  _  n |  j d ƒ j  |  _  |  j d  k r| |  j d ƒ j } t j j | d |  j  ƒ |  _ |  j	 d ƒ |  j
 d  k rÚ y |  j t j g |  _
 Wn% t k
 rÙ t d t j ƒ ‚ Yn X|  j d  k rò d |  _ d  S)NÚbuildzbdist.r   z;don't know how to create built distributions on platform %sÚdist)r9   r;   r   Úget_finalized_commandr8   Ú
build_baseÚosÚpathÚjoinÚensure_string_listr   Údefault_formatÚnameÚKeyErrorÚDistutilsPlatformErrorr:   )r>   rC   r   r   r   Úfinalize_optionsZ   s$    	zbdist.finalize_optionsc             C   s  g  } xR |  j  D]G } y | j |  j | d ƒ Wq t k
 rV t d | ƒ ‚ Yq Xq Wx© t t |  j  ƒ ƒ D]’ } | | } |  j | ƒ } | |  j k r¯ |  j  | | _	 | d k rÓ |  j
 | _
 |  j | _ | | | d d  … k rö d | _ |  j | ƒ qq Wd  S)Nr   zinvalid format '%s'r-   r   )r   r
   r   rJ   ÚDistutilsOptionErrorÚrangeÚlenÚreinitialize_commandÚno_format_optionr   r=   r<   Z	keep_tempÚrun_command)r>   Úcommandsr   ÚiÚcmd_nameZsub_cmdr   r   r   Úrunv   s"    
	z	bdist.run)r   r   r   )r   Nr   )r   r   r   )r   Nr   )r   r   r   )r    r!   r"   )ú	bdist_rpm)rW   r,   )ú
bdist_dumbr.   )rX   r/   )rX   r0   )rX   r1   )rX   r2   )zbdist_wininstr4   )rX   r5   )r6   r7   )Ú__name__Ú
__module__Ú__qualname__Údescriptionr   Úuser_optionsÚboolean_optionsr   Úhelp_optionsrQ   rH   r	   r   r?   rL   rV   r   r   r   r   r      sJ    
     			r   )	Ú__doc__rD   Údistutils.corer   Zdistutils.errorsÚdistutils.utilr   r   r   r   r   r   r   Ú<module>   s   
