ó

\c           @   sF   d  Z  d d l Z d d l Z e e d e    Z e d d  Z d S(   s   
patch for py25 socket to work with http://pypi.python.org/pypi/ssl/
copy-paste from py2.6 stdlib socket.py
https://gist.github.com/zed/1347055
i˙˙˙˙Nt   _GLOBAL_DEFAULT_TIMEOUTc         C   s  |  \ } } d } xÚ t j | | d t j  D]˝ } | \ } } }	 }
 } d } y\ t j | | |	  } | t k	 r | j |  n  | r | j |  n  | j |  | SWq. t j k
 rę t	 j
   d } | d k	 rë | j   që q. Xq. W| d k	 r|  n t j d   d S(   s  Connect to *address* and return the socket object.

    Convenience function.  Connect to *address* (a 2-tuple ``(host,
    port)``) and return the socket object.  Passing the optional
    *timeout* parameter will set the timeout on the socket instance
    before attempting to connect.  If no *timeout* is supplied, the
    global default timeout setting returned by :func:`getdefaulttimeout`
    is used.
    i    i   s!   getaddrinfo returns an empty listN(   t   Nonet   sockett   getaddrinfot   SOCK_STREAMR    t
   settimeoutt   bindt   connectt   errort   syst   exc_infot   close(   t   addresst   timeoutt   source_addresst   hostt   portt   errt   rest   aft   socktypet   protot	   canonnamet   sat   sock(    (    sr   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/backwardcompat/socket_create_connection.pyt   create_connection
   s(    "	(   t   __doc__R   R	   t   getattrt   objectR    R   R   (    (    (    sr   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/backwardcompat/socket_create_connection.pyt   <module>   s
   