Ñò
b-äQc           @   sò   d  Z  d d k Td d k l Z d d k l Z d d k l Z y d d k l	 Z	 Wn# e
 j
 o d d k	 l	 Z	 n Xd d k Z d d k Z d d k Z d d k Z d d k Z d d k l Z l Z l Z l Z d	 e f d
 „  ƒ  YZ d S(   s`   distutils.command.upload

Implements the Distutils 'upload' subcommand (upload package to PyPI).iÿÿÿÿ(   t   *(   t   Command(   t   spawn(   t   log(   t   md5N(   t   urlparset   StringIOt   httplibt   ConfigParsert   uploadc           B   sc   e  Z d  Z d Z d d d e f d d d g Z d d g Z d „  Z d „  Z d „  Z	 d „  Z
 RS(   s   upload binary package to PyPIs   https://pypi.python.org/pypis   repository=t   rs   url of repository [default: %s]s   show-responses&   display full response text from servert   signt   ss   sign files to upload using gpgs	   identity=t   is   GPG identity used to sign filesc         C   s:   d |  _  d |  _ d |  _ d |  _ t |  _ d  |  _ d  S(   Nt    i    (   t   usernamet   passwordt
   repositoryt   show_responset   FalseR   t   Nonet   identity(   t   self(    (    sU   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/command/upload.pyt   initialize_options&   s    					c         C   s5  |  i  o |  i o t d ƒ ‚ n d t i j oâ t i i t i d d ƒ } t i i | ƒ o¯ |  i d | ƒ t	 i	 h d d 6d d 6d d 6ƒ } | i
 | ƒ |  i p | i d	 d ƒ |  _ n |  i p | i d	 d ƒ |  _ n |  i p | i d	 d ƒ |  _ qqn |  i p |  i |  _ n d  S(
   Ns.   Must use --sign for --identity to have meaningt   HOMEs   .pypircs   Using PyPI login from %sR   R   R   R   s   server-login(   R   R   t   DistutilsOptionErrort   ost   environt   patht   joint   existst   announceR   t   readR   t   getR   R   t   DEFAULT_REPOSITORY(   R   t   rct   config(    (    sU   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/command/upload.pyt   finalize_options.   s(    	


!
c         C   sT   |  i  i p t d ƒ ‚ n x0 |  i  i D]" \ } } } |  i | | | ƒ q* Wd  S(   Ns'   No dist file created in earlier command(   t   distributiont
   dist_filesR   t   upload_file(   R   t   commandt	   pyversiont   filename(    (    sU   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/command/upload.pyt   runE   s
     c       
   C   sn  |  i  oM d d d | g } |  i o d |  i g | d d +n t | d |  i ƒn t | d ƒ } | i ƒ  } | i ƒ  t i i	 | ƒ } d } | d	 j o* |  i
 i ƒ  o d
 t i d d ƒ } n h d d 6d d 6|  i
 i ƒ  d 6|  i
 i ƒ  d 6| | f d 6| d 6| d 6t | ƒ i ƒ  d 6}	 | d j o4 t i ƒ  \ }
 } } |
 o d |
 | f } q•n( | d j o d t i d d ƒ } n | |	 d <|  i  oD t | d ƒ } t i i	 | ƒ d | i ƒ  f |	 d <| i ƒ  n d t i |  i d |  i ƒ i ƒ  } d  } d! | } | d" } t i ƒ  } x |	 i ƒ  D]ò \ } } t | ƒ t g  ƒ j o | g } n x½ | D]µ } t | ƒ t j o d# | d$ } | d } n d } t | ƒ } | i | ƒ | i d% | ƒ | i | ƒ | i d& ƒ | i | ƒ | o" | d' d( j o | i d) ƒ q€q€WqGW| i | ƒ | i d) ƒ | i ƒ  } |  i d* | |  i f t  i! ƒ t" |  i ƒ \ } } } } } } | o | o | p t# ‚ | d+ j o t$ i% | ƒ } n1 | d, j o t$ i& | ƒ } n t# d- | ƒ ‚ d }	 t  i! } yu | i' ƒ  | i( d. | ƒ | i) d/ d0 | ƒ | i) d1 t t* | ƒ ƒ ƒ | i) d2 | ƒ | i+ ƒ  | i, | ƒ Wn@ t- i. j
 o1 t/ i0 ƒ  d } |  i t | ƒ t  i1 ƒ d  SX| i2 ƒ  } | i3 d3 j o' |  i d4 | i3 | i4 f t  i! ƒ n$ |  i d5 | i3 | i4 f t  i1 ƒ |  i5 o  d6 d7 | i ƒ  d6 d7 f GHn d  S(8   Nt   gpgs   --detach-signs   -as   --local-useri   t   dry_runt   rbR   t	   bdist_eggs   built on %st   tersei   t   file_uploads   :actiont   1t   protocol_versiont   namet   versiont   contentt   filetypeR*   t
   md5_digestt	   bdist_rpms   built for %s %st
   bdist_dumbs   built for %st   comments   .asct   gpg_signatures   Basic t   :s3   --------------GHSKFJDLGDS7543FJKLFHRE75642756743254s   
--s   --s   ;filename="%s"i    s*   
Content-Disposition: form-data; name="%s"s   

iÿÿÿÿs   s   
s   Submitting %s to %st   httpt   httpss   unsupported schema t   POSTs   Content-types    multipart/form-data; boundary=%ss   Content-lengtht   AuthorizationiÈ   s   Server response (%s): %ss   Upload failed (%s): %st   -iK   (6   R   R   R   R.   t   openR    t   closeR   R   t   basenameR&   t   has_ext_modulest   platformt   get_namet   get_versionR   t	   hexdigestt   distt   base64t   encodestringR   R   t   stripR   t   itemst   typet   tuplet   strt   writet   getvalueR   R   R   t   INFOR   t   AssertionErrorR   t   HTTPConnectiont   HTTPSConnectiont   connectt
   putrequestt	   putheadert   lent
   endheaderst   sendt   sockett   errort   syst   exc_infot   ERRORt   getresponset   statust   reasonR   (    R   R)   R*   R+   t   gpg_argst   fR7   RF   R<   t   dataRL   R6   t   idt   asc_filet   autht   boundaryt   sep_boundaryt   end_boundaryt   bodyt   keyt   valuet   fnt   schemat   netloct   urlt   paramst   queryt	   fragmentsR?   t   loglevelt   eR
   (    (    sU   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/command/upload.pyR(   K   s´    

	


&'

   !	
	


N(   s   show-responseNs&   display full response text from server(   s   signR   s   sign files to upload using gpg(   s	   identity=R   s   GPG identity used to sign files(   t   __name__t
   __module__t   descriptionR"   R   t   user_optionst   boolean_optionsR   R%   R,   R(   (    (    (    sU   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/command/upload.pyR	      s   
  				(   t   __doc__t   distutils.errorst   distutils.coreR   t   distutils.spawnR   t	   distutilsR   t   hashlibR   t   ImportErrorR   Rb   R`   RH   RM   t   setuptools.compatR   R   R   R   R	   (    (    (    sU   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/command/upload.pyt   <module>   s   
"