ó
@K7]c           @` s  d  d l  m Z m Z m Z d  d l Z d  d l Z d  d l Z d  d l m Z m	 Z	 d  d l
 m Z d  d l
 m Z d  d l
 m Z d  d l m Z d  d l m Z m Z m Z m Z e j d	 ƒ Z e j d
 ƒ Z d „  Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z d S(   i    (   t   absolute_importt   divisiont   print_functionN(   t   joint   basename(   t   memoized(   t	   untracked(   t   linked_data(   t   otool(   t   codefile_classt   inspect_linkagest	   machofilet   is_codefiles   \s*(.*?)\s*=>\s*(.*?)\s*\(.*\)s   \s*(.*?)\s*=>\s*not foundc         C` sú   t  j d |  g ƒ j d ƒ j ƒ  } g  } xÉ | D]Á } d | k rI q1 n  | d d k sk t |  | f ƒ ‚ t j | ƒ } | r™ | j | j ƒ  ƒ q1 n  t	 j | ƒ } | rÐ | j | j
 d ƒ d f ƒ q1 n  d | k râ q1 n  t d	 | ƒ ‚ q1 W| S(
   s   thin wrapper around lddt   ldds   utf-8s   =>i    s   	i   s	   not founds   ld-linuxs   Unexpected output from ldd: %s(   t
   subprocesst   check_outputt   decodet
   splitlinest   AssertionErrort   LDD_REt   matcht   appendt   groupst   LDD_NOT_FOUND_REt   groupt   RuntimeError(   t   patht   linest   rest   linet   m(    (    s7   lib/python2.7/site-packages/conda_build/os_utils/ldd.pyR      s$    $"c         C` s*  i  } x|  D]} t  | | ƒ } t } t | ƒ } | t k rO t } t }	 n t } t }	 z y{ t j j d ƒ r† t | ƒ | | <nR t j j d ƒ rØ t	 | ƒ }
 g  |
 D]  } t
 | d ƒ | d f ^ q« | | <n  Wn t } n XWd  t | d | d | d |	 ƒ} g  | D] } t
 | ƒ | f ^ q} | rC| | | <nÞ t | | ƒ t | ƒ k r!t d ƒ t d ƒ t d	 ƒ t d
 j | ƒ ƒ t d j d j  d „  | | Dƒ ƒ d j  d „  | Dƒ ƒ ƒ ƒ t d j t | | ƒ t | ƒ ƒ ƒ t d j t | ƒ t | | ƒ ƒ ƒ n  Xq W| S(   Nt   linuxt   darwint   namet   resolve_filenamest   sysroott   recurses@   WARNING: pyldd disagrees with ldd/otool. This will not cause anys;   WARNING: problems for this build, but please file a bug at:s-   WARNING: https://github.com/conda/conda-builds)   WARNING: and (if possible) attach file {}s.   WARNING: 
ldd/otool gives:
{}
pyldd gives:
{}
s   
c         s` s   |  ] } t  | ƒ Vq d  S(   N(   t   str(   t   .0t   e(    (    s7   lib/python2.7/site-packages/conda_build/os_utils/ldd.pys	   <genexpr>Q   s    s   Diffs
{}(   R   t   FalseR	   R   t   Truet   syst   platformt
   startswithR   R   R   R
   t   sett   printt   format(   t	   obj_filest   prefixR#   R   t   fR   t
   ldd_failedt   klassR"   R$   t   linkst   lt   res_pyt   lp(    (    s7   lib/python2.7/site-packages/conda_build/os_utils/ldd.pyt   get_linkages,   sF    	 8%


	&'/c         C` sp   t  | ƒ j |  ƒ } g  } | rl xH | j d g  ƒ D]1 } t | | ƒ } t | ƒ r4 | j | ƒ q4 q4 Wn  | S(   Nt   files(   R   t   getR   R   R   (   t   distR1   t   dataR   R2   R   (    (    s7   lib/python2.7/site-packages/conda_build/os_utils/ldd.pyt   get_package_obj_filesX   s    c         C` sR   g  } t  |  ƒ } x9 | D]1 } t |  | ƒ } t | ƒ r | j | ƒ q q W| S(   N(   R   R   R   R   (   R1   R   R:   R2   R   (    (    s7   lib/python2.7/site-packages/conda_build/os_utils/ldd.pyt   get_untracked_obj_filesf   s    (   t
   __future__R    R   R   R*   t   reR   t   os.pathR   R   t   conda_build.conda_interfaceR   R   R   t   conda_build.os_utils.machoR   t   conda_build.os_utils.pylddR	   R
   R   R   t   compileR   R   R   R9   R>   R?   (    (    (    s7   lib/python2.7/site-packages/conda_build/os_utils/ldd.pyt   <module>   s   "	,