
    8xdb
                       d dl Z d dlZd dl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 d dlmZmZmZmZmZmZmZmZmZmZmZmZmZ d d	lm Z m!Z!m"Z" 	 d d
lm#Z# n# e$$ r dZ#Y nw xY wd dl%m&Z& d dl'm(Z(m)Z)m*Z*m+Z+ d dl,m-Z-m.Z.m/Z/ d dl0m1Z1 d dl2m3Z3m4Z4 d dl5m6Z6m7Z7 d dl8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z> d dl?m@Z@ ddgdgdZAd@dZBd ZCd@dZDd ZEd ZFd ZGd ZHdAd ZId! ZJ	 	 	 dBd"ZKdCd#ZLd$ ZMdDd&ZN	 dEd'ZOd( ZPd) ZQd* ZRd+ ZS G d, d-          ZTg d.ZUg d/ZVd0 ZWd1 ZXd2 ZYd3 ZZd4 Z[d5 Z\d6 Z]d7 Z^di fd8Z_dCd9Z`dCd:Zad; ZbdFd<Zcd= Zdd> Zed? ZfdS )G    N)OrderedDictdefaultdict)copy)filterfnmatch)	translate)partial)basenamedirnameexistsisabsisdirisfileislinkjoinnormpathrealpathrelpathsepsplitext)CalledProcessErrorcallcheck_output)readlinkF)utils)TemporaryDirectorylchmodmd5_filewalk_prefix)OverDependingErrorOverLinkingErrorRunPathError)which_package)externalmacho)get_package_filesget_package_obj_files)get_exports_memoizedget_linkages_memoizedget_rpaths_rawget_runpaths_raw	have_lief	set_rpath)codefile_type)DLLfileEXEfile	machofileelffile)winosxlinuxc                    t          ||           }t          |          rd S t          |          rd S t          |          sd S t	          j        |          j        dk    rd S d}t	          j        |d           t          |dt          j
                              5 }	 |                    d          }|                    d           n# t          $ r Y d d d            d S w xY wt          j        dt          j                  }	 t#          j        |                                dd t"          j                  }	n$# t*          $ r |                                }	Y nw xY w	 |                    |	          }
nF# t.          $ r9 t          j        d	t          j                  }d
}|                    |	          }
Y nw xY w|
rv|rt          j        dt          j                  nt          j        dt          j                  }t          j        ||
                                          s	 d d d            d S n	 d d d            d S |	d d          }d d d            n# 1 swxY w Y   dt4          j        dk    r
|rd|z   dz   n|dz   t9          |          z   z   }|r$t;          |d          r|                                }|                    ||d          }||k    rd S tA          d|            t          |dt          j
                              5 }	 |!                    |           n7# t.          $ r* |!                    |"                                           Y nw xY wd d d            d S # 1 swxY w Y   d S )Nr   F  zr+)modeencodingd   z^#!.+$)tagnameflagss   ^#!.+$Ts   \/python[w]?(?:$|\s|\Z)z\/python[w]?(:$|\s|\Z)z#!darwinz
/bin/bash z/bin/pythonwz/bin/encode   )countzupdating shebang:w)r:   )#r   r/   r   r   osstatst_sizechmodopenlocalegetpreferredencodingreadseekUnicodeDecodeErrorrecompileMr   	mmap_mmapfilenommap_MAP_PRIVATEOSErrormatch	TypeErrorsearchgroupsysplatformr   hasattrr?   subprintwritedecode)fprefixbuild_python
osx_is_apppathbytes_fidataSHEBANG_PATmmmpython_patternpy_execnew_datafos                  0lib/python3.11/site-packages/conda_build/post.pyfix_shebangro   A   sz   ??DT 	 D\\ 	wt}}!!FHT5	d(C(E(E	F	F	F #"	773<<DGGAJJJJ! 	 	 	# # # # # # # #	 jBD11			QE4J  BB  	 	 	BBB		&!!"%%AA 	& 	& 	&*Z66KF!!"%%AAA	&
  		 A
6===Z 924@@ 
 9^QWWYY77 ?# # # # # # # #< C# # # # # # # #F !!!uG# # # # # # # # # # # # # # #J <8##
# 	v..g 6 66G
  #''8,, #..""wA66H4	
q!!!	dC&"="?"?	@	@	@ (B	(HHX 	( 	( 	(HHX__&&'''''	(( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (s   I*C
	I

C#I"C##"I4D;:I;EIEI E65I6A F96I8F99A-I3I
IIIM*L&%M*&1MM*MM**M.1M.c           	         t          |           }d                    |j        d                             d          d d                   }t	          t          t          j        |j        |          d|                    d          d         z            d          5 }|                    d|z             d d d            d S # 1 swxY w Y   d S )	N.python   z%s.pth-r   rB   z./%s
)	r   r   variantsplitrG   r   get_site_packageshost_prefixr]   )egg_pathconfigfnpy_verrm   s        rn   	write_pthr}      s   	(		BXXfnX.44S99"1"=>>F	#F$6??a()	
 	
 	
 
   

B                                   s   CC
Cc           
         fd| D             d                     |j        d                             d          dd                   }t          j        |          }t          j        t          |d                    D ]Rt                    r	|s,t          fdt          dd	          D                       st          |
           St          d           	 t          j        t          d          dz              n# t          $ r Y nw xY wt          j        t          d                     t          j                  D ]G}|dk    r#t          j        t          |                     ,t#          t          ||                    r	 t          j        t          |          t          ||          |j        |j                   t          j        t          |                     # t          $ r^}t+          t-          |                                          d                   }t          d                    ||                    d}~ww xY wt          j        t          |          t          ||                     It1                    r'vr1t          d           t          |
           Td D             }|D ]?}	t3          |	d          5 }
