B
    ãUvgz	  ã               @   sP   d dl mZ d dlmZ d dlmZmZmZ dd„ ZG dd„ deƒZ	dd	„ Z
d
S )é    )ÚDistutilsOptionError)Úmap)Úedit_configÚoption_baseÚconfig_filec             C   s8   xdD ]}|| krt | ƒS qW |  ¡ | gkr4t | ƒS | S )z4Quote an argument for later parsing by shlex.split())ú"ú'ú\ú#)ÚreprÚsplit)ÚargÚc© r   ú@/tmp/pip-install-r_9ig3yj/setuptools/setuptools/command/alias.pyÚshquote   s    
r   c               @   sH   e Zd ZdZdZdZdgej Zejdg Zdd„ Z	dd	„ Z
d
d„ ZdS )Úaliasz3Define a shortcut that invokes one or more commandsz0define a shortcut to invoke one or more commandsT)ÚremoveÚrzremove (unset) the aliasr   c             C   s   t  | ¡ d | _d | _d S )N)r   Úinitialize_optionsÚargsr   )Úselfr   r   r   r      s    
zalias.initialize_optionsc             C   s*   t  | ¡ | jr&t| jƒdkr&tdƒ‚d S )Né   zFMust specify exactly one argument (the alias name) when using --remove)r   Úfinalize_optionsr   Úlenr   r   )r   r   r   r   r   #   s    
zalias.finalize_optionsc             C   sÔ   | j  d¡}| jsDtdƒ tdƒ x|D ]}tdt||ƒƒ q(W d S t| jƒdkr”| j\}| jrfd }q¸||kr‚tdt||ƒƒ d S td| ƒ d S n$| jd }d tt	| jdd … ƒ¡}t
| jd||ii| jƒ d S )	NÚaliaseszCommand Aliasesz---------------zsetup.py aliasr   z No alias definition found for %rr   ú )ÚdistributionÚget_option_dictr   ÚprintÚformat_aliasr   r   Újoinr   r   r   ÚfilenameÚdry_run)r   r   r   Úcommandr   r   r   Úrun+   s&    

z	alias.runN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚdescriptionZcommand_consumes_argumentsr   Úuser_optionsÚboolean_optionsr   r   r%   r   r   r   r   r      s   r   c             C   sZ   ||  \}}|t dƒkrd}n,|t dƒkr0d}n|t dƒkrBd}nd| }||  d | S )	NÚglobalz--global-config Úuserz--user-config ÚlocalÚ z--filename=%rr   )r   )Únamer   Úsourcer$   r   r   r   r    F   s    r    N)Zdistutils.errorsr   Zsetuptools.extern.six.movesr   Zsetuptools.command.setoptr   r   r   r   r   r    r   r   r   r   Ú<module>   s
   
4