
    3i2                        d dl mZ d dlZd dlmZ d dlmZ d dlmZ erd dl	m
Z
 d dlmZ d dlmZmZ d	Z G d
 d      Z G d de      ZddgZy)    )annotationsN)OrderedDict)entry_points)TYPE_CHECKING)Sequence)
PythonInfo)VirtualEnvConfigParserVirtualEnvOptions c                  8    e Zd ZdZdZedd       Zedd       Zy)PluginLoaderNc                    t         j                  dk\  s	t        dk\  r0t        d | j	                         j                  |      D              S t        d | j	                         j                  |i       D              S )N)   
   )r      c              3  T   K   | ]   }|j                   |j                         f " y wNnameload.0es     M/var/www/opsc/venv/lib/python3.12/site-packages/virtualenv/run/plugin/base.py	<genexpr>z0PluginLoader.entry_points_for.<locals>.<genexpr>   s     `a1`   &()groupc              3  T   K   | ]   }|j                   |j                         f " y wr   r   r   s     r   r   z0PluginLoader.entry_points_for.<locals>.<genexpr>   s     W!AFFAFFH-Wr   )sysversion_infoimportlib_metadata_versionr   r   selectgetclskeys     r   entry_points_forzPluginLoader.entry_points_for   si    w&*D*N`3;K;K;M;T;T[^;T;_```Ws7G7G7I7M7McSU7VWWW    c                 h    t         j                  t               t         _        t         j                  S r   )r   _ENTRY_POINTSr   r   r(   r   r   zPluginLoader.entry_points   s$    %%-)5L&)))r(   r&   strreturnzOrderedDict[str, type])r-   object)	__name__
__module____qualname___OPTIONSr*   classmethodr'   staticmethodr   r   r(   r   r   r      s4    HMX X
 * *r(   r   c                  Z    e Zd Z	 	 	 	 	 	 	 	 	 	 ddZed	d       Zd
dZddZddZddZ	y)ComponentBuilderc                    || _         || _        d | _        || _        |j	                  |      | _        | j                  |t        | j                               y )N)title)interpreterr   _impl_classpossibleadd_argument_groupparseradd_selector_arg_parselist)selfr9   r=   r   r;   s        r   __init__zComponentBuilder.__init__$   sP     '	 //d/;##D$t}}*=>r(   c                ^    | j                   | j                  |      | _         | j                   S r   )r2   r'   r$   s     r   optionszComponentBuilder.options.   s(    <<//4CL||r(   c                    t         r   )NotImplementedError)r@   r   choicess      r   r>   z'ComponentBuilder.add_selector_arg_parse4   s    !!r(   c                    t        || j                        }|| j                  vrd| j                   }t	        |      | j                  |   | _        | j                  ||j                         |S )NzNo implementation for )getattrr   r;   r9   RuntimeErrorr:   populate_selected_argparseapp_data)r@   rC   selectedmsgs       r   handle_selected_arg_parsez*ComponentBuilder.handle_selected_arg_parse7   sh    7DII.4==(*4+;+;*<=Cs##==2'''2B2BCr(   c                    d| j                    d| | j                  _        | j                  J | j                  j	                  | j                  | j
                  |       y )Nzoptions for  )r   r=   descriptionr:   add_parser_argumentsr9   )r@   rL   rK   s      r   rJ   z+ComponentBuilder.populate_selected_argparse@   sS    $01XJ"G+++--dkk4;K;KXVr(   c                V    | j                   J | j                  || j                        S r   )r:   r9   )r@   rC   s     r   createzComponentBuilder.createE   s-    +++)9)9::r(   N)
r9   r   r=   r	   r   r,   r;   zdict[str, type]r-   Noner+   )r   r,   rF   zSequence[str]r-   rU   )rC   r
   r-   r,   )rL   r,   rK   r.   r-   rU   )rC   r
   r-   r.   )
r/   r0   r1   rA   r3   rC   r>   rN   rJ   rT   r   r(   r   r6   r6   #   sX    ?%?/E?MP?\k?	?  
"W
;r(   r6   )
__future__r   r   collectionsr   importlib.metadatar   typingr   collections.abcr   python_discoveryr   virtualenv.config.cli.parserr	   r
   r!   r   r6   __all__r   r(   r   <module>r^      sL    " 
 # +  (+V * *"$;| $;P r(   