|
                    d           ddd           n# 1 swxY w Y   @t          j        t          |d                     dS )z]
    remove the need for easy-install.pth and finally remove easy-install.pth
    itself
    c                 0    g | ]}t          |          S  r   ).0r_   r`   s     rn   
<listcomp>z+remove_easy_install_pth.<locals>.<listcomp>   s!    ///AVQ///    rq   rr   Nrs   z	*-py*.eggc              3   <   K   | ]}t          |          v V  d S Nr   )r   iabsfilesry   s     rn   	<genexpr>z*remove_easy_install_pth.<locals>.<genexpr>   sF       + + Xq!!X-+ + + + + +r   F)windows_forward_slashes)rz   zfound egg dir:zEGG-INFOz-info__pycache__)lockingzTried to merge folder {egg_path} into {sp_dir}, but {fn} exists in both locations.  Please either add build/preserve_egg_dir: True to meta.yaml, or manually remove the file during your install process to avoid this conflict.)ry   sp_dirr{   z
found egg:c                 N    g | ]"}|                     d t           d           |#S )
.dist-info	INSTALLER)endswithr   r   r_   s     rn   r   z+remove_easy_install_pth.<locals>.<listcomp>   s5    VVVQajj9Tc9T9T9T.U.UVqVVVr   rB   condazeasy-install.pth)r   ru   rv   r   rw   globr   anyr    r}   r\   shutilmoverS   rm_rfrC   listdirr   	copy_intotimeoutr   r   strformatr   rG   r]   )filesr`   rz   preserve_egg_dirr|   r   r{   einstaller_filesfiler_   r   ry   s    `         @@rn   remove_easy_install_pthr      s   
 0//////HXXfnX.44S99"1"=>>F$VV44FJtFK8899 1/ 1/?? 0	/ s + + + + +$XueTTT+ + + ( (  (62222"H---D:6678JKKKK   KXz22333j** J J&&KXr 2 23333
 d62..// J!O $Xr 2 2 $VR 0 0 &(.	    "KXr(:(:;;;;& 
 
 
!)#a&&,,..*<!=!=B")!1 28-5f 28 2" 2"# # 
 D2$6$6VR8H8HIIII9J< H 	/x'',)))hv....VV(VVVO  $__ 	GGG	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 
KV/0011111s>   (&D
DDA H  
I(
AI##I(8LL	!L	c                 p   t          t          j        |                     }|D ]}|                                rz|j                            d          r`dD ]]}t          |j                  \  }t          |z             t          fd|D                       rt          j
        |z              ^dS )z3remove .py (.pyc) files alongside .so or .pyd files).so.pyd).pyz.pycz.pyoc              3   >   K   | ]}t          |          k    V  d S r   r   )r   r_   names     rn   r   z!rm_py_along_so.<locals>.<genexpr>   s.      ::qtx{{*::::::r   N)listrC   scandiris_filer   r   r   rc   r   r   unlink)r`   r   r{   ext_r   s        @rn   rm_py_along_sor      s     F##$$E * *::<< 	*BG,,_== 	*, * *"27++as
++::::E::::: *IdSj)))* *r   c                     t          j        d          }| D ]9}|                    |          r"t          j        t          ||                     :dS )aA  pyo considered harmful: https://www.python.org/dev/peps/pep-0488/

    The build may have proceeded with:
        [install]
        optimize = 1
    .. in setup.cfg in which case we can end up with some stdlib __pycache__
    files ending in .opt-N.pyc on Python 3, as well as .pyo files for the
    package's own python.z.*(?:\.pyo$|\.opt-[0-9]\.pyc)NrM   rN   rT   rC   r   r   )r   r`   re_pyor{   s       rn   rm_pyor      s\     Z899F ( (<< 	(Id62&&'''( (r   c                     t          j        d          }| D ]9}|                    |          r"t          j        t          ||                     :d S )Nz.*(?:\.pyc$)r   )r   r`   re_pycr{   s       rn   rm_pycr      sY    Z((F ( (<< 	(Id62&&'''( (r   c                     d| v r7t          |ddd          }t          |          rt          j        |           d S d S d S )Nzshare/info/dirshareinfodir)r   r   rC   r   )r   r`   r{   s      rn   rm_share_info_dirr      sQ    5  &'6511":: 	IbMMMMM ! 	 	r   r   c           	         t          |          sd S g }d |D             }t                      }|D ]2}|                    t          t          | |                               3t          |           |z
  }|D ]t          j        dk    rt          fddD                       r.n                    d          rEdt          j	        z   }	
                    d          r<t                    |	z   t                    z   dz   | vr|                               |r8t          |          st          d	           d S t          d
           t          j        dk    rd}
nd}
|
t          |          dz  z  }
t          t!          |t                              dz   }|
|k     r|}
g g}|dddg}t          d                    |                    dz   x}}|D ]e}t          |          dz   }||z   |
k    r|                    g            |}n||z  }|t          |          dz
                               |           f|D ]}t%          ||z   |           d S d S )Nc                 ,    g | ]}t          |          S r   r   )r   skips     rn   r   z'compile_missing_pyc.<locals>.<listcomp>  s    FFFT(4..FFFr   win32c                 ^    g | ])}                                                     |          *S r   )lower
startswith)r   startr{   s     rn   r   z'compile_missing_pyc.<locals>.<listcomp>  s?        HHJJ))%00  r   )zlibrary/binzlibrary\binscriptsbinr   r   czAcompiling .pyc files... failed as no python interpreter was foundzcompiling .pyc files...i  i  rs   keyr@   z-Wiz-m
py_compile )cwd)r   setupdatefnmatch_filterrX   rY   r   r   rC   r   r   r   r   appendr\   lenmaxr   r   )r   r   
python_exeskip_compile_pyccompile_filesskip_compile_pyc_nskipped_filesr   unskipped_filescache_prefixlimitlower_limitgroupsargsargs_lenlengthr_   length_thisrW   r{   s                      @rn   compile_missing_pycr     s   * MFF5EFFFEEM" ? ?St!<!<==>>>>%jj=0O % %<7""   !K      }}U## $rv-KK	%l*Xb\\9C?uLL  $$$ ,j!! 	,UVVVVV+,,,|w&&S''!++Ec-S999::Q>K{""#TFt\:D #CHHTNN 3 3a 77Hv" 2 2!!ffqj'%//MM"%%%%FFk)Fs6{{Q'..q1111 , ,TE\s+++++5, ,2, ,r   c                    |D ]}|                     dt          j        z   dz             rt          t	          |                                                    }|                    | dz             ro|                    d          \  }}}|                    | dz             \  }}}|| k    r1||k    r+t          d| d| d           t          j
        d            d S d S )Nr   METADATArt   z1ERROR: Top level dist-info version incorrect (is z, should be )r@   )r   rC   r   r   r   r   r   
rpartitionr\   rX   exit)r   versionr   r_   f_lowerr   distnames          rn   check_dist_info_versionr   ;  s     ::lRV+j899 	wqzz//1122G!!$*-- 	 ' 2 2< @ @A'.'9'9$*'E'E$8Wt##7(:(:kGkkahkkk   HQKKKKFF r   c                 <   t          ||           |rt          ||           n5t          |j                  r|j        n|j        }t          ||||           t          ||||           t          |           t          ||           t          | ||           d S )N)r   r   r   )r   )
r   r   r   ra   host_pythonr   r   r   r   r   )	r   r   r   r`   rz   r   noarchr   r   s	            rn   post_processr   K  s     5& 
uf $*&*=#>#>VFFDV 	 	v*GW	
 	
 	
 	
 E66DTUUUU6eV$$$D'511111r   c           	      T                          |          r[t           t          |          dz   d                     t           fd|D                       st	          j        d z              S                       d          rd S                       d          rd S d vs                      d          r\t                      t          t                    }|D ]*}|t          |                   	                    |           + |vrt	          j        d z             t          |                    dk    r|rt          |           k    r|S t                      }|          D ]2}|                    t          t          ||                               3t          |          dk    r!t	          j        d  d|                      n6|                                           t          d	 d
|          d           |          d         S t          d z             d S )Nr@   c              3   >   K   | ]}t          |          k    V  d S r   r   )r   rB   links     rn   r   zfind_lib.<locals>.<genexpr>h  s.      66148A;;&666666r   zError: Could not find %s/@rpath/z@executable_path/z#Error: Found multiple instances of : zFound multiple instances of z (z).  Choosing the first one.r   z#Don't know how to find %s, skipping)r   r   r   r   rX   r   r   r   r   r   r   addr   r   sortr\   )r   r`   r   rc   
file_namesr_   md5ss   `      rn   find_libr   e  s]   v S[[1_../00666666666 	8H/$6777s y!!  	
$$//*=>>~~ &&
 	. 	.Ax{{#**1----z!!H/$6777z$  1$$ $.. 55D% 4 4$vq//2233334yy1}}T$TT*TBRTT    4 %%'''15z$7G7G7GI   $""	
/$
677777r   c                 D   |d         }||k    r|                     |          rw|                    ||          }t          d| d|             t          d           t          |          st	          j        d|z             nt          d| d|  d           t          ||||           }|sd S t          d| d|             t          d|z             t          t          |          d	          }d
| dt          |           }|                    dd          }|S )Nr   zFixing linking of z in zY.. seems to be linking to a compiler runtime, replacing build prefix with host prefix andzKError: Compiler runtime library in build prefix not found in host prefix %sz.. fixing linking of z insteadzNew link location is %slibr   r   /./)
r   replacer\   r/   rX   r   r   r   r   r   )	rc   	link_dictrx   build_prefixr   r   link_loclib_to_linkrets	            rn   osx_ch_linkr    sm   VD{""t|'D'D"||L+663433T33444	
 	
 	
 T"" 	DH]   
 B$BBDBBBCCCk5$77H 	
/t
/
/
/
/000	
#x
0111'(++U33K( 3K
2
2(4..
2
2C ++eS
!
!CJr   r   c           
      t   |j         j        }|t          |          k    sJ |j         j        }t	          |          r|n|}t          j        | |          }t          j        | |t          t          |||          |          }	|rt          j
        | |          }
|D ]}|dk    r	t          dt          t          ||          t          |                     d                              dd          }t          j        | ||d	           t          ||          }|
D ]:}t          |          t          |          k    rt          j        | ||d	           ;|
D ]D}|                    |          r-|                    |          st          j        | ||d	           E|	rt%          | ||           d S d S )
N)rx   r  r   )dylibs)r   z@loader_pathr   r   T)r  verbose)rz   build_folderr   r  r   r&   otoolinstall_name_changer
   r  
get_rpathsr   r   r   	add_rpathr   delete_rpathr   assert_relative_osx)rc   rx   ri   r   rpathsbase_prefixr  r`   namessexisting_rpathsrpath	rpath_new
full_rpathexisting_rpaths                  rn   mk_relative_osxr    s   ('K'+......8(L#L11B\\{FKf%%E![|SX	
 	
 	
 	 	 	A  S*4fEEE  	 	E{{[%(@(@'$-- P PRT geS!!  OD)&$OOOOk511J"1  N++x
/C/CCC&n64    % 	S 	SE,, SU5E5Ek5R5R S"4VTRRRR = 	D+|<<<<<= =r   c           	      `   t          ||           }t          |          }d}t          j        d|          }|st	          d| d| d           d}n	 t          |d|g                              d                                          d	         }|                    t          j
                  }nd# t          $ rW |dk    r#t	          d
                    |                     n)|dk    r#t	          d                    ||                     d}Y nw xY w|}t          rGt          |          \  }	}
}
|r*||	k    r$t	          d                    |	||                     |dk    r|	}g }|D ]}|                    d          r|                    |           -|                    d          rut#          ||          }|                    dt          j        z             rt	          d| d| d           dt#          ||          z   }||vr|                    |           |D ]}|dk    r|                    d          s|t'          t)          j        | |                    }t'          t#          |t          |                               }||k    s%t-          d                    ||| |                    d|z   }||vr|                    |           d                     |          }|r|r,|                                dk    rt1          d||           dS t3          |dd||g           dS )zARespects the original values and converts abs to $ORIGIN-relativeNpatchelfzAERROR :: You should install patchelf, will proceed with LIEF for z (was r   LIEFz--print-rpathutf-8r   zKERROR :: `patchelf --print-rpath` failed for {}, but patchelf was specifiedzRWARNING :: `patchelf --print-rpath` failed for {}, will proceed with LIEF (was {})zBWARNING :: get_rpaths_raw()={} and patchelf={} disagree for {} :: z$ORIGINr   z..zWarning: rpath z is outside prefix z (removing it)z$ORIGIN/r	  z4utils.relative {} and relpath {} disagree for {}, {}:*)old_matching	new_rpathr   z--force-rpathz--set-rpath)r   r   r%   find_executabler\   r   r^   
splitlinesrv   rC   pathsepr   r   r-   r+   r   r   r   r   r   r   relative
ValueErrorupperr.   r   )r_   r`   r  methodelforiginexisting_per  existing	existing2r   newoldrpr  rel_ours
rel_stdlibs                    rn   mk_relative_linuxr5  ,  s    vq//CS\\FK'
F;;H 8dPSdd[addd	
 	
 	
 	8h=>>a! ( &++BJ77KK " 	 	 	##ahh    
 6!!hooV   
 FFF	  H 
!(--	1a 	;)33T[[{C    V H
C # #>>)$$ 
	#JJsOOOO^^C   	#f%%B}}TBF]++ #VVVVVVWWWW'#v"6"66S==JJrNNN " "B;;##C(( 0 $EN1e$<$<==%geWQZZ&@&@AA
:--$NUU$j!U   
 #Z/C

5!!!HHSMME  E E6<<>>V#;#;se#>>>>>>hsCDDDDDs   =B0 0ADDc                     t          |          r|n|}t          j        | |          D ]2}||fD ]+}|r'|                    |          rt	          d| z            ,3d S )Nz7library at %s appears to have an absolute path embedded)r   r&   
get_dylibsr   RuntimeError)rc   rx   r  tools_prefixr   r`   s         rn   r  r    s    #),#7#7H<<[L |44  "L1 	 	F $//&11 "MPTT  	 r   c                    d }| j                             d          }t          | |          }d |D             }	t          | t                    s	t
          j                            |d| j        dz             }
