o
    $¼"bå  ã                   @   s˜   d dl mZmZ d dlZd dlmZ ejdkr d dlmZ dZ	nd dl
mZmZ edd	„ ed
ƒ d¡dd… D ƒƒZ	G dd„ deƒZG dd„ deƒZdS )é    )Úabsolute_importÚunicode_literalsN)ÚOrderedDict)é   é   )Úentry_points© )r   Úversionc                 c   s   � | ]}t |ƒV  qd S ©N)Úint)Ú.0Úir   r   ú</usr/lib/python3/dist-packages/virtualenv/run/plugin/base.pyÚ	<genexpr>   s   € r   Úimportlib_metadataÚ.é   c                   @   s,   e Zd ZdZdZedd„ ƒZedd„ ƒZdS )ÚPluginLoaderNc                 C   sN   t jdks	tdkrtdd„ |  ¡ j|d�D ƒƒS tdd„ |  ¡  |i ¡D ƒƒS )N)r   é
   )r   é   c                 s   ó   � | ]
}|j | ¡ fV  qd S r
   ©ÚnameÚload©r   Úer   r   r   r      ó   € z0PluginLoader.entry_points_for.<locals>.<genexpr>)Úgroupc                 s   r   r
   r   r   r   r   r   r      r   )ÚsysÚversion_infoÚimportlib_metadata_versionr   r   ÚselectÚget©ÚclsÚkeyr   r   r   Úentry_points_for   s   zPluginLoader.entry_points_forc                   C   s   t jd u r	tƒ t _t jS r
   )r   Ú_ENTRY_POINTSr   r   r   r   r   r      s   
zPluginLoader.entry_points)	Ú__name__Ú
__module__Ú__qualname__Ú_OPTIONSr'   Úclassmethodr&   Ústaticmethodr   r   r   r   r   r      s    
r   c                   @   s@   e Zd Zdd„ Zedd„ ƒZdd„ Zdd„ Zd	d
„ Zdd„ Z	dS )ÚComponentBuilderc                 C   s<   || _ || _d | _|| _|j|d�| _|  |t| jƒ¡ d S )N)Útitle)Úinterpreterr   Ú_impl_classÚpossibleÚadd_argument_groupÚparserÚadd_selector_arg_parseÚlist)Úselfr0   r4   r   r2   r   r   r   Ú__init__#   s   zComponentBuilder.__init__c                 C   s   | j d u r|  |¡| _ | j S r
   )r+   r&   r#   r   r   r   Úoptions+   s   
zComponentBuilder.optionsc                 C   s   t ‚r
   )ÚNotImplementedError)r7   r   Úchoicesr   r   r   r5   1   s   z'ComponentBuilder.add_selector_arg_parsec                 C   sD   t || jƒ}|| jvrtd | j¡ƒ‚| j| | _|  ||j¡ |S )NzNo implementation for {})	Úgetattrr   r2   ÚRuntimeErrorÚformatr0   r1   Úpopulate_selected_argparseÚapp_data)r7   r9   Úselectedr   r   r   Úhandle_selected_arg_parse4   s   
z*ComponentBuilder.handle_selected_arg_parsec                 C   s*   d  | j|¡| j_| j | j| j|¡ d S )Nzoptions for {} {})r>   r   r4   Údescriptionr1   Úadd_parser_argumentsr0   )r7   rA   r@   r   r   r   r?   <   s   z+ComponentBuilder.populate_selected_argparsec                 C   s   |   || j¡S r
   )r1   r0   )r7   r9   r   r   r   Úcreate@   s   zComponentBuilder.createN)
r(   r)   r*   r8   r,   r9   r5   rB   r?   rE   r   r   r   r   r.   "   s    
r.   )Ú
__future__r   r   r   Úcollectionsr   r   Úimportlib.metadatar   r    r   r	   ÚtupleÚsplitÚobjectr   r.   r   r   r   r   Ú<module>   s    
$