<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>

Re$                 @   s  d  d l  Z  d  d l Z d  d l Z d  d l m Z d  d l m Z m Z d  d l m	 Z	 m
 Z
 m Z d  d l m Z d  d l m Z d  d l m Z m Z d  d l m Z e r d  d	 l m Z m Z m Z d  d
 l m Z d  d l m Z e  j e  Z Gd d   d e  Z d S)    N)Command)ERRORSUCCESS)Configurationget_configuration_fileskinds)PipError)
indent_log)get_progwrite_output)MYPY_CHECK_RUNNING)ListAnyOptional)Values)Kindc               @   s   e  Z d  Z d Z d Z d Z d d   Z d d   Z d d	   Z d
 d   Z	 d d   Z
 d d   Z d d   Z d d   Z d d   Z d d   Z d d   Z d d   Z d d   Z d d   Z d  S)!ConfigurationCommandah  
    Manage local and global configuration.

    Subcommands:

    - list: List the active configuration (or from the file specified)
    - edit: Edit the configuration file in an editor
    - get: Get the value associated with name
    - set: Set the name=value
    - unset: Unset the value associated with name
    - debug: List the configuration files and values defined under them

    If none of --user, --global and --site are passed, a virtual
    environment configuration file is used if one is active and the file
    exists. Otherwise, all modifications happen on the to the user file by
    default.
    Ta  
        %prog [<file-option>] list
        %prog [<file-option>] [--editor <editor-path>] edit

        %prog [<file-option>] get name
        %prog [<file-option>] set name value
        %prog [<file-option>] unset name
        %prog [<file-option>] debug
    c          
   C   s   |  j  j d d d d d d d  d d |  j  j d	 d d
 d d d d d d |  j  j d d d d d d d d d |  j  j d d d d d d d d d |  j j d |  j   d  S)Nz--editordesteditoractionstoredefaulthelpz\Editor to use to edit the file. Uses VISUAL or EDITOR environment variables if not provided.z--globalglobal_file
store_trueFz+Use the system-wide configuration file onlyz--user	user_filez$Use the user configuration file onlyz--site	site_filez3Use the current environment configuration file onlyr   )cmd_opts
add_optionparserinsert_option_group)self r"   /builddir/build/BUILDROOT/alt-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/commands/configuration.pyadd_options8   s2    				z ConfigurationCommand.add_optionsc             C   sj  d |  j  d |  j d |  j d |  j d |  j d |  j i } | sS | d | k rv t j d d	 j t	 |    t
 S| d } y |  j | d
 | d k } Wn= t k
 r } z t j | j d  t
 SWYd  d  } ~ Xn Xt d | j d |  |  _ |  j j   y | | | | d d    Wn= t k
 re} z t j | j d  t
 SWYd  d  } ~ Xn Xt S)Nlisteditgetsetunsetdebugr   zNeed an action (%s) to perform.z, 
need_valueisolated	load_only   )r'   r(   r)   r&   )list_valuesopen_in_editorget_nameset_name_value
unset_namelist_config_valuesloggererrorjoinsortedr   _determine_filer   argsr   isolated_modeconfigurationloadr   )r!   optionsr:   handlersr   r-   er"   r"   r#   run_   s6    					
zConfigurationCommand.runc             C   s   d d   t  j | j f t  j | j f t  j | j f f D } | s | sP d  St d d   t   t  j D  rz t  j St  j Sn t	 |  d k r | d St
 d   d  S)Nc             S   s"   g  |  ] \ } } | r |  q Sr"   r"   ).0keyvaluer"   r"   r#   