dd l	}t
          j        
                    |
          sJ d|
             |                    t          |
                                                    }|d         }t
          j                            |dd	          }t
          j        
                    |          r4|                    t          |                                                    }|	||fS )
Nr   c                 $    g | ]}d D ]}||v |	S ))z.dylibr   z.dllr   r   )r   r_   r   s      rn   r   z,determine_package_nature.<locals>.<listcomp>  s7       (I !$STUXXXXXXr   z
conda-metaz.jsonr   zconda-meta :: Not a file: extracted_package_dirr   zrun_exports.json)r   r   r(   
isinstanceFakeDistrC   rc   r   	dist_namejsonr   loadsrG   rJ   )pkgr`   subdirbldpkgs_diroutput_folderchannel_urlsrun_exports
lib_prefix	codefilesdsos	json_filer@  	json_infoepdrun_exports_jsons                  rn   determine_package_naturerO    sD    K$$U++J%c622I   D
 c8$$ 
DGLLs}w7NOO	w~~i((RR*Ry*R*RRRRJJtI335566	/07<<V5GHH7>>*++ 	D**T*:%;%;%@%@%B%BCCK+z**r   c                    t          | |||||          \  }}}| j        dk    rdS | j        dk    rdS |rdS t          |          rGd |D             d |D             fd|D             }	t          |	          rd	S rrd
S rdS rdS n6t          | |          }
d |
D             }d |
D             }|r|rdS |rdS |rdS dS )ap  
    Result :: "non-library",
              "interpreted library (Python|R|Python,R)",
              "plugin library (Python|R|Python,R)",
              "dso library",
              "run-exports library",
              "interpreter (R)"
              "interpreter (Python)"
    .. in that order, i.e. if have both dsos and run_exports, it's a run_exports_library.
    rr   zinterpreter (Python)zr-basezinterpreter (R)run-exports libraryc                     g | ]}d |v |	S zsite-packagesr   r   dsos     rn   r   z"library_nature.<locals>.<listcomp>  s"    EEEso.D.Ds.D.D.Dr   c                     g | ]}d |v |	S zlib/R/libraryr   rT  s     rn   r   z"library_nature.<locals>.<listcomp>  s"    @@@#C)?)?#)?)?)?r   c                 "    g | ]}|z   v	|S r   r   )r   rU  python_dsosr_dsoss     rn   r   z"library_nature.<locals>.<listcomp>  s(    WWWs&;BV7V7V7V7V7Vr   dso libraryzplugin library (Python,R)zplugin library (Python)zplugin library (R)c                     g | ]}d |v |	S rS  r   r   s     rn   r   z"library_nature.<locals>.<listcomp>  s"    AAAaOq,@,@,@,@,@r   c                     g | ]}d |v |	S rW  r   r   s     rn   r   z"library_nature.<locals>.<listcomp>  s"    <<<!';';1';';';r   zinterpreted library (Python,R)zinterpreted library (Python)zinterpreted library (R)non-library)rO  r   r   r'   )rB  r`   rC  bldpkgs_dirsrE  rF  rJ  rG  r   dsos_without_pluginsr   python_filesr_filesrY  rZ  s                @@rn   library_naturerc    si    4VV\=, D+q x8%%	X		   -$$	T -EEdEEE@@@@@WWWWWtWWW#$$ 	, = ,v ,22 ,00 ,++, "#v..AA5AAA<<e<<< 	-G 	-33 	-11 	-,,=r   c                     g }ddl m}  ||          }| D ]-}|D ](}|j        d         |k    r|                    |           ).|S )Nr   )linked_data_no_multichannels)conda_build.utilsre  quadr   )r  r`   resultsre  pkgsr   rB  s          rn   dists_from_namesrj    sw    G>>>>>>''//D $ $ 	$ 	$Cx{d""s###	$ Nr   c                       e Zd Zd Zd ZdS )r>  c                 j    || _         |g| _        || _        || _        || _        || _        || _        d S r   )r   rg  r   build_numberbuild_stringchannelr   )selfr   r   rm  	build_strro  r   s          rn   __init__zFakeDist.__init__  s;    	F	(%


