
    =e                         d Z ddlmZ ddlZddlmZ ddlmZ ddlm	Z	m
Z
mZmZmZmZmZmZ ddlmZmZ  ej        d	          Zd
diZd Zd Zd Zd ZdS )a  
anaconda-client configuration

Get, Set, Remove or Show the anaconda-client configuration.

###### anaconda-client sites

anaconda-client sites are a mechanism to allow users to quickly switch
between Anaconda repository instances. This is primarily used for testing
the anaconda alpha site. But also has applications for the
on-site [Anaconda Enterprise](http://continuum.io/anaconda-server).

anaconda-client comes with two pre-configured sites `alpha` and
`binstar` you may use these in one of two ways:

  * Invoke the anaconda command with the `-s/--site` option
    e.g. to use the alpha testing site:

        anaconda -s alpha whoami

  * Set a site as the default:

        anaconda config --set default_site alpha
        anaconda whoami

###### Add a anaconda-client site

After installing [Anaconda Enterprise](http://continuum.io/anaconda-server)
you can add a site named **site_name** like this:

    anaconda config --set sites.site_name.url "http://<anaconda-enterprise-ip>:<port>/api"
    anaconda config --set default_site site_name

###### Site Options VS Global Options

All options can be set as global options - affecting all sites,
or site options - affecting only one site

By default options are set globally e.g.:

    anaconda config --set OPTION VALUE

If you want the option to be limited to a single site,
prefix the option with `sites.site_name` e.g.

    anaconda config --set sites.site_name.OPTION VALUE

###### Common anaconda-client configuration options

  * `url`: Set the anaconda api url (default: https://api.anaconda.org)
  * `ssl_verify`: Perform ssl validation on the https requests.
    ssl_verify may be `True`, `False` or a path to a root CA pem file.


###### Toggle auto_register when doing anaconda upload

The default is yes, automatically create a new package when uploading.
If no, then an upload will fail if the package name does not already exist on the server.

    anaconda config --set auto_register yes|no

    )print_functionN)RawDescriptionHelpFormatter)ShowHelp)SEARCH_PATHUSER_CONFIGSYSTEM_CONFIGCONFIGURATION_KEYS
get_configsave_configload_configload_file_configs   )	yaml_dump	safe_loadzbinstar.config
verify_sslzPlease use ssl_verify insteadc                 `   d|v r3|                     dd          \  }}|                     |i           } d|v 3|t          vrt                              d|           |t
          v r;d                    |t
          |                   }t                              |            ||          | |<   d S )N.   z%"%s" is not a known configuration keyz{} is deprecated: {})split
setdefaultr	   loggerwarning
DEPRECATEDformat)config_datakeyvaluetype_prefixmessages         >lib/python3.11/site-packages/binstar_client/commands/config.pyrecursive_setr"   S   s    
**iiQ''!,,VR88 ** $$$>DDD
j(//Z_EEwuU||K    c                     d|v r7| sd S |                     dd          \  }}|                     |i           } d|v 7| |= d S )Nr   r   )r   get)r   r   r   s      r!   recursive_remover&   b   s]    
** 	FiiQ''!oofb11	 ** 	Cr#   c                    t                      }| j        r)t                              t	          |                     d S | j        rct          t                    }|D ]J}t                              d|           t                              t	          ||                              Kd S | j        rQ| j        |v r&t                              || j                            n t                              d| j                   d S | j	        rBt                              dt                     t                              dt                     d S | j        rt          nt          }t          |          }| j        D ]\  }}t          |||| j                   | j        D ]>}	 t%          ||           # t&          $ r t                              d|           Y ;w xY w| j        s| j        st+                      t-          ||           d S )Nz
==> %s <==zThe value of '%s' is not set.zUser Config: %szSystem Config: %szKey %s does not exist)r
   showr   infor   show_sourcesr   r   r%   filesr   r   userr   setr"   typeremover&   KeyErrorerrorr   r   )argsconfigconfig_filespathconfig_filer   r   s          r!   mainr7   l   s   \\Fy If%%&&& (55  	7 	7DKKd+++KK	,t"4556666x 8vKKtx())))KK7BBBz %{333'777!%=++K%%Fh 5 5
Ufc5$)4444{ 7 7	7VS)))) 	7 	7 	7LL0#66666	7 H  jj$$$$$s   F--%GGc                    d}|                      d||t          t                    }|                    dt          d           |                    d          }|                    dd	d
g dd           |                    ddd           |                    dd
g d           |                    dddd           |                    dddd           |                    ddd           |                    d          }|                    d d!dd"d#d$%           |                    d&d'd(d)d"d*+           |                    t          |,           d S )-NzAnaconda client configurationr3   )helpdescriptionepilogformatter_classz--typez*The type of the values in the set commands)defaultr9   actionsz--setr   appendzsets a new variable: name value)namer   )nargsactionr=   r9   metavarz--getr@   zget value: name)rC   r9   z--removezremoves a variable)rB   r=   r9   z--show
store_trueFzshow all variablesz-fz--fileszshow the config file names)rB   r9   z--show-sourcesz%Display all identified config sourceslocationz-uz--userr,   Tzset a variable for this user)rB   destr=   r9   z-sz--systemz--sitestore_falsez,set a variable for all users on this machine)rB   rF   r9   )r7   
sub_parser)
add_parser__doc__r   add_argumentr   add_argument_groupset_defaultsr7   )
subparsersr:   parseragrouplgroups        r!   rI   rI      s   1K""8(3/:*13N	 # P PF )I  K K K &&y11F
q2>HY  [ [ [
.  0 0 0

8R1  3 3 3
u1  3 3 3
i9  ; ; ;
(D  F F F&&z22F
h|&RV;  = = =
j(=vK  M M M Tf55555r#   )rJ   
__future__r   loggingargparser   binstar_client.errorsr   binstar_client.utils.configr   r   r   r	   r
   r   r   r   
utils.yamlr   r   	getLoggerr   r   r"   r&   r7   rI    r#   r!   <module>rZ      sJ  = =~ & % % % % %  0 0 0 0 0 0 * * * * * *b b b b b b b b b b b b b b b b b b b b - - - - - - - -		+	,	, 1

$ $ $  *% *% *%Z6 6 6 6 6r#   