;
Ñâ"Ic               @   s[   d  Z  d d l Z d d l Z d d l m Z d d l m Z d Z Gd „  d e ƒ Z d S(   u   distutils.pypirc

Provides the PyPIRCCommand class, the base class for the command classes
that uses .pypirc in the distutils.command package.
i    N(   u   ConfigParser(   u   Commandu<   [pypirc]
servers =
    pypi

[pypi]
username:%s
password:%s
c             B   s{   |  Ee  Z d  Z d Z d Z d Z d Z d d d e f d g Z d g Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z d S(   u;   Base command that knows how to handle the .pypirc file
    u   http://pypi.python.org/pypiu   pypiu   repository=u   ru   url of repository [default: %s]u   show-responseu&   display full response text from serverc             C   s   t  j j t  j j d ƒ d ƒ S(   u   Returns rc file path.u   ~u   .pypirc(   u   osu   pathu   joinu
   expanduser(   u   self(    (    u-   /mit/python/lib/python3.0/distutils/config.pyu   _get_rc_file'   s    c             C   ss   |  j  ƒ  } t | d ƒ } z | j t | | f ƒ Wd | j ƒ  Xy t j | d ƒ Wn t k
 o Yn Xd S(   u   Creates a default .pypirc file.u   wNi€  (   u   _get_rc_fileu   openu   writeu   DEFAULT_PYPIRCu   closeu   osu   chmodu   OSError(   u   selfu   usernameu   passwordu   rcu   f(    (    u-   /mit/python/lib/python3.0/distutils/config.pyu   _store_pypirc+   s    c             C   sJ  |  j  ƒ  } t j j | ƒ o'|  j d | ƒ |  j p |  j } |  j p |  j } t	 ƒ  } | j
 | ƒ | j ƒ  } d | k o5| j d d ƒ } d „  | j d ƒ Dƒ } | g  k o" d | k o d g } qß i  Sn x`| D]Ì } i | d 6}	 | j | d ƒ |	 d <| j | d	 ƒ |	 d	 <xc d
 |  j f d |  j f f D]C \ }
 } | j | |
 ƒ o | j | |
 ƒ |	 |
 <qD| |	 |
 <qDW|	 d | k p |	 d
 | k o |	 Sqæ WqFd | k o{ d } | j | d
 ƒ o | j | d
 ƒ } n
 |  j } i | j | d ƒ d 6| j | d	 ƒ d	 6| d
 6| d 6|  j d 6Sn i  S(   u   Reads the .pypirc file.u   Using PyPI login from %su	   distutilsu   index-serversc             S   s8   g  } |  ]* } | j  ƒ  d  k o | | j  ƒ  q
 q
 S(   u    (   u   strip(   u   .0u   _[1]u   server(    (    u-   /mit/python/lib/python3.0/distutils/config.pyu
   <listcomp>G   s    u   
u   pypiu   serveru   usernameu   passwordu
   repositoryu   realmu   server-login(   u   _get_rc_fileu   osu   pathu   existsu   announceu
   repositoryu   DEFAULT_REPOSITORYu   realmu   DEFAULT_REALMu   ConfigParseru   readu   sectionsu   getu   splitu
   has_option(   u   selfu   rcu
   repositoryu   realmu   configu   sectionsu   index_serversu   _serversu   serveru   currentu   keyu   default(    (    u-   /mit/python/lib/python3.0/distutils/config.pyu   _read_pypirc9   sT    	 	 	c             C   s   d |  _ d |  _ d |  _ d S(   u   Initialize options.i    N(   u   Noneu
   repositoryu   realmu   show_response(   u   self(    (    u-   /mit/python/lib/python3.0/distutils/config.pyu   initialize_optionsq   s    		c             C   sD   |  j  d k o |  j |  _  n |  j d k o |  j |  _ n d S(   u   Finalizes options.N(   u
   repositoryu   Noneu   DEFAULT_REPOSITORYu   realmu   DEFAULT_REALM(   u   self(    (    u-   /mit/python/lib/python3.0/distutils/config.pyu   finalize_optionsw   s    N(   u   show-responseNu&   display full response text from server(   u   __name__u
   __module__u   __doc__u   DEFAULT_REPOSITORYu   DEFAULT_REALMu   Noneu
   repositoryu   realmu   user_optionsu   boolean_optionsu   _get_rc_fileu   _store_pypircu   _read_pypircu   initialize_optionsu   finalize_options(   u
   __locals__(    (    u-   /mit/python/lib/python3.0/distutils/config.pyu   PyPIRCCommand   s    
 					8	u   PyPIRCCommand(	   u   __doc__u   osu   sysu   configparseru   ConfigParseru   distutils.cmdu   Commandu   DEFAULT_PYPIRCu   PyPIRCCommand(    (    (    u-   /mit/python/lib/python3.0/distutils/config.pyu   <module>   s   