r   c                      |dk    r| j         S d S )Nr   )r   )rp  r   s     rn   getzFakeDist.get  s    7??: ?r   N)__name__
__module____qualname__rr  rt  r   r   rn   r>  r>    s2              r   r>  )z	/opt/X11/z/usr/lib/libSystem.B.dylibz/usr/lib/libcrypto.0.9.8.dylibz/usr/lib/libobjc.A.dyliba/  
                         '/System/Library/Frameworks/Accelerate.framework/*',
                         '/System/Library/Frameworks/AGL.framework/*',
                         '/System/Library/Frameworks/AppKit.framework/*',
                         '/System/Library/Frameworks/ApplicationServices.framework/*',
                         '/System/Library/Frameworks/AudioToolbox.framework/*',
                         '/System/Library/Frameworks/AudioUnit.framework/*',
                         '/System/Library/Frameworks/AVFoundation.framework/*',
                         '/System/Library/Frameworks/CFNetwork.framework/*',
                         '/System/Library/Frameworks/Carbon.framework/*',
                         '/System/Library/Frameworks/Cocoa.framework/*',
                         '/System/Library/Frameworks/CoreAudio.framework/*',
                         '/System/Library/Frameworks/CoreFoundation.framework/*',
                         '/System/Library/Frameworks/CoreGraphics.framework/*',
                         '/System/Library/Frameworks/CoreMedia.framework/*',
                         '/System/Library/Frameworks/CoreBluetooth.framework/*',
                         '/System/Library/Frameworks/CoreMIDI.framework/*',
                         '/System/Library/Frameworks/CoreMedia.framework/*',
                         '/System/Library/Frameworks/CoreServices.framework/*',
                         '/System/Library/Frameworks/CoreText.framework/*',
                         '/System/Library/Frameworks/CoreVideo.framework/*',
                         '/System/Library/Frameworks/CoreWLAN.framework/*',
                         '/System/Library/Frameworks/DiskArbitration.framework/*',
                         '/System/Library/Frameworks/Foundation.framework/*',
                         '/System/Library/Frameworks/GameController.framework/*',
                         '/System/Library/Frameworks/GLKit.framework/*',
                         '/System/Library/Frameworks/ImageIO.framework/*',
                         '/System/Library/Frameworks/IOBluetooth.framework/*',
                         '/System/Library/Frameworks/IOKit.framework/*',
                         '/System/Library/Frameworks/IOSurface.framework/*',
                         '/System/Library/Frameworks/OpenAL.framework/*',
                         '/System/Library/Frameworks/OpenGL.framework/*',
                         '/System/Library/Frameworks/Quartz.framework/*',
                         '/System/Library/Frameworks/QuartzCore.framework/*',
                         '/System/Library/Frameworks/Security.framework/*',
                         '/System/Library/Frameworks/StoreKit.framework/*',
                         '/System/Library/Frameworks/SystemConfiguration.framework/*',
                         '/System/Library/Frameworks/WebKit.framework/*'
)z**/ADVAPI32.dllz**/bcrypt.dllz**/COMCTL32.dllz**/COMDLG32.dllz**/CRYPT32.dllz**/dbghelp.dllz**/GDI32.dllz**/IMM32.dllz**/KERNEL32.dllz**/NETAPI32.dllz**/ole32.dllz**/OLEAUT32.dllz**/PSAPI.DLLz**/RPCRT4.dllz**/SHELL32.dllz**/USER32.dllz**/USERENV.dllz**/WINHTTP.dllz**/WS2_32.dllz**/ntdll.dllz**/msvcrt.dllc                 .   t                      }t                      }d}| r't          |                                           d         }|D ]}	t	          ||	          }
t          |
          s#|                    t          j        d          }|                    t          j        d          }t          |
dd||          }|
                                D ]\  }}|d                             t          j        d          }| 
                                D ]J\  }}|                    |          r|                    ||          }1|dd          |v r||dd          z   }K||k    r+|                    |          r|                    ||          }|                    |          r.t          ||                              t          j        d          }||d<   |||	<   |                    d	 |
                                D                       }||fS )
Nr	  r   r   TF)resolve_filenamesrecursesysrootenvrootresolvedr@   c                 $    h | ]\  }}|d          S )r}  r   )r   r_   r   s      rn   	<setcomp>z'_collect_needed_dsos.<locals>.<setcomp>i  s!    <<<'!TT*<<<r   )r   dictr   keysr   r/   r   rC   r   r*   itemsr   r   union)sysroots_filesr   
run_prefixsysroot_substitutionr  build_prefix_substitutionall_needed_dsosneeded_dsos_for_filesysrootsr_   rc   neededr   resr}  r{  sysroot_filess                    rn   _collect_needed_dsosr  =  s7    eeO66H 2++--..q1  
  
J""T"" 	#++BFC88''44
&"
 
 
  	' 	'HC:..rvs;;H*8*>*>*@*@ C C&&&w// C'//9MNNHHabb\]223hqrrlBH z))h.A.A,.O.O)#++L:STT"":.. N"8Z88@@MM 'C
OO"(Q)//<<V\\^^<<<
 
 000r   c           
         i }i }	i }
i }d |D             }|r||fD ]}i ||<   i ||<   t          j        |          D ]\  }}}|D ]v}t          ||          t          fddD                       ot	          d          d u}t          fddD                       }|s|sat          t          |                                        dd	          |rt          fd
|D                       st          fd||         D                       r҉                    dd	          }|||         v r||         |         ng }t          |          s0t          fd| D                       r|	                    |           t          t          |d                    }|D ]}||vr|	                    |           |||         |<   t          ||         |                   r҈fdt          |          D             }|||         |<   |rd|	||         |         d         <   |r|v rr||         |         d         j                            d          s||         |         d         j        dk    r8t          d d||         |         d                     d|
||         |         d         <   x||	|
|fS )Nc                 6    g | ]}|                                 S r   r   )r   rB   s     rn   r   z(_map_file_to_package.<locals>.<listcomp>  s     @@@1QWWYY@@@r   c              3   8   K   | ]}t          |          V  d S r   r   r   r   fps     rn   r   z'_map_file_to_package.<locals>.<genexpr>  s-      WWGB,,WWWWWWr   )z*.so*z*.dylib*z*.dllF)skip_symlinksc              3   8   K   | ]}t          |          V  d S r   r   r  s     rn   r   z'_map_file_to_package.<locals>.<genexpr>  s-      $R$R#WR%5%5$R$R$R$R$R$Rr   )z*.az*.lib\r   c              3   H   K   | ]}                                 |k    V  d S r   r  r   rB   r2  s     rn   r   z'_map_file_to_package.<locals>.<genexpr>  s@       / /,-

