ó
Gh\c           @   s—   d  d l  Z  d  d l Z i d d 6d d 6d d 6d d g d	 6d
 d 6d
 d 6d
 d 6d d 6d d 6d d 6d d 6d
 d 6Z d „  Z d „  Z d „  Z d S(   iÿÿÿÿNs&   /usr/local/share/certs/ca-root-nss.crtt   freebsds   /etc/ssl/cert.pemt   openbsdt	   dragonflys(   /opt/local/share/curl/curl-ca-bundle.crts   /usr/local/etc/openssl/cert.pemt   darwins"   /etc/ssl/certs/ca-certificates.crts   linux-ubuntus   linux-debians   linux-gentoos    /etc/pki/tls/certs/ca-bundle.crts   linux-fedoras   linux-redhats   /etc/ssl/ca-bundle.pems
   linux-suses   linux-opensuses
   linux-archc          C   sz   t  j ƒ  j ƒ  }  |  j d ƒ rv t  j ƒ  d } | rX |  d | j ƒ  d j ƒ  }  n  t j j d ƒ rv d }  qv n  |  S(   sj  
    Finds out OS name.  For non-Linux system it will be just a plain
    OS name (like FreeBSD), for Linux it will be "linux-<distro>",
    where <distro> is the name of the distribution, as returned by
    the first component of platform.linux_distribution.

    Return value will be all-lowercase to avoid confusion about
    proper name capitalisation.

    t   linuxi    s   -%ss   /etc/arch-releases
   linux-arch(	   t   platformt   systemt   lowert
   startswitht   linux_distributiont   splitt   ost   patht   exists(   t   OSt   DISTRO(    (    s2   /usr/share/offlineimap/offlineimap/utils/distro.pyt   get_os_name#   s    !c          C   sG   t  ƒ  }  d } |  t k rC t |  } t | d ƒ sC | f } qC n  | S(   s'  Returns search path for CA bundle for the current OS.

    We will return an iterable even if configuration has just
    a single value: it is easier for our callers to be sure
    that they can iterate over result.

    Returned value of None means that there is no search path
    at all.
    t   __iter__N(   R   t   Nonet   __DEF_OS_LOCATIONSt   hasattr(   R   t   l(    (    s2   /usr/share/offlineimap/offlineimap/utils/distro.pyt   get_os_sslcertfile_searchpath9   s    	
c          C   s†   t  ƒ  }  |  d k r d Sxf |  D]^ } t | ƒ t d ƒ k sD t ‚ t j j | ƒ r  t j j | ƒ sz t j j | ƒ r  | Sq  Wd S(   s  
    Finds out the location for the distribution-specific
    CA certificate file bundle.

    Returns the location of the file or None if there is
    no known CA certificate file or all known locations
    correspond to non-existing filesystem objects.
    t    N(	   R   R   t   typet   AssertionErrorR   R   R   t   isfilet   islink(   R   t   f(    (    s2   /usr/share/offlineimap/offlineimap/utils/distro.pyt   get_os_sslcertfileN   s    
	$(   R   R   R   R   R   R   (    (    (    s2   /usr/share/offlineimap/offlineimap/utils/distro.pyt   <module>   s$   

		