<listcomp>   s   	 	z8ConfigurationCommand._determine_file.<locals>.<listcomp>c             s   s!   |  ] } t  j j |  Vq d  S)N)ospathexists)rB   site_config_filer"   r"   r#   	<genexpr>   s   z7ConfigurationCommand._determine_file.<locals>.<genexpr>r.   r   zLNeed exactly one file to operate upon (--user, --site, --global) to perform.)r   USERr   GLOBALr   SITEr   anyr   lenr   )r!   r>   r+   Zfile_optionsr"   r"   r#   r9      s     		
z$ConfigurationCommand._determine_filec             C   sP   |  j  | d d d x3 t |  j j    D] \ } } t d | |  q, Wd  S)Nr%   nr   z%s=%r)_get_n_argsr8   r<   itemsr   )r!   r>   r:   rC   rD   r"   r"   r#   r/      s    "z ConfigurationCommand.list_valuesc             C   s;   |  j  | d d d } |  j j |  } t d |  d  S)Nz
get [name]rP   r.   z%s)rQ   r<   	get_valuer   )r!   r>   r:   rC   rD   r"   r"   r#   r1      s    zConfigurationCommand.get_namec             C   s?   |  j  | d d d \ } } |  j j | |  |  j   d  S)Nzset [name] [value]rP      )rQ   r<   	set_value_save_configuration)r!   r>   r:   rC   rD   r"   r"   r#   r2      s    z#ConfigurationCommand.set_name_valuec             C   s6   |  j  | d d d } |  j j |  |  j   d  S)Nzunset [name]rP   r.   )rQ   r<   unset_valuerV   )r!   r>   r:   rC   r"   r"   r#   r3      s    zConfigurationCommand.unset_namec             C   s   |  j  | d d d |  j   x t |  j j    D]p \ } } t d |  xT | D]L } t   : t j j	 |  } t d | |  | r |  j
 |  Wd QRXqV Wq6 Wd S)z9List config key-value pairs across different config filesr*   rP   r   z%s:z%s, exists: %rN)rQ   print_env_var_valuesr8   r<   iter_config_filesr   r	   rF   rG   rH   print_config_file_values)r!   r>   r:   variantfilesfnameZfile_existsr"   r"   r#   r4      s    
"

z'ConfigurationCommand.list_config_valuesc             C   sN   xG |  j  j |  j   D]- \ } } t    t d | |  Wd QRXq Wd S)z.Get key-value pairs from the file of a variantz%s: %sN)r<   get_values_in_configrR   r	   r   )r!   r[   namerD   r"   r"   r#   rZ      s    
z-ConfigurationCommand.print_config_file_valuesc             C   sm   t  d d  t   P xH t |  j j    D]1 \ } } d j | j    } t  d | |  q- WWd QRXd S)z5Get key-values pairs present as environment variablesz%s:env_varzPIP_{}z%s=%rN)r   r	   r8   r<   get_environ_varsformatupper)r!   rC   rD   r`   r"   r"   r#   rX      s
    
"z)ConfigurationCommand.print_env_var_valuesc             C   s   |  j  |  } |  j j   } | d  k r6 t d   y t j | | g  Wn@ t j k
 r } z t d j | j    WYd  d  } ~ Xn Xd  S)Nz%Could not determine appropriate file.z*Editor Subprocess exited with exit code {})	_determine_editorr<   get_file_to_editr   
subprocess
check_callCalledProcessErrorrb   
returncode)r!   r>   r:   r   r]   r@   r"   r"   r#   r0      s    z#ConfigurationCommand.open_in_editorc             C   sR   t  |  | k r6 d j | t   |  } t |   | d k rJ | d S| Sd S)zJHelper to make sure the command got the right number of arguments
        zJGot unexpected number of arguments, expected {}. (example: "{} config {}")r.   r   N)rO   rb   r
   r   )r!   r:   ZexamplerP   msgr"   r"   r#   rQ      s    z ConfigurationCommand._get_n_argsc             C   sC   y |  j  j   Wn+ t k
 r> t j d  t d   Yn Xd  S)Nz:Unable to save configuration. Please report this as a bug.zInternal Error.)r<   save	Exceptionr5   	exceptionr   )r!   r"   r"   r#   rV     s    z(ConfigurationCommand._save_configurationc             C   sZ   | j  d  k	 r | j  Sd t j k r0 t j d Sd t j k rJ t j d St d   d  S)NZVISUALZEDITORz"Could not determine editor to use.)r   rF   environr   )r!   r>   r"   r"   r#   rd     s    z&ConfigurationCommand._determine_editorN)__name__
__module____qualname____doc__ignore_require_venvusager$   rA   r9   r/   r1   r2   r3   r4   rZ   rX   r0   rQ   rV   rd   r"   r"   r"   r#   r      s"   	'.	r   ) loggingrF   rf   pip._internal.cli.base_commandr   pip._internal.cli.status_codesr   r   pip._internal.configurationr   r   r   pip._internal.exceptionsr   pip._internal.utils.loggingr	   pip._internal.utils.miscr
   r   pip._internal.utils.typingr   typingr   r   r   optparser   r   	getLoggerro   r5   r   r"   r"   r"   r#   <module>   s   