a/ / / / / /r   c              3   >   K   | ]}t          |          k    V  d S r   r   r  s     rn   r   z'_map_file_to_package.<locals>.<genexpr>  s.      NN2!,NNNNNNr   c              3   >   K   | ]}t          |          k    V  d S r   r   r  s     rn   r   z'_map_file_to_package.<locals>.<genexpr>  s.      @@QrXa[[0@@@@@@r   Tavoid_canonical_channel_namec                 L    h | ]t          fd D                        S )c              3   8   K   | ]}t          |          V  d S r   r   )r   patternr   s     rn   r   z1_map_file_to_package.<locals>.<setcomp>.<genexpr>  s>       ' '8?7 3 3' ' ' ' ' 'r   r   )r   r   ignore_list_symss    @rn   r  z'_map_file_to_package.<locals>.<setcomp>  sb     # # # ! $' ' ' ' 'CS' ' ' $ $## # #r   )enable_staticr   gcc_impl_linuxllvmzsysroot in z, owner is )rC   walkr   r   r/   r   r   r   r   r   r   r$   r)   r   r   r\   )r   r  r  r  pkg_vendored_distr  r  r  prefix_ownerscontains_dsoscontains_static_libsall_lib_exportsall_needed_dsos_lowerr`   subdir2r   filezr   dynamic_lib
static_librp_poownersnew_pkgsnew_pkgexportsr  r2  s        `                   @@rn   _map_file_to_packager  n  s    MMO@@@@@ EY!<0 D	Y D	YF&(OF#$&M&!%'WV__ AY AY!E! @Y @YDgt,,BWWWW8VWWWWW O)"EBBB$N   "%$R$R$R$RAQ$R$R$R!R!RJ& !z ! !'"f"5"566>>tSIIB" !3 / / / /1F/ / / , , ! !NNNNof6MNNNNN ! JJtS11E !M&$999 &f-e44  v;; =@@@@%@@@@@ ="MM*;<<<#%b&tTTT   H $, 3 3"&00"MM'22239M&)%0=0788 Y# # # #%9 "-& & &# # # :A/6& YMQM-*?*Fq*IJJ' Y3r99$1&$9%$@$C$H$S$S(8%& %&!- (5V'<U'CA'F'Kv'U'U$, %$b"$b$bvAVW\A]^_A`$b$b!" !" !" UY0v1Fu1Ma1PQA@YAYF -)=NNr   c                     | }t          |          }|}|}	d                    |||g          }
t          |||	|||          |
fS )Nrt   )r   r   r>  )pkg_namepkg_versionrq  rm  ro  r   pkg_vendoring_namepkg_vendoring_versionpkg_vendoring_build_strpkg_vendoring_build_numberpkg_vendoring_keys              rn   _get_fake_pkg_distr    sr    !,,'!-	24KL 
 	!&#	
 	
 	
 
r   c                     |                     d          r|                     |           |rt          |           d S d S )Nz  ERROR)r   r   r\   )errorstextr
  s      rn   
_print_msgr    sI    y!! d d r   c                                          dd          t          j        dt                    z             j        fd| D             }|S )Nr  r   z(?i)c                     g | ]=}|                     d d          k    s |                     d d                    ;|>S r  r   r   )r   rc   rT   pats     rn   r   z,caseless_sepless_fnmatch.<locals>.<listcomp>  sY       LLs##s**uuT\\$5L5L/M/M* 	***r   )r   rM   rN   fnmatch_translaterT   )pathsr  matchesrT   s    ` @rn   caseless_sepless_fnmatchr    sk    
++dC
 
 CJv 1# 6 6677=E      G
 Nr   c
           	         |                     |          r#|gd |                                D             z   }
n|g}
d}d}t          |          rg }|                                D ]\  }}|                    dt          j                  }|                     |          r*|                    |                    ||                     dt          ||dd                    }|                    |           t          |          r1d}|                     d          sd|v r&|d         }d	| }t          | | d
| d|	           ng }t          t          |                    D ]n}||         t          |          dz   d          }d	| }t          t          ||                    }t          |          dk    r|                    |            not          |          r.t          | d                    |||d                   |	           n&t          | d                    ||          |	           |sZ|
D ]W}|                    ||dz             t          fd|D                       }|rd	 }t          | | d
| d|	            nX|s*|s*t          | d                    ||          |	           d S d S d S )Nc                     g | ]\  }}|S r   r   )r   r{  r   s      rn   r   z5_lookup_in_sysroots_and_whitelist.<locals>.<listcomp>  s)     1
 1
 1
"G1
 1
 1
r   Fr  r@   Tosx-r4   r   zNeeded DSO r   z found in $SYSROOTr
  z'{}: {} found in CDT/compiler package {}zA{}: {} not found in any CDT/compiler package, nor the whitelist?!r   c                 2    g | ]}t          g|          S r   r  )r   rB   needed_dso_ws     rn   r   z5_lookup_in_sysroots_and_whitelist.<locals>.<listcomp>D  s&    PPP)<.!<<PPPr    found in the whitelistzf{}: {} not found in packages, sysroot(s) nor the missing_dso_whitelist.
