U
.e: @ s d dl Z d dlZd dlZd dlmZ d dlmZmZ d dlm Z m
Z
mZ d dlm
Z
d dlmZmZ e eZG dd deZdS ) N)Command)ERRORSUCCESS)
Configurationget_configuration_fileskinds)PipError)get_progwrite_outputc sx e Zd ZdZdZdZ fddZdd Zdd Zd
d Z dd
Z
dd Zdd Zdd Z
dd Zdd Zdd Z ZS )ConfigurationCommanda9 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
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.
Tz
%prog [] list
%prog [] [--editor ] edit
%prog [] get name
%prog [] set name value
%prog [] unset name
c s t t| j|| d | _| jjdddd dd | jjdddd d
d | jjdddd d
d | jjdddd dd | jd| j d S )Nz--editoreditorZstorez\Editor to use to edit the file. Uses VISUAL or EDITOR environment variables if not provided.)destactiondefaulthelpz--globalglobal_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 )superr __init__
configurationZcmd_optsZ
add_optionparserZinsert_option_group)selfargskwargs __class__ H/usr/lib/python3.8/site-packages/pip/_internal/commands/configuration.pyr 0 s> zConfigurationCommand.__init__c
C s | j | j| j| j| jd}|r*|d |krHtddt | t
S |d }z| j||dkd}W n: tk
r } zt|j
d t
W Y S d }~X Y nX t|j|d| _| j z|| ||dd W n< tk
r } zt|j
d t
W Y S d }~X Y nX tS ) N)listeditgetsetunsetr zNeed an action ({}) to perform.z, )r" r# r$ r! )
need_value)isolated load_only )list_valuesopen_in_editorget_nameset_name_value
unset_nameloggererrorformatjoinsortedr _determine_filer r r Z
isolated_moder loadr )r optionsr Zhandlersr r' er r r runZ s>
zConfigurationCommand.runc C s dd t j|jft j|jft j|jffD }|s`|s8d S tdd t t j D rXt jS t jS nt |dkrt|d S t
dd S )Nc S s g | ]\}}|r|qS r r ).0keyvaluer r r