3
ØLôYz	  ã               @   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 | jƒ | gkr4t | ƒS | S )z4Quote an argument for later parsing by shlex.split()ú"ú'ú\ú#)r   r   r	   r
   )ÚreprÚsplit)ÚargÚc© r   úr/private/var/folders/7d/20zwc49s3kn54d3vgq8bd4640000gn/T/pip-build-an2lx5zf/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Úrúremove (unset) the aliasc             C   s   t j| ƒ d | _d | _d S )N)r   Úinitialize_optionsÚargsr   )Úselfr   r   r   r      s    
zalias.initialize_optionsc             C   s*   t j| ƒ | 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 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j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)r   r   r   )Ú__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