.. is this binary repackaging?)r   r  r   r   rC   r   r   r  extendr  ranger   r$   r   r   )r  	whitelist
needed_dsor  msg_preludeinfo_preludesysroot_prefixr  rC  r
  replacementsin_whitelistin_sysrootsr  r{  r   
sysroot_osfoundin_prefix_dson_dso_pri  idx_pkgsreplacementr  s                           @rn   !_lookup_in_sysroots_and_whitelistr    s    122 $,- 1
 1
&4&:&:&<&<1
 1
 1
 
 #|LK
> 3,2244 		, 		,NGU rv66J$$%9:: ,$$&&';ZHH    1
122GG$$U++++} &	K  (( $EVOO -a 0777#BBwBBB#      ]!3!344  C %2#$6s>7J7JQ7N7P7P$QM;M;;G }n!M!MNNE5zzA~~E*** & t99 AHH('47  !(     //5vk7/K/K '	     ' 	 	K%--.BKRUDUVVLPPPPiPPP L  666#GGwGGG#   
   
 
--3VK-L-L		
 	
 	
 	
 	
 	

 
 
 
r   c           	      D  	 t          |          d                                        dd                    }|v rdnd}t          t	          |d                    }	fd|D             }|D ]}||
v r|                    |           t          fd	|D                       }t          |          d
k    r0t          | d                    |||d         |          |           d S |rt          | | d| d|           d S t          |          dk    rwt          |          dk    rdt          | d                    ||d |D             |          |           t          | d                    |d |D                       |           d S t          |          d
k    r*t          | d                    |||          |           d S t          fd|D                       st          | | d d|           d S |rt          | | d d|           d S d S )NzNeeded DSO {}r  r   z (and also in this package)r	  Tr  c                 2    g | ]}|j         d          v |S r   rg  )r   rB  requirements_runs     rn   r   z._lookup_in_prefix_packages.<locals>.<listcomp>k  s*    RRR3#(1+AQ2Q2Q32Q2Q2Qr   c                 0    g | ]}t          |          S r   r   r   rB   r  s     rn   r   z._lookup_in_prefix_packages.<locals>.<listcomp>p  s#    EEEaq11EEEr   r@   z{}: {} found in {}{}r   r  r   r  c                 (    g | ]}|j         d          S r  r  r   ps     rn   r   z._lookup_in_prefix_packages.<locals>.<listcomp>  s    &?&?&?Qqvay&?&?&?r   zf{}: .. but {} not in reqs/run, (i.e. it is overlinking) (likely) or a missing dependency (less likely)c                 (    g | ]}|j         d          S r  r  r  s     rn   r   z._lookup_in_prefix_packages.<locals>.<listcomp>  s    666AafQi666r   z3{}: {} found in multiple packages in run/reqs: {}{}c              3   >   K   | ]}t          |          k    V  d S r   r   r  s     rn   r   z-_lookup_in_prefix_packages.<locals>.<genexpr>  s.      ??A=HQKK/??????r   z not found in any packagesz found in this package)	r   r   r   r   r$   r   r   r   r  )r  r  r   r  r  r  r  warn_preluder
  r  lib_packageslib_packages_usedr  and_alsori  in_pkgs_in_run_reqsrB  r  r  s            `        @rn   _lookup_in_prefix_packagesr  W  sL    Z((M$$]%:%:4%E%EFFG0=0F0F,,BHmZdSSS D SRRR$RRR" ' ',!!#&&&EEEE9EEEFFL
1$$"))g':1'=x  	
 	
 	
 	
 	
 	
 
 *??w???	
 	
 	
 	
 	
 	

 
 	!	!Q	&	&3t99q=="))W&?&?$&?&?&?  	
 	
 	
 	
 	>>Df66666? ? 	
 	
 	
 	
 	
 	
 
 	!	!A	%	%AHHm-@(  	
 	
 	
 	
 	
 	
 ????????? 	KK-KKK     
  	HH=HHH     	 	r   c                    t          |          rd|                                D ]O\  }}t          |d                    |t	          t          |          d          dd                   |           P| D ]Kt          |          }t          |          }|r(|t          |	                    d          d                  vrMd	                    |
                    t          j        d
                    }d                    |
                    t          j        d
                    }d                    |
                    t          j        d
                    }|r|n|}	 t          |          \  }}}n#  t          || d|           Y xY w|r7|s5t          fd|D                       st          || d| d| |           |         }|                                D ]\  }}|
                    d
t          j                  }d|v r|d         }|                    t          j                  s0|                    d          st!          ||| |||||||	|
|           |                    d          r't          |d                    ||          |           t#          ||||||||||
  
         ՐMd S )Nz"   INFO: sysroot: '{}' files: '{}'T)reverser@      r  rt   r   zWARNING ({},{})r   z  ERROR ({},{})z   INFO ({},{})z: pyldd.py failed to processc              3   8   K   | ]}t          |          V  d S r   r   )r   rB   r_   s     rn   r   z)_show_linking_messages.<locals>.<genexpr>  s+      $N$NqWQ]]$N$N$N$N$N$Nr   z: runpaths z
 found in r}  $$PATHz1{}: {} found in build prefix; should never happen)r   r  r  r   sortedr   r   r/   filetypes_for_platformrv   r   rC   r   r,   r   r   r  r  )r   r  r  r  r  r  error_overlinkingrunpath_whitelistr
  r  r  r  r  r  r  r  rC  r{  sr_filesrc   filetyper  err_preluder  r  runpathsr   r  r  needed_dso_infor_   s                                 @rn   _show_linking_messagesr    s{   & 8}} !)!1!1 	 	GX4;;VDNNDAAA!A#F         D DJ"" && 	8+A&,,sBSBSTUBV+WWW(//!))BFC:P:PQQ'..x2639O9OPP(//!))BFC:P:PQQ%6HkkL	-d33NHa	<EEEw    H 		!$$N$N$N$N<M$N$N$N!N!N	 EE8EEtEE   
 &a(+1<<>> )	 )	'J#++C88J _,,,Z8
((00 #9N9Ns9S9S #*  $ %    &&w// GNN#Z  $     2 "(   =)	7D Ds   'E;;Fc                 &  	MN d}g }g }g }|D ]}t          	|          }t          |          }|r=|t                              d          d                  v r|                    |           |                    |                    dd                     |st                      S d}d}d |D             }t          |	          }t          j	        r#t                                        dd          nt                    d	d          } t          | |||| |          \  }!}"|                    |!           t          j        |          M                    d
          rM                    d           	fd|D             }#Mfd|D             }$|!h}%g d}&|                    dd           }'|'r%t          j                            |'          rd}(|'g})n/|
}(d t          j        t          |(dd                    D             })g }*t                      }+d},t'          |)          sh                    d          r g d})t(          }*t*          j        dk    rdnd},n3                    d          rdg})t.          }*t*          j        dk    rdnd},|*|pg z  }*t                      }-|)D ]}.ddlm}/ |.                    d          r|.n|.dz   }0 |/|.          }1d |1D             }1|1|-|0<                       d          rt7          |1          }2g }1|2D ]}|}3|                    d          rt9          t          j                             |.|          d          5 }4d |4                                                    d                                           D             }5d d d            n# 1 swxY w Y   |5rGd! |5D             }6d" |6D             }6|6d         d	d          }3|3                    d#          r
|3d	d$         }3|1                    |3           tA          |2          tA          |1          z
  }7|7r\t          j!        tD                    }8|8#                    d%$                    |.tK          |7          d	d&                              |1|-|0<   tM          tO          |-(                                d' (                    }-tS          |-|	||
|          \  }9}:tU          |	|
|9|!|&||          \  };}<}<}=|D ]}|:|         }>|>(                                D ]\  }?}@|?N|@d)         }A|A                    d          s|A                    |          s|A                    |          s|A+                                d* |;	         D             vrY|A|vrUd}B|,stY          Nfd+|*D                       }B|Bs4|A|;|
         v rt[          d,|? d-           |?                    d          s	 Όt]          |||:|
	| |||||$|%|*|-|(|           |%|$k    rd.|  d/}Cd0|  d/}Dd1|  d/}E|$|%z
  D ]}F|#|F         d2v r|r|En|D}Gn|#|F         d3k    r|C}Gn|D}Gd}Hd4|#|F         v rd5|#|!         v rd}H|Hr2t_          |d6$                    |C|!j0        |Fj0                  |7           p|#|F         d8k    r-t_          |d9$                    |G|#|F         |F          |7           t'          |          r|rd: |D             }It'          |I          rtc          |I          d; |D             }Jt'          |J          rte          |J          d< |D             }Kt'          |K          rtg          |K          nt+          j4        d	           |"|+v r
|+|"         }L|LS t                      S )=NTrt   r   r  r   z$SYSROOTr  c                 D    g | ]}|                     d           d         S r   r   rv   r   reqs     rn   r   z*check_overlinking_impl.<locals>.<listcomp>4  s'    FFFc		#q)FFFr   r@   r6   z	libgcc-ngc                 :    i | ]}|t          |          S r   )rc  )r   packager_  rF  rE  r  rC  s     rn   
<dictcomp>z*check_overlinking_impl.<locals>.<dictcomp>C  sD         	Z}l
 
  r   c                 @    h | ]}|j         d          v|gdk    |S )r   r^  r  )r   r  ignore_lists     rn   r  z)check_overlinking_impl.<locals>.<setcomp>I  s@       <?+--7)}2L2L 	2L2L2Lr   )main_mainz*get_pc_thunk*___clang_call_terminate_timeoutCONDA_BUILD_SYSROOTr	  c                 ,    g | ]}|t           j        z   S r   )rC   r   )r   r{  s     rn   r   z*check_overlinking_impl.<locals>.<listcomp>b  s/     
 
 
 bf
 
 
r   z**r{  Fr  )z/usr/libz/opt/X11z/System/Library/Frameworksr>   r4   z
C:/Windowszwin-32)prefix_filesc                 :    g | ]}|                     d d          S r  r  r  s     rn   r   z*check_overlinking_impl.<locals>.<listcomp>  s&    EEE!4--EEEr   z.tbdrbc                 <    g | ]}|                     d           |S )zinstall-name:)r   r   lines     rn   r   z*check_overlinking_impl.<locals>.<listcomp>  s:     ! ! ! $#??! ! ! !r   r  c                 8    g | ]}t          j        d |          S )z^install-name:\s+(.*)$rM   rT   r  s     rn   r   z*check_overlinking_impl.<locals>.<listcomp>  s2     ) ) )JNBH%>EE) ) )r   c                 D    g | ]}|                     d           d         S )r@   r   )r   )r   insnames     rn   r   z*check_overlinking_impl.<locals>.<listcomp>  s6     ) ) )5<GNN1--a0) ) )r   'r   zPartially parsed some '.tbd' files in sysroot {}, pretending .tbds are their install-names
Adding support to 'conda-build' for parsing these in 'liefldd.py' would be easy and useful:
{} ...   c                 .    t          | d                    S )Nr@   )r   )xs    rn   <lambda>z(check_overlinking_impl.<locals>.<lambda>  s    c!A$iiZ r   r   r}  c                 6    g | ]}|                                 S r   r  )r   os     rn   r   z*check_overlinking_impl.<locals>.<listcomp>  s     EEEa		EEEr   c                 2    g | ]}t          g|          S r   r  )r   rB   origs     rn   r   z*check_overlinking_impl.<locals>.<listcomp>  s&    PPP14&!<<PPPr   z  ERROR :: z in prefix_owners[build_prefix]z	   INFO (r   z	WARNING (z	  ERROR ()rQ  r[  zplugin libraryinterpreterinterpretedz3{}: Interpreted package '{}' is interpreted by '{}'r  r^  z{}: {} package {} in requirements/run but it is not used (i.e. it is overdepending or perhaps statically linked? If that is what you want then add it to `build/ignore_run_exports`)c                 <    g | ]}t          j        d |          |S )z.*runpaths.*found in.*r!  r   errors     rn   r   z*check_overlinking_impl.<locals>.<listcomp>  s;       RX6OQV-W-W  r   c                 <    g | ]}t          j        d |          |S )z+.*(overlinking|not found in|did not find).*r!  r0  s     rn   r   z*check_overlinking_impl.<locals>.<listcomp>"  s;     " " "8JERR"" " "r   c                     g | ]}d |v |	S )overdependingr   r0  s     rn   r   z*check_overlinking_impl.<locals>.<listcomp>)  s)     $ $ $_-E-E-E-E-Er   )5r   r/   r   rv   r   r   r  rj  r   on_winr   r  ensure_listr   rt  rC   rc   r   r   r   DEFAULT_MAC_WHITELISTrX   rY   DEFAULT_WIN_WHITELISTrf  r  r   r   rG   rJ   r^   r%  r   
get_loggerru  warningr   r   r   r  r  r  r  r   r   r\   r  r  r   r#   r"   r!   r   )Or  r  rq  rm  rC  ignore_run_exportsr  requirements_buildrequirements_hostr  r  missing_dso_whitelistr  r  error_overdependingr
  exception_on_errorr   r_  rE  rF  r  variantsr  files_to_inspectfilesur_   rc   r  r  r  packageslocal_channelr  r  package_naturer  r  r  r  r  r  r  vendoring_recordbuild_is_hostr  r{  r  srsr  orig_sysroot_filesreplacedtbd_fhlinesinstall_namesdiffslogr  r  r  r   r  r  r  r  r}  r  r  r  r  r   r  !found_interpreted_and_interpreterrunpaths_errorsoverlinking_errorsoverdepending_errorsimportsr  r,  sO       `    `        ```                                                        @@rn   check_overlinking_implrV  	  sy
   2 GFF , ,J"" && 	'$:6<<;L;LQ;O$PPP##A&&&aiic**++++ vv% 'FF5EFFF 0*==H <	'%%dC000\""122& 
 ,>+y,u, ,(( OO%&&&#$677K!! (;'''         	  N     L
 ++   #,,'<dCC 
rw~~.ABB 
 '( &
 
 :d>4&K&KLL
 
 
 Ivv Mx== HV$$ 	H NMMH-I$'LH$<$<DD%MMu%% 	H$~H-I$'LH$<$<DD%M&,",I VVN )4 )4222222 ))#..AggGcM$W--EE}EEE+sV$$ "	4!%m!4!4M' / /::f%% 6 bgll7A66== ! !(.(<(<W(E(E(P(P(R(R! ! !                
6) )RW) ) )) )@M) ) ) $1#3ABB#7#,,S11 6'/"~H$$X....*++c-.@.@@E 4&x00#VGT%[[1-=>>  
 '4s# ~##%%+?+?@@@ N -A!- -)O) ,@	, 	,(M1a   %a(+1<<>> 	 	'JD&z2H'',, ++,@AA !++,EFF NN$$EE=+DEEEF FF**$$ #&PPPPiPPP$ $L $ =#>>>WJWWWXXXX'227;; 
 ;	> #  ( L((.8....8...-(---"33 	 	Cc"&LLL-@Rkkl$(888**05-!444!^4E%FFF4810 IPP$&7&<ch  $      $55ZZ`Z`#^C%8#[ [ $    6{{  	 #)  O ?## 4"?333" "#" " "
 %&& ;&'9:::$ $#)$ $ $  '(( ?()=>>>? HQKKK,,,"#45vvs   !AN11N58N5c                    |s| j         j        }| j                            di                               d          rfd|D             }t	          |                     d          |                     d          |                     d          |                     d          | j         j        |                     d          d	 | j                            d
i                               dg           D             d | j                            d
i                               dg           D             d | j                            d
i                               dg           D             || j         j        | j                            di                               dg           | j                            di                               dg           | j         j        | j         j	        | j         j
        d|| j         j        | j         j        t          | j         j                  dgz   | j         j        | j         j                  S )Nbuildoverlinking_ignore_patternsc                 L    g | ]t          fd D                        S )c                 0    g | ]}t          |          S r   r   )r   r  r_   s     rn   r   z0check_overlinking.<locals>.<listcomp>.<listcomp>C  s!    KKK!1KKKr   r  )r   r_   rY  s    @rn   r   z%check_overlinking.<locals>.<listcomp>@  sN     
 
 
KKKK/JKKKLL

 
 
r   zpackage/namezpackage/versionzbuild/stringzbuild/numberzbuild/ignore_run_exportsc                 D    g | ]}|                     d           d         S r  r  r  s     rn   r   z%check_overlinking.<locals>.<listcomp>L  s'    TTTs3	TTTr   requirementsrunc                 D    g | ]}|                     d           d         S r  r  r  s     rn   r   z%check_overlinking.<locals>.<listcomp>M  s'    VVVs3	VVVr   c                 D    g | ]}|                     d           d         S r  r  r  s     rn   r   z%check_overlinking.<locals>.<listcomp>N  s'    UUUs3	UUUr   hostr>  r  Tlocal)rz   rx   metart  rV  	get_valuetarget_subdirr  r  r?  r
  rD  rE  r   rF  r  ru   )ri   r   rx   rY  s      @rn   check_overlinkingrf  8  s    +h*"#&**Wb"9"9"="=%# # # 

 
 
 

 
 

 "	N##	%&&	N##	N##		.//TTafjj&D&D&H&HPR&S&STTTVVafjj&D&D&H&HRT&U&UVVVUUafjj&D&D&H&HQS&T&TUUU		

7B##$;R@@	

7B##$7<<	"	$			QX"##wi/		/  r   c           	         |s| j         j        }t          ||          }t          |          }|r|                    d          rd S |                     ddg          }|dk    r)t          ||||                     dd                      d S |dk    rW| j         j        dk    r1t          j	        t                    }|                    d	|           d S t          ||| ||
           d S d S )Nz.debugzbuild/rpathsr   r3   zbuild/rpaths_patcher)r  r*  r2   r5   zGFound Mach-O file but patching is only supported on macOS, skipping: %s)r   r  )rz   rx   r   r/   r   rd  r5  host_platformr   r9  ru  warnr  )ri   r_   r   rx   rc   
codefile_tr  rP  s           rn   post_process_shared_librk  `  s#    +h*QDt$$J x00 [[%11FY;;5t<<		
 	
 	
 	
 	
 	
 
{	"	"8!U**"8,,CHHY   Fk1E&IIIIII 
#	"r   c                    t          d           t          j        |          D ]+}|                                rt	          |j        d           ,| D ]'}t          ||          }t          j        |          }t          j	        |j
                  }|}|t          j        z  r|t          j        z  t          j        z  }|t          j        z  t          j        z  t          j        z  t          j        z  t          j        z  }||k    rq	 t	          ||           # t&          t(          j        f$ rF}t)          j        t.                    }|                    t3          |                     Y d }~d }~ww xY w)d S )NzFixing permissionsr8   )r\   rC   r   is_dirr   rc   r   lstatrD   S_IMODEst_modeS_IXUSRS_IXGRPS_IXOTHS_IWUSRS_IWGRPS_IRUSRS_IRGRPS_IROTHrS   r   PermissionErrorr9  ru  ri  r   )	r   r`   rc   r_   stold_modenew_moder   rP  s	            rn   fix_permissionsr}  z  s   	

6"" % %;;== 	%49e$$$ ! !FAXd^^<
++dl" 	>$,.=H ll l l	
 l 	 x!tX&&&&U23 ! ! !&x00Q        !  #! !s   	DE60;E11E6c                    t          dt          |                     |s| j        j        }|s|D ]}t	          ||           | j        j                            d          s|                                 }|st          d           | j        j                            d          o"t          | 	                    dd                    }t          ||| j        j                   t          j        |          }|D ]Y}|                    d          rt          ||||           |d	u st          |t                     r||v rt#          | |||           Zt%          | ||           d S )
Nznumber of files:r4   z Skipping binary relocation logicr  zbuild/osx_is_appFzbin/)r`   ra   rb   T)r\   r   rz   rx   make_hardlink_copyre  r   binary_relocationboolrd  check_symlinkscrootr   r  ro   r=  r   rk  rf  )	ri   r   ra   rx   is_already_linkedr_   r  rb   r  s	            rn   
post_buildr    s   	
c%jj))) +h* / 	/ 	/Aq+....8!,,U33 I//11  	64555X+66v>> 
4KK*E22D
 D

 	uk18>:::)+66 	I 	IA||F## &!-)	    !D((,d33 )89=N8N8N'1lKHHHa,,,,,r   c           
      r   t           du rd S g }t          |          }| D ][}t          ||          }t          |          r8t          |          }t          |          }t	          |          t	          |          k    s9t          |          r*t          j        |           t          j	        ||           |
                    |          r|t          |t	          |                    }	|
                    d          sH||	k    rBt          d| d| d|	 d           t          j        |           t          j        |	|           +|
                    |          r|                    |d|d           ]|r9|D ] }
t          d|
z  t           j        	           !t!          j        d
           d S d S )NFrq   z"Making absolute symlink relative (z -> z :-> r   zI is a symlink to a path that may not exist after the build is completed (z	Error: %s)r   r@   )r   r   r   r   r   r/   rC   remover   r   r   r   r\   r   symlinkr   rX   stderrr   )r   r`   r  msgsreal_build_prefixr_   rc   	link_pathreal_link_pathrelative_pathmsgs              rn   r  r    s   5D ((  %q))$<< 	 I%d^^N 9%%)@)@@@]STEUEU@	$5555**+<==  !( F F ++C00 	4Y-5O5O
 dQddIddTaddd   IdOOOJ}d333 ",,U33 KKEFQQ			S  
   	6 	6C+##*55555 r   c                    t          |           st          t          ||                     } t          |           }t	          j        |           j        dk    rut                      5 }t          j	        | |           t          j
        |            t          j	        t          ||          |            ddd           dS # 1 swxY w Y   dS dS )zkHardlinks create invalid packages.  Copy files to break the link.
    Symlinks are OK, and unaffected here.r@   N)r   r   r   r   rC   rn  st_nlinkr   r   r   r   )rc   r`   r{   dests       rn   r  r    s     ;; ,VT**++	$B	x~~""!! 	2TOD$'''K ODrNND111	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 #"s   'ACCCc                 &   | j         j        }t          t          |d                    rt	          d          t          t          |d                    rt	          d          t          t          |d                    rt	          d          d S )Nz__conda_version__.txtzsupport for __conda_version__ has been removed as of Conda-build 3.0.Try Jinja templates instead: http://conda.pydata.org/docs/building/meta-yaml.html#templating-with-jinjaz__conda_buildnum__.txtzsupport for __conda_buildnum__ has been removed as of Conda-build 3.0.Try Jinja templates instead: http://conda.pydata.org/docs/building/meta-yaml.html#templating-with-jinjaz__conda_buildstr__.txtzsupport for __conda_buildstr__ has been removed as of Conda-build 3.0.Try Jinja templates instead: http://conda.pydata.org/docs/building/meta-yaml.html#templating-with-jinja)rz   work_dirr   r   r(  )ri   src_dirs     rn   get_build_metadatar    s    hGd734455 
Y
 
 	

 d745566 
Y
 
 	

 d745566 
Y
 
 	

 
r   )F)r   )FFr   r   )r  )r  N)NF)grH   rC   rM   r   rD   rX   collectionsr   r   r   r   r   r   r	   r  	functoolsr
   os.pathr   r   r   r   r   r   r   r   r   r   r   r   r   
subprocessr   r   r   r   ImportErrorconda_buildr   conda_build.conda_interfacer   r   r   r    conda_build.exceptionsr!   r"   r#   conda_build.inspect_pkgr$   conda_build.os_utilsr%   r&   conda_build.os_utils.lddr'   r(   conda_build.os_utils.lieflddr)   r*   r+   r,   r-   r.   conda_build.os_utils.pylddr/   r   ro   r}   r   r   r   r   r   r   r   r   r   r  r  r5  r  rO  rc  rj  r>  r7  r8  r  r  r  r  r  r  r  r  rV  rf  rk  r}  r  r  r  r  r   r   rn   <module>r     s    				 				   



 0 0 0 0 0 0 0 0       , , , , , ,       2 2 2 2 2 2                                    > = = = = = = = = =   HHH                  V U U U U U U U U U 1 1 1 1 1 1 0 0 0 0 0 0 0 0 M M M M M M M M                5 4 4 4 4 4 "=[  C( C( C( C(L
  
  
 @2 @2 @2 @2F
* 
* 
*( ( (( ( (  7, 7, 7, 7,t  , 2 2 2 24'8 '8 '8 '8T6 6 6r(= (= (= (=V6rUE UE UE UEp  + + +4- - -`	 	 	        , , , `   2.1 .1 .1bZO ZO ZOz  ,    a
 a
 a
HL L L^` ` `r /l l l l^	% % % %PJ J J J4! ! !> -  -  -  -F) ) )X2 2 2$
 
 
 
 
s   (A/ /A98A9