
    8xd                       d Z 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Z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mZmZmZmZ ddlZddlZddlZddlmZ ddlmZ  ddl!m"Z" ddl#m$c m%Z% ddl&mZ' ddl&m(Z(m)Z)m*Z*m+Z+ ddl,m-Z- dd	l.m/Z/ dd
l0m1Z1m2Z2 ddl3m4Z4m5Z5 ddl6m7Z7m8Z8 ddl9m:Z:m;Z;m<Z<m=Z= ddl>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZG ddlHmIZImJZJmKZK ddlLmMZMmNZNmOZOmPZPmQZQmRZRmSZSmTZTmUZUmVZVmWZWmXZXmYZYmZZZm[Z[m\Z\m]Z] ddl+m^Z^m_Z_m`Z`maZambZbmcZcmdZd eje        dk    rddlfmgZg deje        v rdZhne+ji        rdZhndZhd Zjd Zkd Zld Zmd Znd Zod Zpdd e            fd Zqd! Zrd e            fd"Zsdgd#Ztd$ Zud% Zvdi ddfd&Zwd' Zxdhd(Zydgd)Zzd* Z{d+ Z|d, Z}d- Z~d. Zd/ Zd0 Zd1 Zd2 Zd3 Zd4 Zd5 Zd6 Zd7 Zd8 Zd9 Zd: Zd; Zd< Zd= Zd> Zd? Zd@ ZdA ZdB ZdC ZdD ZdE ZdF ZdgdGZdH ZdI ZdJ ZdK ZdL ZdM ZeeedNZdO ZdP ZdQ Z	 	 	 	 	 	 didSZdT ZdU ZdV ZdW ZdX ZdY ZdZ Zd[ Z	 djd]Z	 	 dkd^Zd_ Zd` Z	 dldaZdb Zdc Zdd ZdgdeZdmdfZdS )nzM
Module that does most of the heavy lifting for the ``conda build`` command.
    N)OrderedDictdeque)dirnameisdirisfileislinkjoin)UnicodeDammit)__version__)environsourcetarcheckutils)Config)create_all_test_files)CondaBuildExceptionDependencyNeedsBuildingError)_delegated_update_indexget_build_index)FIELDSMetaData)fix_permissionsget_build_metadata
post_buildpost_process)	add_upstream_pinsbldpkg_pathdistribute_variantsexecute_download_actionsexpand_outputsoutput_yamlrender_recipereparsetry_download)dict_of_lists_to_list_of_dictsget_package_variantsset_language_env_vars   )
CondaErrorEntityEncoderFileMode	MatchSpecNoPackagesFoundErrorPathTypeTemporaryDirectoryUnsatisfiableErrorcontextenv_path_backup_var_existsget_conda_channelget_rc_urls	pkgs_dirsprefix_placeholderreset_contextroot_dirurl_path)CONDA_PACKAGE_EXTENSION_V1CONDA_PACKAGE_EXTENSION_V2CONDA_PACKAGE_EXTENSIONSenv_varglobshutil_move_more_retrying	tmp_chdirwin32bsdz/bin/shbashz	/bin/bashc                                                       }d                     fd|D                       } j        j                            d          }|r| j        j        k    rd|vr|d|z   z  }                                                                  g}|r|                    |           d                    |          }||z   }|S )N-c                 f    g | ]-}|d k    |dz   t          j        j        |                   z   .S )target_platform_)strconfigvariant).0kmetadatas     1lib/python3.11/site-packages/conda_build/build.py
<listcomp>zstats_key.<locals>.<listcomp>n   sJ     	
 	
 	
%%% Gc(/1!4555%%%    rG   z-target_)	get_used_loop_varsr	   rJ   rK   getsubdirnameversionappend)rN   descused_loop_vars
build_varstpkeys   `     rO   	stats_keyr]   j   s    0022N	
 	
 	
 	
#	
 	
 	
 J 
	 	$	$%6	7	7B	 &bHO***/@
/R/Rj2o%
==??H,,..
/C 

:
((3--C
*CJrQ   c                    t          d                    ||                     dd          |                     d          rt          j        | d                   nd|                     d          rt          j        | d                   nd|                     d          rt          j        | d                   ndt          j        | d                   t          j        | d	                   
                     d S )Nz
Resource usage statistics from {descriptor}:
   Process count: {processes}
   CPU time: Sys={cpu_sys}, User={cpu_user}
   Memory: {memory}
   Disk usage: {disk}
   Time elapsed: {elapsed}

	processesr(   cpu_sysrE   cpu_userrssdiskelapsed)
descriptorr_   r`   ra   memoryrc   rd   )printformatrS   r   seconds2humanbytes2human)
stats_dictre   s     rO   	log_statsrl      s    		 V! nn[!44~~i((E'
9(=>>>~~j))U(J)?@@@~~e$$5$Z%6777":f#566'
9(=>>  
 
    rQ   c                    t           j        rdnd}dD ]s}d|                                 v}|}|r]| j                            di                               |d          r| j        d         |         }n|                                 dz   |z   }||z  }d|                                 z   dz   |z   |z   }t          | j        |          }t          |          rt          | j	        j
        | j	        j                            d	          rd
nd          }t          |          st          j        |d           t          ||          }t          j        ||| j	        j        | j	        j                   t          j        |d           udS )z0
    Create scripts to run after build step
    .bat.sh)zpre-linkz	post-linkz
pre-unlinkpackage:build rE   .win-Scriptsbini  lockingN)r   on_winget_recipe_textmetarS   rU   r	   pathr   rJ   host_prefixhost_subdir
startswithr   osmakedirs	copy_intotimeoutrx   chmod)	mextr[   	is_output
scriptnamedst_namesrcdst_dirdsts	            rO   create_post_scriptsr      s    L
+&&eC3 ! ! a&7&7&9&99	
 	1vzz'2&&**2r22 1VG_R0

VVXX^b0
c
>C'",s216:&&#;; 		!$X1<<VDDO		% G >> ,GU+++w))COCah&6@PQQQQHS%   -! !rQ   c                     |                      d          st          |           sdS t          j        dk    rt	          |           rdS dS )Nz.pycz.pyoTdarwinF)endswithr   sysplatformr   r|   s    rO   prefix_replacement_excludedr      sM    }}%&& fTll t
|xF4LL t5rQ   c           
   #     K   |                     t          j                  }t          j         t          j                  }||i}t          j        rt|                    dd          }|                     t          j                  }|||<   |                    dd          }|                     t          j                  }|||<   ||t          <   t          d |                                D                       }	g }
t          |          dz   t          j
        d          }|r|                                D ]\  }}	 |ddd	d
dd||g	}t          j        |          }|
                    |                    d                              dd                                                     t# t          j        $ r Y w xY wt          j        rfd|
D             }
nfd|
D             }
nt#          d           | D ]`}t$          j                            |          r
|d         }|
r||
vr3t$          j                            ||          }t-          |          rct%          j        |          j        |	k     r	 t3          |d          }nA# t4          $ r4 t          j        t8                    }|                    d|z             Y w xY w	 t          j        |                                ddt          j                   }n$# t4          $ r |!                                }Y nw xY w|"                    d          dk    rdnd}|dk    rt          j        s|"                    |          dk    r|dd         }|#                                 |#                                 tI          ||||           t3          |d          }t          j        |                                ddt          j                   }|                                D ]%\  }}|"                    |          dk    r|||fV  &|#                                 |#                                 bdS )a	  
    Yields files that contain the current prefix in them, and modifies them
    to replace the prefix with a placeholder.

    :param files: Filenames to check for instances of prefix
    :type files: list of tuples containing strings (prefix, mode, filename)
    \/\\c              3   :   K   | ]\  }}t          |          V  d S Nlen)rL   rM   rH   s      rO   	<genexpr>z$have_prefix_files.<locals>.<genexpr>   s,      991SVV999999rQ   r(   rgz--unrestrictedz--no-headingz--with-filenamez--files-with-matchesz--fixed-stringsz--textutf-8z

c                 L    g | ] }|                     d d          d         !S )r   r   NreplacerL   rg_match
prefix_lens     rO   rP   z%have_prefix_files.<locals>.<listcomp>   s?       =E  s++JKK8  rQ   c                 $    g | ]}|d          S r    r   s     rO   rP   z%have_prefix_files.<locals>.<listcomp>   s"    KKKH(:;;/KKKrQ   zrWARNING: Detecting which files contain PREFIX is slow, installing ripgrep makes it faster. 'conda install ripgrep'Nrb+z5failed to open %s for detecting prefix.  Skipping it.r   tagnameflags    binarytext)%encoder   codecr6   ry   r   minitemsr   externalfind_executable
subprocesscheck_outputextenddecode
splitlinesCalledProcessErrorrg   r   r|   isabsr	   r   statst_sizeopenOSError
get_logger__name__warn	mmap_mmapfilenommap_MAP_PRIVATEreadfindcloserewrite_file_with_new_prefix)filesprefixprefix_bytesprefix_placeholder_bytessearchesforward_slash_prefixforward_slash_prefix_bytesdouble_backslash_prefixdouble_backslash_prefix_bytes
min_prefix
rg_matchesr   
rep_prefixrH   argsmatchesfr|   filogmmmodedatarep_prefix_bytesr   s                           @rO   have_prefix_filesr      s      ==--L18EE%H| J%~~dC88%9%@%@%M%M")C%&"(..v">">(?(F(Fu{(S(S%,I()#;H 99(8(899999J JVqJ		!$	'	'B	  
%^^-- 	 	MJ$"%*%
 %1$77!!NN7++33FDAALLNN    0    < 	L   IS  JJ LKKK
KKKJJ'	
 	
 	

  0 07== 	*++A 	!:--w||FA&&&t,, 	 74== :--	dE""BB 	 	 	"8,,CHHLqPQQQH				QE4J  BB  	 	 	BBB	 777++r11xxv6>>< BGGL$9$9R$?$? !!!u





,$.F   $&&_IIKKD8N   -5NN,<,< 	, 	,(J(ww'((B..!4++++








a0 0s7   >A-F,,F>=F>>J;KK4LL'&L'c              #     K   d}d}t          dt          |                     D ]\}|t          | |                   z   dz   }|t          |           dz
  k    r| ||dz            V  C||k    r| ||dz            V  |}d}]d S )Nr      r(   )ranger   )linensizestartis        rO   chunksr   ;  s      DE1c$ii    c$q'll"Q&D		Auq1u}%%%%%AXXuq1u}%%%%ED rQ   c                 P    d| v r| d         S | d                              d          S )Nbytesr   r   )r   )parents    rO   get_bytes_or_text_as_bytesr   J  s/    &g&>  )))rQ   Fc	           
      D    |                     d          dddd|g}	|                     d            fd| D             }
t          d                    |	                    }t          t	          |
t
          j        rdnd	|z
                      }|D ]}|	d d          |z   }	 t
          j        rd
 |D             }t          j        |d          	                    d          
                    d          }dd                    |          z   dz   }t          j        |          }n+# t          j        $ r
}Y d }~d }~wt          $ r}|d }~ww xY w|r<d}|D ]6}|d         }|dk    r|}|d         d         d         t          |          dz   d                              t           j        d          }d}t%          t           j                            ||          d          5 }t)          |          }|                    d          dk    rdnd}d d d            n# 1 swxY w Y   |dk    sJ |dk    r$|}|dk    s|dk    s|dk    sJ |}|d         d         d         t          |          dz   d                              t           j        d          }|dk    r||k    sJ | d |             ||vr|r	|g d!||<   n|g d!||<   |d         d"         D ]}t-          |d                   }|d#         |d         d$         z   }|d         |d         d$         z   }||||||d%}|||         d"         vr!||         d"                             |           |dk    r|dk    sJ |}|d&k    r|dk    sJ |}t1          d'           8t3          |          S )(Nr   s   --unrestricteds   --no-headings   --with-filenames   --jsonc           	          g | ]S}t           j                            |                    d t           j                                      d                    TS )r   r   )r   r|   r	   r   sepr   )rL   r   pus     rO   rP   z"regex_files_rg.<locals>.<listcomp>i  sT       EFR3//66w??@@  rQ       i  i c                 8    g | ]}|                     d           S )r   )r   )rL   as     rO   rP   z"regex_files_rg.<locals>.<listcomp>w  s$    888a))888rQ   Fshell   
   [   ,s   ]
z	pre-begintypebeginr   r|   r   r(   r   unknownrbr   r   r   matchendz != 
 r   
submatchesr  r   absolute_offsettagr   r   r  regex_rereplacement_reelpased_totalzELAPSED TOTAL)r   r   r	   listr   r   ry   r   r   rstripsplitjsonloadsr   	Exceptionr   r   r   r   r|   mmap_or_readr   r   rW   rg   sort_matches)!r   r   r  r   regex_rgr  also_binaries
debug_thismatch_records	args_baseprefix_filesargs_len
file_lists	file_listr   r   rH   estager   	new_stagematch_filename_beginmatch_filename_typefhr   	old_stagematch_filenamesubmatchsubmatch_match_textsubmatch_startsubmatch_endsubmatch_recordr   s!                                   @rO   regex_files_rgr(  P  s   " 			'I 
w		B   JO  L 499Y''((H|u|?ee8KLL J   a+ a+	|i'	| 9884888'E:::AA%HHNNuUU  TYYw///&8Gj))GG, 	 	 	HHHH 	 	 	G	 O	+E  M+ M+!&M	''%E+0=+@+HFa)),gbfc** ) +4'bgll63GHH$OO SU+B//(,		'(:(:b(@(@HHf ,              
 /);;;;;')) %I G++u/?/?5E>>>>%E%*6]6%:6%BFa))&gbfc** # !G++0NBBB2KK>KK CBB%]::%  )<.0= =M.99 )<.0= =M.9 %*&M,$?  .H$W-/ /+ %W-f>O0PP ' %UOeFm<M.NN % $'$7%3#/(0.<+ + ,#0#@#NO O *.9,GNN /  38 %'' G++++%EE/11 E>>>>%E/***&&&s1   #BD''E;EE

E&-HH#&H#c                     	 t          j        |                                 dd t           j                  }n$# t          $ r |                                 }Y nw xY w|S )Nr   r   )r   r   r   r   r   r   )r   r   s     rO   r  r    s]    _RYY[[!TAWXXX   WWYYIs   47 AAc                    dd l } |j        |          }| D ]}	t          t          ||	          d          5 }
t	          j        |
                                          j        dk    r	 d d d            ^t          |
          }|	                    d          dk    rdnd}|s|dk    r	 d d d             |j
        ||          D ]}|r|	|vr|g d||	<   t          |                                          }|dk    r=|                                }|                                }|                                }nE|                    |          d         }|                    |          }|                    |          }||	         d                             ||||||d	           	 d d d            n# 1 swxY w Y   t#          |          S )
Nr   r   r   r   r   r   r  r  r  )recompiler   r	   r   fstatr   r   r  r   finditerr   groupsgroupr   r  rW   r  )r   r   r  r  r  r  r  r+  re_refiler   r   r   r   g_indexr$  r%  r&  s                     rO   regex_files_pyr4    s`    IIIBJx  E & &$vt$$e,, %	x

##+q00%	 %	 %	 %	 %	 %	 %	  ??D#yy11R7788VD  TX%5%5%	 %	 %	 %	 %	 %	 %	 %UD11   =007;2.N.Nd+ "%,,..11G!||.3kkmm+).',yy{{.3ll7.C.CA.F+).W)=)=',yy'9'9!$'5<<#&$7%3#/(0.< 	 	 	)%	 %	 %	 %	 %	 %	 %	 %	 %	 %	 %	 %	 %	 %	 %	P &&&s   1F655F66C3F66F:	=F:	c                 d   | rdd l } |j        |          }|                                 D ]u\  }}|d         D ]e}|r|d         |k    r |j        ||d                   }|r*|                                }	|	r#|                    t          |	                    }
nt          |          }
|
|d         k    rd|v r:|d         |d         |d         z
  |d         |d         z
           |d         k    sJ |d                             |
          }|d	k    sJ |dxx         |z  cc<   |d         t          |
          z   |d<   |
|d<   d|v r:|d         |d         |d         z
  |d         |d         z
           |d         k    sJ ||d
<   Vt          d           gwt          |           S )Nr   r  r  r   r   r   r  r  r   r  z(ERROR :: Tighter regex_re does not match)r+  r,  r   r   r/  r0  r   rI   r   rg   r  )r  r  r  r+  r1  filenamer   r#  match_rer/  match_tigherindexs               rO   regex_matches_tighten_rer:    sJ    -F			
8$$,2244 )	F )	FOHe!,/ (F (F 8E?c11#28E8F+;<< $F%__..F 5'/~~c&kk'B'B'*8}}#x'777!U?? %f$,W$5&+,=&>%?AI%&+,=&>B?%?!"
 $,F#3!4 !4 !4 !4 !) 0 5 5l C C${{{{ )))U2)))*27*;c,>O>O*O+7(!U?? %f$,W$5&+,=&>%?AI%&+,=&>B?%?!"
 $,F#3!4 !4 !4 !4 ,4HZ((DEEEEQ(FR &&&rQ   c                     t          t          |                                                     }|                                D ] \  }}t          |d         d           |d<   !|S )Nr  c                     | d         S )Nr   r   )xs    rO   <lambda>zsort_matches.<locals>.<lambda>L  s
    '
 rQ   )r\   )r   sortedr   )r  match_records_or2  r   s       rO   r  r  I  sm    !&)<)<)>)>"?"?@@O&,,.. T Te$U<%8>R>RSSSlrQ   c                    t          d           |                                D ]\  }}d }t          t          | |          d          5 }|                                }d d d            n# 1 swxY w Y   |r|d         D ]}||d         |d                  }||d         k    r)t          d                    ||d                              t          d                    ||d         |d         |d                              d S )	Nz::CHECKING MATCHES::r   r  r   r  r   z'ERROR :: file_content {} != submatch {}z{} :: ({}..{}) = {})rg   r   r   r	   r   rh   )r   r  r2  r   r   r   r#  file_contents           rO   check_matchesrC  P  so   	
 !!!$**,,  e$vt$$e,, 	6688D	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	!,/  #HW$5$GH8F#333AHH((6*:   
 )00hw/%(6BR     s   	A**A.	1A.	c	                    t          |           s|S ddl}	|	                    |          |	                    |          }}
t          |t          t
          f          s|                    d          }|r1t          |t          t
          f          s|                    d          }t          j        d          }|r1t          | ||||r|n|||||
	  	        }
|r|rt          |
||          }
|r|rt          | |||r|n||||          }|rt          ||
           t          ||           |
|k    rt          |
                                |                                          D ]\  \  }}\  }}||k    rt          d| d|            '||k    rXt          d	| d
| d|            t          |d         |d                   D ]#\  }}||k    rt          d| d
| d|            $|r|
n|S )a  
    :param files: Filenames to check for instances of regex_re
    :param prefix: Prefix in which to search for these files
    :param regex_re: The regex to use
    :param replacement_re: The replacement regex to use
    :param also_binaries: Search and replace in binaries too
    :param regex_rg: rg does not support all pcre2 nor python re features. You can use this to provide a
                     more compatible but also more broad, fast regex (it must capture everything regex_re
                     would capture, but can capture more) as a pre-filter. Then python re will be used to
                     reduce the matches. There are also some minor syntax differences between rg and re.
                     The last group is taken as the matching portion, though I am not sure about that
                     decision.
    :param match_records: A dictionary of previous results should you wish to augment it
    :return: input match_records augmented with matches
    r   Nr   r   )r  r  r  )r  r  zFile Mismatch:
r   zMatch Mismatch (z):
r  zSubmatch Mismatch ()r   copydeepcopy
isinstancer   	bytearrayr   r   r   r(  r:  r4  rC  zipr   rg   )r   r   r  r  r  r  r  r  debugrE  match_records_rgmatch_records_rer   rM   vk2v2r#  	submatch2s                      rO   have_regex_filesrQ  f  s   4 u:: KKK)-})E)Et}}H H& h	 233 ,??7++ ,
8eY-?@@ ,??7++		!$	'	'B	 Y) .HHh'*

 

 

  	Y 	Y78H(TWXX " ") .HHh'*
 
 
  	"&"2333&"2333#333(+$**,,.>.D.D.F.F) ) " "$FQHR Bww:::b::;;;;bAAAAAaAABBB36lOR-=4 4 " "/Hi  (944 %$X($X$X	$X$XUV$X$X!" !" !"  "7'77rQ   c                 F   t          j        |           }|                    ||          }t          | d          5 }|                    |           d d d            n# 1 swxY w Y   t          j        | t          j        |j                  t          j        z             |S )Nwb)	r   r   r   r   writer   S_IMODEst_modeS_IWUSR)r|   r   
old_prefix
new_prefixstfos         rO   r   r     s     
B<<
J//D	dD		 R
              HT4<
++dl:;;;Ks   AA!$A!c                    |                                  D ]K\  }}t          j                            ||          }|dz   }t          j                            |          rt          j                     t          j        ||           |                    |t          j	        z   d          }t          d                    |t          |d                   t          |d                   dk    rdnd                     t          |d          5 }	|	                                 t          |d	          5 }d
}
|d         D ]}|d         |
z
  }|                    |          }t          |          |k    sJ |	                    |           |d         }|d         rV|d         }t#          |t$          t&          f          s|                    d          }t+          j        |d         ||          }n|}|d         dk    rt          |          t          |          k     r$t          d                    |||                     |                    t          |          d          }t          |          t          |          k    sJ |	                    |           |                    t          |                    }|d         dk    r||k    sJ |
|t          |          z   z  }
||d         t          |d                   dz
           k    r)|                                }|	                    |           	 d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   t          j                            |          r|r|d         dk    rd| }	 t1          j        |d||gt0          j                  }t          d| d           n## t0          j        $ r}|j        }Y d }~nd }~ww xY wt          |                    d                     t          j                            |          rt          j        |           t          j        ||           Md S )Nz.cbpatch.tmprr   zPatching '{}' in {} {}r  r(   placesplacezwb+r   r   r   r   r  r   r  r   r   z4ERROR :: Cannot replace {} with {} in binary file {}r   z+Diff returned no difference after patching z-urN)stderrz%WARNING :: Non-deferred patching of "z" did not change it)r   r   r|   r	   existsunlinkshutilcopy2r   r   rg   rh   r   r   truncater   rT  rG  r   rH  r   r+  subljustr   r   PIPEr   outputr   move)r   r   verbosediffr2  r   r6  filename_tmpfilename_shortfile_tmp
last_indexr#  lengthr   originalr  
new_stringactual_originaldiffor  s                       rO   perform_replacementsru    s   }} G0 G0e7<<--.07>>,'' 	IKKKX|,,,!))&26/2>>$++E,'((l 344q88g 	
 	
 	
 ,&& '	-(h%% %-
 %l 3 #- #-H%g.;F99V,,Dt99....NN4((('/H   01 .)12B)C).5):LMM L-;-B-B7-K-KN%'V$Z0.(& &

 &.
V}00x==3z??::! V ] ]$,j(!" !"  
 &0%5%5c(mmU%K%K
":#h--????NN:...&*iiH&>&>OV}00.(::::&3x=="88J5#6s5;N7O7ORS7S#TTT#yy{{ t,,,G#-%- %- %- %- %- %- %- %- %- %- %- %- %- %- %-'	- '	- '	- '	- '	- '	- '	- '	- '	- '	- '	- '	- '	- '	- '	-R 7>>,'' 	0 -f//VnVV%&3vx>z  E ]]]]    "4 % % %HEEEEEE%ell7++,,,w~~h'' $	(###Kh///OG0 G0sO   %M1HM:MM

MM
MM!	$M!	7OO3"O..O3c                 X    t          j         d          }t           fd|D                       }|rt          ||          }nd |D             }t          j        |           }|D ]A}t          j        t           |          t          ||          |j        |j        d           Bd S )N*c              3   ^   K   | ]'}|                     t          j        z   d           V  (dS )rr   N)r   r   r   )rL   r   r|   s     rO   r   z)_copy_top_level_recipe.<locals>.<genexpr>  s7      DD		$-44DDDDDDrQ   c                 *    g | ]}|d k    |dk    |S )	meta.yamlconda_build_config.yamlr   rL   r   s     rO   rP   z*_copy_top_level_recipe.<locals>.<listcomp>  s8     
 
 
$$-F(F(F (F(F(FrQ   Tr   rx   clobber)r   rec_globr?  r	   filter_filesr   r   rx   )r|   rJ   dest_dirdestination_subdirr   
file_pathsr   s   `      rO   _copy_top_level_reciper    s    N4%%EDDDDeDDDDDJ  
"455
 

 
 


 #J55J 
 
qMM1NN	
 	
 	
 	
 	

 
rQ   c                    t          | j        | j        |d           |                     |                                           pi }|                    d          }g }|g|z   }d |D             }t          j        || j                  }|D ]P}t          j        t          | j        |          t          ||          | j        j
        | j        j        d           Qd S )Nr   scriptc                     g | ]}||S r   r   )rL   r  s     rO   rP   z'_copy_output_recipe.<locals>.<listcomp>1  s    888V8&888rQ   Tr}  )r  r|   rJ   get_rendered_outputrU   rS   r   r  r   r	   r   rx   )r   r  this_outputinstall_scriptbuild_inputsinputsr  r   s           rO   _copy_output_reciper  *  s    1618Xx@@@''117RK __X..NL,F88v888J#J77J 
 
OO1H$H$	
 	
 	
 	
 	

 
rQ   c                 H   | j         j        r|                                 rt          | j         j        d          }	 t	          j        |           n#  Y nxY wd}| j        rt          | |           n"t          | j	        | j         |           | j
        }|                                 }|j                            di           }|                                |d<   ||j        d<   d|j        v r|j        d= d|j                            di           v r|j        d         d= t          j        |j        d           t#          |          }|rNt%          |d	          5 }t'          |                                          j        }d d d            n# 1 swxY w Y   |r||k    st%          t          |d
          d          5 }|                    dt.           d           |rG|                    d           |                    dt1          j        | j	                  z   dz              |                    d           |                    |           d d d            n# 1 swxY w Y   |rKt          j        |t          j	                            |d          | j         j        | j         j        d           t%          t          j	                            |d          d          5 }t;          j        | j         j        |           d d d            d S # 1 swxY w Y   d S d S d S )Nreciperr   rq   stringoutputsparent_recipeextra)build/scriptztest/commandsr   rz  wz## This file created by conda-build r   z&# meta.yaml template originally from:
z# z4# ------------------------------------------------

zmeta.yaml.templateTr}  r{  ) rJ   include_reciper	   info_dirr   r   r   r  r  r|   	meta_pathrE  r{   rS   build_idr   sort_list_in_nested_structurer!   r   r
   r   unicode_markuprT  conda_build_versionr   get_repository_infor   r   rx   yamldumprK   )r   
recipe_diroriginal_recipeoutput_metadatarq   renderedr   original_recipe_texts           rO   copy_reciper  >  s   x :+1#3#3#5#5 :+ !(+X66
	K
####	D; 	*:...."1618Z@@@kO&&(($(("55)2244h(-W% ,,,$Y/o266wCCCC$W-o>+ "C	
 	
 	
 // 	Not,, N'4QVVXX'>'>'M$N N N N N N N N N N N N N N N  	&:h&F&Fd:{33S99 "QU>QUUUVVV" NGGEFFFGGD6#=af#E#EELMMMPQQQ!!!" " " " " " " " " " " " " " "  #GLL-ABBH,H,     "',,z+DEEsKK 	+qIah&***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+s:+ :+ :+ :+sB   A A'FFFBI  I$'I$& LLLc                    |                      d          }|rt          | j        j        |          }t	          |          st          j        d|z             t          | j        j        |          }t          j	        ||| j        j
        | j        j                   t          j                            |          d         dvrt          dt
          j                   d S d S d S )Nzabout/readmezError: no readme file: %srw   r(   >   	README.md
README.rstREADMEzNWARNING: anaconda.org only recognizes about/readme as README.md and README.rstr2  )	get_valuer	   rJ   work_dirr   r   exitr  r   r   r   rx   r   r|   r  rg   r_  )r   readmer   r   s       rO   copy_readmer  |  s    [[((F 18$f--c{{ 	;H069:::18$f--S!("2AH<LMMMM7==  #+PPP.Z       QPrQ   c                    d}d}t          t          | j                  |          }g }t          j                            |          rt          |          rt          j        |          D ]\  }}}|D ]{}t          ||          }t          j                            t          j        	                    |                    \  }	}
|
dk    r"t          | j
        j        ||	dz             }	 t          j        t          j                            |                     n#  Y nxY wt          |          5 }t          |d          5 }dd l} |j        |          }t!          j        ||ddd	
           |                    t          t          j        	                    | j
        j                  ||	dz                        d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   }|S )Nzinfo_yaml.dzinfo_json.dz.yamlz.jsonr  r   T   ,z: 	sort_keysindent
separators)r	   r   r  r   r|   r`  r   walksplitextbasenamerJ   r  r   r   r  	full_loadr  r  rW   )r   iydijdr   resrootdirsr   r2  bnr   r   r   or  s                  rO   jsonify_info_yamlsr    sR   
C
C
wq{##S
)
)C
C	w~~c uSzz !# 	 	D$  D$'''**27+;+;D+A+ABBC'>>qx0#rG|DDCBGOOC$8$89999d 	q$sC.. 	A#-t~a00	 !tA+    

 !1!1!(2C!D!Dc2PW<XX  	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	& JsC   .1D  D$6G&A<G	G&GG&GG&&G*-G*c                 (    t          | dd           d S )Nprelink_messagegeneric_copyr   s    rO   copy_prelink_messager    s    %'899999rQ   c                 (    t          | dd           d S )Nlicenselicense_filer  r  s    rO   copy_licenser    s    I~.....rQ   c                    t          j        |                     d| g                     }|sd S d}|D ]!}|dk    r
t          | j        j        |          }t          j                            |          sDt          j        	                    |          s%t          j                            | j        |          }t          j        	                    |          rE|
                    d          s0t          |                                 d| d| d| d| d	
          t          j                            |          st          j        	                    |          rt          j                            |          s|                    d
          rPd                    |                                |t          j                            |          rdnd          }|dz  }n|}t          j        |t          | j        j        | d|          | j        j        | j        j                   t          |                                 d| d| d          t+          d| d           d S )Nzabout/r   rr   r   z entry in about/z (z[) points to a directory but does not end with a '/'. Make sure the directory only contains zH files and append a '/' to include the folder and all of its content as z information.rs   z{}{}{}z.txtr(   srw   z file given in about/zJ) does not exist in source root dir or in recipe root dir (with meta.yaml)z	Packaged z file/s.)r   ensure_listr  r	   rJ   r  r   r|   r   r   r   
ValueError
capitalizer   r   rh   upperr   r  r   rx   rg   )r   rU   field	all_filescountsingle_filesrc_filer6  s           rO   r  r    s   !!++.>u.>.>"C"CDDI E  # #");77w~~h'' 	9h0G0G 	9w||AFK88H7=="" 	8+<+<S+A+A 	??$$  e  x  04  EI     7>>(## 	rw}}X'>'> 	w}}[)) '[-C-CC-H-H '#??JJLL%27>>(3K3K)SQS  
&OQX&4


H== (	     ??$$ - -5 - -- - -  
 

$d
$
$
$%%%%%rQ   c                    |                      d          pd}t          j                            | j        |          }t          j                            |          st          | j        j        |          }t          j                            |          rFt          j        |t          | j        j	        d          | j        j
        | j        j                   d S d S )Nzabout/recipe_log_filezrecipe_log.jsonrw   )r  r   r|   r	   r   rJ   r  r   r   r  r   rx   )r   log_filer  s      rO   copy_recipe_logr    s     {{233H7HHw||AFH--H7>>(## 5)844	w~~h 
"$566HH$		
 	
 	
 	
 	
 	

 
rQ   c                    d}t          j        | j        j                  r| j        j        }nLt	          | j        d          r7| j        j        r+t           j                            | j        j        dd          }|g}t           j                            t           j                            |d                    r3|	                    t           j                            |d                     |D ]}|rt           j                            |          rj||k    rct          j        |                     dg                     D ]9}t          j        rd|v rt          d          t          t          ||                    }|s$d	}t          |                    |                    |D ]}	 t          j        ||                    ||          | j        j        d
d           ;# t(          $ rY}t          j        t,                    }	|	                    d                    |t1          |                               Y d }~d }~ww xY wdD ].}
t          j        ||
          D ]}t          j        |           /;|                     d          }|r| j        }|D ]}t          t          ||                    }|D ]}|}t           j                            |          s t           j                            |d          }|                    ||          }||k    rAt          j        ||                    ||          | j        j        | j        j        d           d S d S )Nrr   r  infotestr   ztest/source_filesr   zCtest/source_files paths must use / as the path delimiter on Windowsz7Did not find any source_files for test with pattern {0}FT)rx   r~  z1Failed to copy {} into test files.  Error was: {}r   z
test/filesr}  )r   listdirrJ   r  hasattrr  r|   r	   r   rW   r   r  r  ry   RuntimeErrorr>   rh   r   r   r   r   r   r   r   rI   get_ext_filesremover   rx   )r   destinationsrc_dirsrc_dirspatternr   msgr   r  r   r   recipe_test_filesorig_recipe_dirbasedirdests                  rO   copy_test_source_filesr    s   G	z!(#$$ D(#	<	(	( DQX-@ D',,qx2FFCCyH	w}}RW\\'84455 9Wh77888  %  % 	%rw}}W-- 	%'[2H2H ,Q[[9Lb-Q-QRR % %< DGOO&;   T'73344 <SC&szz'':':;;;  A IIg{;;H,$)$(     #   #.x88OVV !3q66         * % %C"0cBB % %	!%% L11 &( 	 	Gow7788E  )w~~a(( F gll?HEEGyy+6699O		';77 ! 0 ! 0 $   	 	 	s   .7G&&
I		0AI	I		c                     |                                  }t          t          j                            | j        j        d          d          5 }t          j        ||d           d d d            d S # 1 swxY w Y   d S )Nhash_input.jsonr  r  )r  )	get_hash_contentsr   r   r|   r	   rJ   r  r  r  )r   recipe_inputr   s      rO   write_hash_inputr  /  s    &&((L	bgll18,.?@@#	F	F -!	,!,,,,- - - - - - - - - - - - - - - - - -s   A22A69A6c                    t          | t                    r| j        } | rd| vrg S | d         }t          |t                    sJ d| d            d|v sJ d| d            |d         }t          |t                    sJ d| d            |r/t          |d         t                    sJ d	|d          d            |S )
a<  
    Extract 'all_replacements' from :class:`conda_build.config.Config` or variant dict and
    check for the correct types.

    :param variant: a variant
    :type variant: :class:`conda_build.config.Config` or dict
    :return: 'all_replacements' value
    :rtype: list
    :raises AssertionError: wrong type
    replacementszFound 'replacements' (z), but it is not a dictall_replacementsz,), but it doesn't contain 'all_replacements'zFound 'all_replacements' (z), but it is not a listr   zFound 'all_replacements[0]' ()rG  r   rK   dictr
  )rK   repls     rO   get_all_replacementsr  5  sC    '6"" "/ nG33	>"Dd  > >====> > > 	d"""RRRR 	#"" "#Dd  B BADAAAB B B  LGT
 
 	L 	LK47KKK	L 	L 	L KrQ   c                 D   dd l } |j                     }t          fd|D                       }|                                 t                      t	          d          s;du r5                    t          j        j        t          j	        j        f           g | 
                    dt          j        sdnd          s;| 
                    dd           s%                    t          j	        j        f           fd|D             }                    fd	|D                        fd
|D             }t          j        r                    dd          n}t          j        s| j        j                            d          rd                                         dd          z   d                                         dd          z   |t)          j        dd          t)          j        dd          g}	|	                    d |	D                        n	t(          f}	dd                    d |	D                       z   dz   }
t-          d |D             d|
d di | j        j                  }i }|                                D ]\  }}d |d         D             ||<   g }|D ]F\  }}}|}||v r:||v r6||         D ]-}|                    |                    d          ||f           .G|}i d}t7          |          rt7          |          dz
  }t9          |          D ]i\  }t-          fd|D             d         d         d         d v rd          nd | j        j        !          |d"z   d         z   ||k    rd"nd#z   }jt;                      |j                     }t=          t?          fd$                    }tA          d%!                    |rd&| d'nd|t7                    ||z
                       	 t          |          S )(Nr   c              3      K   | ]C}t           j                            t           j                            |                    ?|V  Dd S r   )r   r|   r   r	   rL   r   r   s     rO   r   z(get_files_with_prefix.<locals>.<genexpr>`  sG      VVbgnnRW\\&RS=T=T.U.UV1VVVVVVrQ   __iter__T%build/detect_binary_files_with_prefixFzbuild/binary_has_prefix_filesc           	         g | ]~}d t          t          j                            |          d                                                              d          dk    rt          j        j        nt          j	        j        |fS )Nr   r   r   )
r   r   r|   r	   r   r   r+   r   rU   r   r  s     rO   rP   z)get_files_with_prefix.<locals>.<listcomp>k  s     	 	 	  BGLL++U3388::??HHBNN O  #	
	 	 	rQ   c              3      K   | ]S}|d          v r
|d         vs3t          t          j                            |d                             I|d         V  TdS )r(   r  N)r   r   r|   r	   )rL   r   ignore_filesignore_typesr   s     rO   r   z(get_files_with_prefix.<locals>.<genexpr>u  st        aDL  QqT%=%=&rw||FAaD'A'ABB &> 	
!%=%=%=%= rQ   c                 (    g | ]}|d          v|S r  r   )rL   r   r   s     rO   rP   z)get_files_with_prefix.<locals>.<listcomp>{  s'    RRRq1\9Q9Q9Q9Q9QrQ   r   r   winr(   'c                 :    g | ]}|                     d d          S )r   r   r   )rL   pfxs     rO   rP   z)get_files_with_prefix.<locals>.<listcomp>  s&    OOO3S[[v66OOOrQ      (   |c              3   h   K   | ]-}|                     d                               dd          V  .dS )r      \s   \\N)r   r   )rL   rM  s     rO   r   z(get_files_with_prefix.<locals>.<genexpr>  s>      TT!AHHW%%--eW==TTTTTTrQ      )c                     g | ]
}|d          S r  r   r|  s     rO   rP   z)get_files_with_prefix.<locals>.<listcomp>  s    )))!1)))rQ   r   )r   r  r  r  r  r  rJ  c                     h | ]
}|d          S )r   r   )rL   sms     rO   	<setcomp>z(get_files_with_prefix.<locals>.<setcomp>  s    &P&P&Pbr&z&P&P&PrQ   r  r   rr   c                 X    g | ]%t          fd d         D                       #&S )c              3   X   K   | ]$}t           j                            |          V  %d S r   )glob2fnmatch)rL   rr   s     rO   r   z3get_files_with_prefix.<locals>.<listcomp>.<genexpr>  sI         --a33     rQ   glob_patternsany)rL   r   replacements    @rO   rP   z)get_files_with_prefix.<locals>.<listcomp>  se           !,_!=      rQ   r  r  r  r  )r   r   r  r  r  r  r  rJ  "z", c                 :    t          |          d                   S )Nr  r   )r   all_matchess    rO   r>  z'get_files_with_prefix.<locals>.<lambda>  s    c+a.677 rQ   z\INFO :: Time taken to mark (prefix){}
        {} replacements in {} files was {:.2f} secondsz and mark+peform ())"timer?  ignore_prefix_filessetr  updater+   r   rU   r   r  r   ry   r   r   rJ   rT   r   r  lowerr6   r	   rQ  rJ  r   rW   r   r   	enumerateru  summaprg   rh   )r   r  files_inr   r  r   r   files_with_prefixprefix_upfx_variantsre_testpfx_matchesprefixes_for_filer6  r   files_with_prefix_newrH   r   npr  replacement_tagslastr9  r  total_replacementsr  r   r  r  s      `                     @@@@rO   get_files_with_prefixr2  [  sc   KKKDIKKEVVVVhVVVVVE((**L55L<,, 4!3X_5I JKKK;;/U\1Tu  5kk94@@5 	X_13444	 	 	 	 	 	 	       "      SRRR$5RRR,1LDv~~dC(((fH | 4qx11%88 4 1IOOqrr
*1IOOqrr
*&tS11&sD11
 	OO,OOOPPPP 23 	
))TT|TTT
T
T	U
	 
 #))()))
 hn  K  ',,.. Q Q%&P&PE,<O&P&P&P(##. T T4"""r['8'8(, T T%,,cjj.A.A4-RSSSS-K 
< <  1$"+L"9"9 	 	E;*   "   &$Z0*+;<)4>+4M4MZ00SWhn  K$ !e$%  4--33U4  f---
$)++C7777EE  
	AAG8HP4!14444b%K	B
 B
  2 #$$$rQ   c           
         g }|s|S |                                  d d          }|                                 d d          }t          |          }t          |          }|rt          j        rd}nd}t          d           t          d           |                     d| ot          j                   }t          t          | j	        j
        d          d          5 }	|D ]H\  }
}}d }||v s
|r|rU|dk    rO||v r1|dk    rd}n(||v r$|r"t          d	                    |                     ||v r|                    |           n||v s+|s|d
k    s#t          j                            |          dk    rK|d
k    rd
}n(||v r$|s"t          d                    |                     ||v r|                    |           nd|z  }t          d                    |||rdnd|r|nd                     |3|	                    ||
||fz             |                    |
||f           J	 d d d            n# 1 swxY w Y   d}|D ]
}|d|z  z  }|D ]
}|d|z  z  }|rt%          |          |S )Nz"%s" %s "%s"
z	%s %s %s
zFiles containing CONDA_PREFIXz-----------------------------r  
has_prefixr  r   zyFile {} force-identified as 'binary', But it is 'binary' anyway, suggest removing it from `build/binary_has_prefix_files`r   python-scriptsznFile {} force-identified as 'text', But it is 'text' anyway, suggest removing it from `build/has_prefix_files`z# (not in build/%s_has_prefix_files)z{fn} ({mode}): {action}{reason}IgnoringPatchingrr   )fnr   actionreasonz;Did not detect hard-coded path in %s from has_prefix_files
zBDid not detect hard-coded path in %s from binary_has_prefix_files
)binary_has_prefix_fileshas_prefix_filesr   r   ry   rg   r  r   r	   rJ   r  rh   r  r   r|   r   rT  rW   r  )r   r'  filteredr;  text_has_prefix_fileslen_binary_has_prefix_fileslen_text_has_prefix_filesfmt_strdetect_binary_files_with_prefixr[  pfixr   r8  ignored_becauseerrstrr   s                   rO   record_prefix_filesrF    s   H   7799!!!<..003 #&&=">"> #$9 : : C6< 		# 'GG
 #G-...-...*+++3++@EL0@+
 +
' $qx(,77== 1	6"3 06 06dB"&0004 18W 1((4448++#+DD"999 ? : "!BBH&**  
 444/66r:::///5 0:>&..wr**.>>>v~~%444=V477=vbzz  
 222-44R888&Kt&TO5<<!-<Lzz*2AIr	 =     #*HHWdB'77888OOT4$4555a061	6 1	6 1	6 1	6 1	6 1	6 1	6 1	6 1	6 1	6 1	6 1	6 1	6 1	6 1	6h F" U UPSTTT$ 
 
QTUU	
  #6"""Os   EH55H9<H9c                 X    t          |                               ddg          d         S )NFrr   )with_credentialssubdirsr   )r3   urls)channels    rO   sanitize_channelrL  U  s+    W%%**EB4*PPQRSSrQ   c                 H   |                      d          }t          |          }ddd}t          t          | j        j        d          fi |5 }| j        dk    rt          |          D ]}|                    d          dk    r4|	                    ||                    d          d          d	z              O|
                    d
          r1||vr-|	                    |                    d
d          d	z              |
                    d          r1||vr-|	                    |                    dd          d	z              |	                    |d	z              n*t          |          D ]}|	                    |d	z              d d d            d S # 1 swxY w Y   d S )Nbuild/entry_pointsr  r   r   encodingr   pythonsite-packagesr   r   rv   r5  ru   )r  get_entry_point_script_namesr   r	   rJ   r  noarchr?  r   rT  r   r   )r   r   entry_point_scriptsentry_point_script_names	mode_dictr[  r   s          rO   write_info_files_filerX  Y  s   ++&:;;;<OPP'22I	d18$g..	<	<)	<	< #8xE]] ' '66/**a//HHQqvvo66889D@AAAA\\%(( 'a7O.O.OHHQYYu.>??$FGGGG\\),, '!;S2S2SHHQYYy2BCCdJKKKKHHQX&&&&' E]] # #T""""# # # # # # # # # # # # # # # # # #s   D;FFFc           	         t                      }|                     d          }|rXt          |          }t          |          }|                                dk    r|                     d          }|r||d<   ||d<   |                     d          }|r>t          t          |                    }|                     d	          }|r||d
<   ||d<   |rd|d<   t	          t
          j                            | j        j	        d          d          5 }	|	
                    t          j        |ddd                     d d d            d S # 1 swxY w Y   d S d S )Nbuild/noarch)r   rQ  rN  entry_pointsrT  zbuild/preferred_envrU   z$build/preferred_env_executable_pathsexecutable_pathspreferred_envr(   package_metadata_versionz	link.jsonr  Tr  r  r  )r   r  rI   r"  r   r   r|   r	   rJ   r  rT  r  dumps)
r   package_metadatanoarch_typenoarch_type_strnoarch_dictr[  r^  preferred_env_dictr]  r   s
             rO   write_link_jsonrf  n  s   "}}++n--K 1k**!777  ""h..;;';<<L ;.:N+%0"KK 566M ?(c-.@.@AAA;;'MNN 	F5E12,>) 
 8934"',,qx0+>>DD 	HH
$Q;    	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
 
s   ,EEEc                    t          t          | j        j        d          d          5 }i }t          d                                         D ]D\  }}|                     d|z            }|r|||<   |t          u rt          j	        |          ||<   Et          |d<   t          |d<   g }t                      t          | j        j                  z   D ]$}|                    t          |                     %||d<   dg}d	 |D             |d
<   |                     d          }	| j        j        rXt          j        t&                    }
|
                    d| j        j                   |	                    | j        j                   t-          j        t0                    }|                                |d<   |	|d<   t5          j        ||dd           d d d            d S # 1 swxY w Y   d S )Nz
about.jsonr  aboutzabout/%sconda_versionr  channelsCIO_TESTc                 :    i | ]}|t          j        |d           S )z	<not set>)r   getenv)rL   evs     rO   
<dictcomp>z$write_about_json.<locals>.<dictcomp>  s&    HHHBRYr;77HHHrQ   env_varsr  z6Adding the following extra-meta data to about.json: %s	root_pkgsr  Tr  r  )r   r	   rJ   r  r   r   r  r
  r   r  ri  r  r4   channel_urlsrW   rL  get_section
extra_metar   r   r  r!  r   Environmentr8   package_specsr  r  )r   r[  dr\   defaultvaluestripped_channelsrK  evarsr  r   envs               rO   write_about_jsonr~    s,   	d18$l33S	9	9 #3R"7O1133 	2 	2LCKK
S 011E #$*511# +/#6
  "}}tAH,A'B'BB 	@ 	@G$$%5g%>%>????)*HH%HHH*g&&8 	."8,,CHHH#   LL,---!(++**,,+'
	!RT2222G#3 #3 #3 #3 #3 #3 #3 #3 #3 #3 #3 #3 #3 #3 #3 #3 #3 #3s   F'GG!$G!c           
         |                                  }| j        rg| j        dk    r5| j                            di                               dg           }||d<   nt	          j        | d          }t          t          | j        j	        d          d          5 }|
                    d                    |                                 | j        j                             t          |d                    |                                                     d	d
                    gz             D ]?}|
                    dd                    |                                          z             @	 d d d            n# 1 swxY w Y   ddd}t          t          | j        j	        d          fi |5 }t#          j        ||d
d           d d d            d S # 1 swxY w Y   d S )Nstrictrequirementsrundependsrequiresr  z# This file as created when building:
#
#     {}.tar.bz2  (on '{}')
#
# It can be used to create the runtime environment of this package using:
# $ conda create --name <env> --file <this file> rE   r  z%s
=r   rO  
index.jsonTrr  )
info_indexpin_dependsr{   rS   r   get_pinned_depsr   r	   rJ   r  rT  rh   distbuild_subdirr?  rsplitr  r  r  )r   r  runtime_depsr[  r  rW  s         rO   write_info_jsonr    sC   J} :=H$$6::nb99==eRHHL$0Jy!!"21e<<L$qx(*55s;; 	:rHHC
 DJ6FFHHH)D D
 
 
 |sxxQ8O8O/P/P.QQRR : :#((4::<<"8"889999:	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: '22I	d18$l33	A	Ay	A	A <R	*bd;;;;< < < < < < < < < < < < < < < < < <s%   CE99E= E=.GGGc                 ^   |                      d          }|rt          |t                    s|g}t          t	          | j        j        d          d          5 }|D ]5t          fd|D                       r|                    dz              6	 d d d            d S # 1 swxY w Y   d S d S )Nbuild/no_linkno_linkr  c              3   B   K   | ]}t          j         |          V  d S r   r  )rL   pr   s     rO   r   z write_no_link.<locals>.<genexpr>  s/      >>wq!,,>>>>>>rQ   r   )	r  rG  r
  r   r	   rJ   r  r  rT  )r   r   r  r[  r   s       @rO   write_no_linkr    s   kk/**G ''4(( 	 iG$qx()44c:: 	'b ' '>>>>g>>>>> 'HHQX&&&'	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'' 's   9B  B$'B$c                    g }| D ]}|d |                     d                                                   }t          j        r1|                    d|z             |                    d|z             n|                    d|z             |S )Nr  zScripts\%s-script.pyzScripts\%s.exezbin/%s)r   stripr   ry   rW   )rU  scriptsentry_pointcmds       rO   rS  rS    s    G* + +1K,,S111288::< 	+NN2S8999NN,s23333NN8c>****NrQ   c                    | j                             di                               di           }|rt          t          j                            | j        j        d          d          5 }t          |d          sd|i}t          j
        D ]#}||v rt          j        ||                   ||<   $t          j        ||           d d d            d S # 1 swxY w Y   d S d S )Nrq   run_exportszrun_exports.jsonr  keysweak)r{   rS   r   r   r|   r	   rJ   r  r  r   RUN_EXPORTS_TYPESr  r  r  )r   r  r   rM   s       rO   write_run_exportsr    s&   &**Wb))--mR@@K &"',,qx02DEEsKK 	&q;// 4%{3, G G##%*%6{1~%F%FKNIk1%%%	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	&& &s   *ACCCc                    t           j        rd |D             }| j        j        rt	          |            t          |            t          |            t          |            t          |            t          |            t          |            t          |            t          |            t          |            |                    t          |                      t!          | t#          | j        j        d                     | j        j        r(t'          | t#          | j        j        d                     t)          | |           t+          | |||          }t-          | |          }t/          | | j        j        |||          }t1          | |           |                     d          }t5          |d          r|g}t7          t#          | j        j        d          dd	          5 }|D ]}|                    d
          rit;          j        t>          j                             | j        j!        |                    dd                    | j        j"        d| j        j#        |           	 ddd           n# 1 swxY w Y   | $                    d          rjt          j%        t#          | j         | $                    d                    t#          | j        j        d          | j        j&        | j        j'                   |S )z
    Creates the metadata files that will be stored in the built package.

    :param m: Package metadata
    :type m: Metadata
    :param files: Paths to files to include in package
    :type files: list of str
    c                 :    g | ]}|                     d d          S )r   r   r   )rL   _fs     rO   rP   z%create_info_files.<locals>.<listcomp>   s&    7772D#&&777rQ   r  )test_dirr   r  gitr  r   )rP  git_urlfolderrr   N)r  rj  r[  zapp/iconzicon.pngrw   )(r   ry   rJ   filename_hashingr  r  r~  rf  r  r  r  r  r  r  r   r  r   r	   r  r  rX  r2  rF  create_info_files_json_v1r  rt  r  r   rS   r   git_infor   r|   r  build_prefixrj  r  r   r   rx   )	r   r  r   r   r'  	checksumssourcesr[  r   s	            rO   create_info_filesr    s    | 877777x  AQAaNNNNNNOOOA	LL#A&&'''!d18+<f&E&EFFFFx& Cq$qx'8&"A"ABBB!U###-aufMM+A/@AA)	18fe-> I !UmmH%%Gw )	d18$e,,cG	D	D	D 	 	 	Cwwy!! GLL!2CGGHb4I4IJJH)H,   		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	{{: 
Z0011"J//HH$		
 	
 	
 	
 s   +BI<<J J c                    | j         dk    rt          |                     d                    }|                    d          dk    r||                    d          d          S |                    d          r||vr|                    dd          S |                    d          r||vr|                    dd          S |S |                     dd           rd S |S )	NrQ  rN  rR  r   rv   r5  ru   build/noarch_python)rT  rS  r  r   r   r   )r   target_filerV  s      rO   get_short_pathr  7  s   x8#?KK,--$
 $
  O,,11{//@@BBCC##E** 		777&&u.>???##I.. 	777&&y2BCCC	
*D	1	1 trQ   c                 0    |D ]\  }}}| |k    r||fc S dS )N)NNr   )
short_pathr'  r   r   r6  s        rO   r4  r4  N  s=    "3    h!!4< ":rQ   c                 j    t          j        |           } t          fd| D                       rdS d S )Nc              3   B   K   | ]}t          j         |          V  d S r   r  )rL   r  r  s     rO   r   zis_no_link.<locals>.<genexpr>W  s/      
;
;a7?:q))
;
;
;
;
;
;rQ   T)r   r  r  )r  r  s    `rO   
is_no_linkr  U  sG    ((G

;
;
;
;7
;
;
;;; t rQ   c                 4    t          j        |           j        S r   )r   lstatst_inor  s    rO   	get_inoder  [  s    8D>>  rQ   c                     t          j        |            t          t          |                    fd| D             }t	          |          S )Nc                 j    g | ]/}t          j        t          |                    j        k    -|0S r   r   r  r	   r  )rL   spr   target_short_path_inodes     rO   rP   z#get_inode_paths.<locals>.<listcomp>b  sF       8D$$%%,0GGG 	GGGrQ   )r   r  r  r	   r?  )r   target_short_pathr   hardlinked_filesr  s     ` @rO   get_inode_pathsr  _  sm    	e'V5F(G(GHH      
 "###rQ   c                      fd| D             S )Nc                 ^    g | ])}t          j        t          |                    j        *S r   r  )rL   r  r   s     rO   rP   zget_inodes.<locals>.<listcomp>k  s0    >>>"BHT&"%%&&->>>rQ   r   )r   r   s    `rO   
get_inodesr  j  s    >>>>>>>>rQ   c                 P    t          |           rt          j        nt          j        S r   )r   r.   softlinkhardlinkr   s    rO   	path_typer  n  s     &tC8(2CCrQ   c                 ^   |t                      }| |vr|| hz  }t          j                            t          j                            t          j                            |           t          j        |                               }t          |          rt          |          sdS t          |          r(t          |          st          j
        |           j        S t          |          rt          ||          S t          |          st          j        d| z  t                     dS dS )zrecursively follow links to get size of what they finally point to

    `path` is the current path
    `seen` is a set that holds anything the function has already processed

    By using `seen`, we can avoid getting stuck in cycles.
    Nr   )seenz#file %s is a symlink with no target)r   r   r|   normpathr	   r   readlinkr   r   r   r   r   _recurse_symlink_to_sizewarningsr   UserWarning)r|   r  r  s      rO   r  r  r  s    |uu4wRW__T-B-BBKPTDUDU V VWW ;; 		vd|| 		1D\\ 	&,, 	74==((D\\ 	+Dt<<<< 	M?$FTTT11rQ   c                    |                      d          }g }t          |          }t                    D ]}t          ||          \  }}	t          j                            ||          }
t          | |          }|r*|                    dd                              dd          }|t          j
        |
          t          |
          d}|d         t          j        k    rt	          j        |
          j        |d<   n=|d         t          j        k    rt#          |
          |d<   nt%          |
          rd|d<   t'          ||          }|r||d	<   |r|	r
||d
<   |	|d<   |                    d          t          j        k    rMt	          j        |
          j        dk    r0t-          |
          fdt/          |          D             }||d<   |                    |           |S )Nr  r   r   r   )_pathsha256r  r  size_in_bytesr   r  r6   	file_moder(   c                 2    g | ]\  }}|k    |         S r   r   )rL   r9  inor   r  s      rO   rP   z,build_info_files_json_v1.<locals>.<listcomp>  s7       E3111 e111rQ   inode_paths)r  r  r?  r4  r   r|   r	   r  r   r   sha256_checksumr  r.   r  r   r   r  r  r   r  rS   st_nlinkr  r#  rW   )r   r   r   r'  no_link_files
files_jsonfiles_inodesr   r6   r  r|   r  	file_infor  r  r  s     `            @rO   build_info_files_json_v1r    s   KK00MJeV,,LUmm "% "%(227H(I(I%Iw||FB''#Ar**
 	L#++D#66>>vsKKJ+D11"4
 
	
 [!X%666)+)>Io&&{#x'888)A$)G)GIo&&4[[ 	+)*Io&]B// 	+#*Ii  	/) 	/.@I*+%.Ik"MM+&&(*;;;&**&/oo#    "+L"9"9  K
 (3Im$)$$$$rQ   c           	      4   t          | |||          }d|d}| j        sUt          t          |d          d          5 }t	          j        ||dddt                     d d d            n# 1 swxY w Y   t                      }|D ]}	|	d	         ||	d
         <   |S )Nr(   )paths_versionpathsz
paths.jsonr  Tr  r  )r  r  r  clsr  r  )r  noarch_pythonr   r	   r  r  r*   r  )
r   r  r   r   r'  files_json_filesfiles_json_infor  r  r2  s
             rO   r  r    s    065BSTT! O ? 	$x..44 	
I&!   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 I  2 2#'>	$w-  s    A))A-0A-c                                           d          } j        j        g }|D ]T}t          j                            t          j                            |                    s|                    |           Ut          |          rBt          j
        t                    }|                    d                    ||                     t                      t                       j        dk    r.t          j                              d           j                   t          j                  }t          j                             j        j                  r j        j        n j        j        }t-          |                      d          t/          ||z
             j        t1                                d                                          d	                                d
                     t          j                  }t/          ||z
            }	 t          j        |          } j        j        t7          fd|D                       rDt9           fd|D                       f}	t;          j        d                    |	                     t?           ||           tA                                d                     j        dk    rfd|D             }
n|}
                      d          rtC          j"         |           n" j        dk    rtC          j#         |
           t          j                  }||z
  }tI          |           |S )Npackage/namezThe install/build script(s) for {} deleted the following files (from dependencies) from the prefix:
{}
This will cause the post-link checks to mis-report. Please try not to delete and files (DSOs in particular) from the prefixrQ  rN  rJ   r   zpackage/versionzbuild/preserve_egg_dirrZ  zbuild/skip_compile_pyc)r   rJ   preserve_egg_dirrT  skip_compile_pycc              3   <   K   | ]}t          |          v V  d S r   )r	   )rL   r   r}   meta_dirs     rO   r   z%post_process_files.<locals>.<genexpr>  s2      
?
?8tK+++
?
?
?
?
?
?rQ   c              3   T   K   | ]"}j         j        t          |          v |V  #d S r   )rJ   r  r	   )rL   r   r}   r   s     rO   r   z%post_process_files.<locals>.<genexpr>  s=      TT!(*;tKQR?S?S*S*S!*S*S*S*STTrQ   zError: Untracked file(s) {} found in conda-meta directory. This error usually comes from using conda in the build script. Avoid doing this, as it can lead to packages that include their dependencies.)build_pythonc                     g | ]}|v|	S r   r   )rL   r   rV  s     rO   rP   z&post_process_files.<locals>.<listcomp>   s$    RRRBr9Q/Q/QR/Q/Q/QrQ   r  )%r  rJ   r}   r   r|   r`  r	   rW   r   r   r   r   warningrh   r   r   rT  create_entry_pointsr  r   r  host_pythonr   r?  boolr  r  r  tupler   r  r   rS  r  	transformpopulate_filesr   )r   initial_prefix_filespackage_namemissingr   r   current_prefix_filesrQ  	new_files
meta_files	pkg_filesrV  r}   r  s   `          @@@rO   post_process_filesr    s   ;;~..L(&KG!  w~~bgll;::;; 	NN1
7|| 
x(( VL'22	
 	
 	
 q 	x8!!++.B"C"CAHUUUU -[AAA 7>>!(/00	"X! 
 	%&&#&::;;xakk*BCCDD{{>**%=>>	 	 	 	 !-[AAA+.BBCCI	 "9[AAAIx H

?
?
?
?
?Y
?
?
??? 

TTTTTYTTTTT

 	//5v0 0	
 	
 	
 q)&1111;	())    	x8RRRR)RRR			 	{{()) 
9k::::	
X		$y+'?	
 	
 	
 !-[AAA$';;II{+++rQ   c                 4  67 t          j        t                    }|                    d|                                           t          |j                   |                     dg           }	 t          j	        |j        j
                   n# t          $ r Y nw xY wt          j        |                    dd                     }d|                                v}t          |j                  }	|                                                    di           pi }
|j        }|r|                     d          s|s|
                    d          s|j        j        }d                    |          }t           j        rdnd	}|                     d          pd
| }t)          t          j                            |j        j        |          d          5 }|                    d           |                    |           |                    d           d d d            n# 1 swxY w Y   || d<   |                     d          rBt1          j        |          }|                     d          }|st5          | d                   }t7          j        |d         |j        j                  |d<   |d         s5|                    d                    | d         |d                              d|d         v r-d|d         v r#tA          d           tC          j"        d           n|#                    d          }t          j$        |j        j
                  }|%                                }|d         |d<   |d         |d<   |&                                |d<   |                    d          |d<   |j        |d<   d|d<   d|d<   t          j        |                    d                    D ]w}d |v r9|#                    d d          d         }|#                    d d          d         }n3|t          j        vrtO          d!| d"          t          j        |         }|||<   xt          j                            |j        j        | d                   }t          j(        t          j                            |j        | d                   |           dd#lm)}  ||          }t          j*        ||j+        d$z             |rtY          ||           i }t          j-        ||gz   |j        j        ||%           t]          |d&|/                                            |(||ta          |d'|/                                           <   |rgd( t          j1        ||j        j
                  D             7te          t          j$        |j        j
                            }7fd)|7z
  D             }nb|                     d          sL|3                                s|4                    d*                    |                     d+                               |                    d,          }|                    d-          }d. |D             }d/ |D             }d0d1d2}|5                                D ]u\  6}tm          6fd3||fD                       r#to          d4                    6|                    6|v r,|j8        r%d5} to          d6                    6|                     vte          t          j$        |j        j
                            }|3                                D ]j}!d7}"te          |          D ]>}ts          j9        ||!          r'tA          d8|           |:                    |           d9}"?|"s|4                    d:|!           ktw          ||          }|                     d+          r+|                     d+          d;k    rd<|vrd=|vs
J d>            t          j<        ||j        j
        ?          }t          j=        t          j                            |j        j>        d@                     t          |j        j
                  5  t          ||	||j        j
        ?          | dA<   d d d            n# 1 swxY w Y   te          t          j$        |j        j
                            }#t          j<        |#|z
  |j        j
        ?          }dB                    | d+         |&                                |A                                g          }$g }%g }&i }'t          }(|                     dC          dDk    s|j        jC        dEk    rt          }(dFdGdH|j        jE         f|'dI<   t                      5 })t          jH        jI        |j        j
        ||$|(z   fdJ|)i|' t          j                            |)|$|(z             g}%|%D ]}*|*J                    t                    rt          jL        |*|j                   t          j        M                    |*          }+	 ddKlNmO}, n'# t          $ r d },|4                    dL           Y nw xY wt          |j        dMd7          r|,r |,            }-t          j        |j        jR                  |R                                z   }.	 |-S                    |*|.|j        jT        N           n?# t          $ r2}/|4                    dO                    |/                     Y d }/~/nd }/~/ww xY w	 |j        jV        }0n# t          $ r |j        jX        }0Y nw xY w|jY        s|jZ        rdPn|0}1|j        j[        r+t          j                            |j        j[        |1          }2nGt          j                            t          j        \                    |j        j]                  |1          }2t          j                            |2|+          }3t          j        ^                    |3          rt          j=        |3           t          j(        |*|3|j        j_        d7Q           |&`                    |3           	 d d d            n# 1 swxY w Y   t          t          j        \                    |2          |j        jb        dR           |j        jc        r|j        j
        }4t          j                            t          j        \                    |4          dS                    dT|                                |j        jX        f                    }5t          |4|5dU           nt          j=        |j        j
                   |&S )VNzPackaging %sr   r  rp   rq   r  r   batshzoutput_script.r  r  script_interpreterr   z4Did not find an interpreter to run {}, looked for {}system32rC   zERROR :: WSL bash.exe detected, this will not work (PRs welcome!). Please
         use MSYS2 packages. Add `m2-base` and more (depending on what your         script needs) to `requirements/build` instead.r(   r  PKG_NAMETOP_PKG_NAMEPKG_VERSIONTOP_PKG_VERSIONr  
RECIPE_DIRinheritMSYS2_PATH_TYPE1CHERE_INVOKINGzbuild/script_envr  z	env var 'z*' specified in script_env, but is not set.)r      cwdr}  statsz	bundling bundle_c                 L    h | ]!}t           j                            |          "S r   )r   r|   r  )rL   pths     rO   r  zbundle_conda.<locals>.<setcomp>  s8     
 
 
 GS!!
 
 
rQ   c                 L    h | ]t          fd D                        S )c              3   f   K   | ]+}|                     t          j        j        z             V  ,d S r   )r   r   r|   r   )rL   	keep_fileitems     rO   r   z)bundle_conda.<locals>.<setcomp>.<genexpr>  sK        =F	$$TBGK%788     rQ   r  )rL   r  
keep_filess    @rO   r  zbundle_conda.<locals>.<setcomp>  s`     
 
 
    JT    

 
 
rQ   z&No files or script found for output {}rU   zrequirements/buildzrequirements/hostc                 B    g | ]}|                                 d          S r   r  rL   pkgs     rO   rP   z bundle_conda.<locals>.<listcomp>  s$    ???S#))++a.???rQ   c                 B    g | ]}|                                 d          S r  r  r   s     rO   rP   z bundle_conda.<locals>.<listcomp>  s$    ===CQ===rQ   PYTHONR)rQ  r-basec              3       K   | ]}|v V  	d S r   r   )rL   	pkgs_listdeps     rO   r   zbundle_conda.<locals>.<genexpr>  s(      QQIsi'QQQQQQrQ   zEmpty package; {0} present in build and host deps.  You probably picked up the build environment's {0}  executable.  You need to alter your recipe to  use the {1} env var in your recipe to run that executable.zOhttps://conda.io/docs/user-guide/tasks/build-packages/define-metadata.html#hostzEmpty package; {0} dep present in build but not host requirements.  You need to move your {0} dep to the host requirements section.  See {1} for more info.Fz"Including in package existing fileTz:Glob %s from always_include_files does not match any filescondaz	bin/condazScripts/conda.exezmBug in conda-build has included conda binary in package. Please report this on the conda-build issue tracker.r  r  r  rE   r   conda_v22z.tar.zstzstdzzstd:compression-level=compression_tuple
out_folder)VerifyzImporting conda-verify failed.  Please be sure to test your packages.  conda install conda-verify to make this message go away.verify)path_to_packagechecks_to_ignoreexit_on_errorzPackage doesn't have necessary files.  It might be too old to inspect.Legacy noarch packages are known to fail.  Full message was {}rT  rw   rj  threadsrH   _h_env_movedzhost env)er   r   r   r  r  r  rJ   rS   r   r   r}   r   r  r  rz   $get_top_level_recipe_without_outputsactivate_build_scriptactivater	   ry   r   r|   r  rT  r   get_dictguess_interpreterr   r   r  errorrh   rg   r   r  r  r  rE  rV   r  r   r   r   rV  _write_activation_textcheck_call_envrl   rU   r]   expand_globsr   always_include_filesr   r   allr   "uses_new_style_compiler_activationr  r  r  r  rm_rfr  r@   r  r  r:   conda_pkg_formatr;   zstd_compression_levelr/   conda_package_handlingapicreater   r   	check_allr  conda_verify.verifyr/  ImportErrorgetattrignore_verify_codesverify_packageexit_on_verify_errorKeyErrortarget_subdirAttributeErrorr~   rT  r  output_folderr   bldpkgs_dirr   r   rW   r   rJ  keep_old_workr?   )8rh  rN   r}  r  kwr   r   r  r   r  	top_buildactivate_scriptsuffix	script_fnr   interpreterinterpreter_and_argsinitial_files
env_outputvarval	dest_filer   rZ  bundle_stats	pfx_files
build_deps	host_deps
build_pkgs	host_pkgsdangerous_double_depsenv_var_namelinkpathas_matchesr  r  tmp_archivesfinal_outputs
cph_kwargsr   tmptmp_pathoutput_filenamer/  verifierr2  r  crossed_subdirrT   rS  final_outputr   r  r(  r  s8                                                         @@rO   bundle_condarv  4  s   

8
$
$CHH^X]]__---)))JJw##E
HO/0000    x11.$GGHHF (":":"<"<<I (88L==??CCGRPPVTVI4O %vzz(++ %%"x00% #/26"",0DJJx((E,EV,E,E	"',,x7CCSII 	QGGDMMMGGFOOOGGDMMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 %xzz( BS***jj!566 	:#4VH5E#F#F &.&>$Q')E' ' # (* 		JQQx(*>q*A    2155521555N  
 #.#4#4S#9#9 *8?+FGGXXZZ
%(_
>"(+M(:
$%$,$4$4$6$6
=!!)!3!3N!C!C
:#+=
< (1
$%'*
#$$X%7%78J%K%KLL 
	" 
	"CczziiQ''*iiQ''*BJ&& OOOO   jo!JsOOGLL!96(;KLL	X]F84DEEyQQQT)__
BJ./// 	8"9h777 I;.(		
 	
 	
 	
 	, =HMMOO = =>>>FRE)H&A&A&ABBC -M
 
)%1LMM
 
 

 *8?+FGGHH	
 
 
 
"Z/
 
 
 ZZ!! M,,.. 	HH8??

6@R@RSS   "++,@AAJ **+>??I??J???J==9===I/73$G$G!%:%@%@%B%B  !\QQQQ*i9PQQQQQ -/ 06vc</H/H   J&&8+V&4  .  !'sD 1 1	   E.x/JKKLL,,.. X X]## 	# 	#Aq#&& #:A>>>$$Q'''" 	XHHQSVWWWx77Ezz& 
fjj00G;;%'',?u,L,L,L -M,L,L uX_-HIIIE	KX_5v>>???	8?.	/	/ 
 
/lE(/2M
 
 
{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 u)(/*EFFGGL}$X_-H  E xx)9)9););X=N=N=P=PQRRHLMJ
$Czz&Z''8?+Ks+R+R(Nho&LNN+

&'
 
		 D/")O'sN	
 	
 		

 	
 	
 	
 S(S.99: % 9	/ 9	/H  !;<< >"8X_=== g..x88O6666666   O     x%88 V !688%ho&IJJ22445 !++(0)9&.o&J ,    
     HHYY_Y_Z Z       =!)!>! = = =!)!<= O$'/'=$# 
 ,  "X_-JF S S "GOOHO$?@@&! ! 7<<GGLw~~l++ *L))) O,(?      ....s9	/D/ D/ D/ D/ D/ D/ D/ D/ D/ D/ D/ D/ D/ D/ D/J 
&&0Eq    $ 1,w||GOOF##HHnhmmoox7RSTT
 
 	"&$
;;;;HO/000s   /B 
BBA HH#&H#!cc
c>B%r$i+*r+!jrjAr("l
r
m(m=rmrmrm1.r0m11Drr!$r!c           
         t           j        rdnd}t                      5 }t          j        |j        j                  5  t          j                            |j        j        d|z             }t          |d          5 }|
                    d           |
                    d| d           |
                    d           d d d            n# 1 swxY w Y   |j        j        rt          ||           t          j        |                                          }|d	         |d
<   |d         |d<   |                                |d<   |                    d          |d	<   t%          |          }i }	t          j        ||gz   |j        j        ||	           t)          |	d|                                            |(|	|t-          |d|                                           <   t/          t          j                            |d                    }
|
st1          d          |
d         }|j        j        r5t          j                            |j        j        |j        j                  }n|j        j        }t          j        |||j        j                   d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   t          j                            |t          j                            |                    S )Nrn   ro   wheel_outputr  r   zpip wheel --wheel-dir z --no-deps .r  r  r	  r
  r  r  r  zbundling wheel bundle_wheel_z*.whlz9Wheel creation failed.  Please see output above to debug.r   rw   )r   ry   r/   r@   rJ   r  r   r|   r	   r   rT  r9  r=  r   r:  rE  rV   r  r;  r>  rl   rU   r]   r>   r  rS  rT   rT  r   rx   r  )rh  rN   r}  r  r   tmpdirra  r   r\  rb  wheel_files
wheel_filerS  s                rO   bundle_wheelr}  V  s   L
+&&eC			 (T9Q)R)R (T (TGLL!9>C;OPP	)S!! 	QGGDMMMGGAVAAABBBGGDMMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ?# 	8"9h777 ***//11!*oN!$]!3%--//M",,^<<J0;; I;.(		
 	
 	
 	
 	, C(--// C CDDDLXE)H&Ghmmoo&G&GHHI27<<8899 	K   !^
?( 	8GLL-x/E MM %O7M
M8?;RSSSSQ(T (T (T (T (T (T (T (T (T (T (T (T (T (T (T (T (T (T (T (T (T (T (T (T (T (T (T (T (T (TR 7<<rw'7'7
'C'CDDDsZ   J<>J%<AC J%CJ%CGJ%J<%J)	)J<,J)	-J<<K K c                    t                      }t          t          j                            | d                    D ]H}t          |          5 }t          j        |          }|||d         <   ddd           n# 1 swxY w Y   I|S )z
    Scan all json files in 'path' and return a dictionary with their contents.
    Files are assumed to be in 'index.json' format.
    z*.jsonrU   N)r  r>   r   r|   r	   r   r  load)r|   	installedr6  r2  r   s        rO   scan_metadatar    s    
 IdH5566 + +(^^ 	+t9T??D&*Id6l#	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ s    A99A=	 A=	)r)  r*  wheelc                    t           j        rdnd}t           j        rdnd}t          j                            d          rdnd}|                     dt          j         d| d	           |j        rt          |j
        j        d
d          }t          |          s_t          t          |                    s!t          j        t          |                     t!          |d                                           d	                    ||j
        j                            dd          |f          }|                     d| d           d	                    ||j
        j                            dd          |f          }|j        rdnd}|                     d| d| d           ddlm}	  |	d|j
        j        d          }
|
r
t-          |
t.                    r|
d         }
i }d|d<   d|d<   d|d<   t1          |j
        d          rd||j
        j        <   d}|                                D ]\  }}|r|sd}|dk    r"t          |j
        j        d          }|                     d| d           |                     d | d           |                     d!           |                     d"                    |
#                     |                     d$           |                     d%           |                     d&                    |
#                     |                     d$           |                     d'           |                     d(| d)           6|dk    rM|                     d*|
 d+           |                     d,|
 d-           |                     d.|
 d/           |dk    rt9          d0           t          |j
        j        d
d          }t          |          sat          t          |                    s!t          j        t          |                     t!          |d                                           d S d S )1Nz$(cygpath -u rr   z ) _CONDA_BUILD_ISOLATED_ACTIVATION-I -m-m	eval "$(''  conda shell.bash hook)"

conda-metahistoryr   r   r   conda activate ""
z--stackzconda activate z "r   r   ccacheFrp  symlinksnativeccache_methodTzccache-ln-binzmkdir r   zpushd zif [ -n "$CC" ]; then
zX  [ -f {ccache} ] && [ ! -f $(basename $CC) ] && ln -s {ccache} $(basename $CC) || true
)r  fi
zif [ -n "$CXX" ]; then
zZ  [ -f {ccache} ] && [ ! -f $(basename $CXX) ] && ln -s {ccache} $(basename $CXX) || true
zpopd
zexport "PATH=z:$PATH"
zexport CC="z $CC"
zexport CXX="z $CXX"
zexport LD="z $LD"
z ccache method {} not implemented)r   ry   r   r   rS   rT  r   
executableis_crossr	   rJ   r}   r   r   r   r   r   r   r   r  conda_build.os_utils.externalr   rG  r
  r  r  r   rh   rg   )file_handler   cygpath_prefixcygpath_suffixpy_flagshistory_filehost_prefix_pathbuild_prefix_pathstackr   r  ccache_methodsdone_necessary_envmethodrz  dirname_ccache_ln_bins                   rO   _write_sh_activation_textr    s   (-<__"N"\1TTrN*..)KLLVwwRVHNcnNNNNN   	z D" AH0,	JJl## 	,..// 3GL11222s##))+++77QX199$GGX
 
 	B-=BBBCCC 	.66tVDDnU 
 +IIEGGG1BGGGHHH======_Xqx'<eDDF ->fd## 	AYF%*z"%*z"#(x 18_-- 	:59N1812"+1133 #	> #	>MFE ">) . *.&Z'',01F,X,X)%%&H/D&H&H&HIII%%&H/D&H&H&HIII%%&?@@@%%szz#) {    
  %%f---%%&@AAA%%u||#) }    
  %%f---%%h///%%&V6K&V&V&VWWWWz))%%&CF&C&C&CDDD%%&EV&E&E&EFFF%%&CF&C&C&CDDDDx''<=== -|YGGL, (W\**++ 	/K--...\3%%'''''( (rQ   c                    t          | d          5 }|                                }|                    d           t          j                            |           d                                         dk    r2|j        j        	                    d          rddl
m}  |||           nt          j                            |           d                                         dk    rt          ||           nAt          j        t                    }|                    d                    |                      |                    |           d d d            d S # 1 swxY w Y   d S )	Nzr+r   r(   rn   r  )write_bat_activation_textro   zJnot adding activation to {} - I don't know how to do so for this file type)r   r   seekr   r|   r  r"  rJ   r  r   conda_build.utilsr  r  r   r   r   r   rh   rT  )script_pathr   r   r   r  r   s         rO   r=  r=    s   	k4	 	  Bwwyy



7K((+1133v==x$//66 HGGGGGG%%b!,,,,Wk**1-3355>>%b!,,,,"8,,CHH!!'!4!4   	                 s   D9EEEc                 \	  
 |                      d          }d |D             }|                      d          }d |D             }| j        | j        _        | j        r| j        st          j        | j        j        t          |          d| j        j	        | j        j
        | j        j        | j        j        t          | j        j                  | j        j        | j        j        | j        j        | j        j        t          | j        j                            }t          j        | j        j        |d| j        | j        j	        | j        |                                 dk               | j        r|                    |           t          j        | j        j        t          |          d| j        j        | j        j
        | j        j        | j        j        t          | j        j                  | j        j        | j        j        | j        j        | j        j        t          | j        j                            }	 |s@t1          j        | j                            di           | j        j        d	           t1          j        |                     d
g                     t1          j        |                     dg                     z   }t          j        | j        j        t          |          d| j        j	        | j        j
        | j        j        | j        j        t          | j        j                  | j        j        | j        j        | j        j        | j        j        t          | j        j                             n# t@          $ rz}ddl!m"
 tG          | d          r| j$        %                                n| &                    d          }
fd|j'        D             d |D             z
  }	|	r	|	|_'        |Y d }~nd }~ww xY w| j        j(        rGtR          j*        +                    | j        j                  rtS          j,        | j        j                  sQt          j        | j        j        |d| j        | j        j        | j        |                                 dk               d S d S )Nrq   c                 6    g | ]}t          j        |          S r   r   ensure_valid_specrL   specs     rO   rP   z%create_build_envs.<locals>.<listcomp>	  s#    MMMtU,T22MMMrQ   hostc                 6    g | ]}t          j        |          S r   r  r  s     rO   rP   z%create_build_envs.<locals>.<listcomp>	  s#    KKKdE+D11KKKrQ   
rT   rJ  rj  rx   bldpkgs_dirsr   disable_pipmax_env_retryrS  rs  r)  r}  rJ   rT   r  is_condar  r  ztest/requireszrequirements/runr  r(   )r,   other_outputsTpermit_undefined_jinjac                 0    h | ]} |          j         S r   r\  )rL   r!  r,   s     rO   r  z$create_build_envs.<locals>.<setcomp>f	  s$    BBB		#+BBBrQ   c                 <    h | ]\  }}|                                 S r   r\  )rL   rH   outs      rO   r  z$create_build_envs.<locals>.<setcomp>f	  s7     F
 F
 F
!1cCHHJJF
 F
 F
rQ   )-
ms_dependsbuild_is_hostrJ   _merge_build_hostr  r   get_install_actionsr}   r  r~   rJ  rj  rx   r  r   r  r  rS  rs  
create_envrU   r   r  r  r   insert_variant_versionsr{   rS   rK   r  r  test_prefixr   conda_interfacer,   r  r  valuesget_output_metadata_setpackagesdirtyr   r|   r   r  )r   notestbuild_ms_depshost_ms_depshost_actionsbuild_actionstest_run_ms_depsr  r  missing_depsr,   s             @rO   create_build_envsr  	  s   LL))MMM}MMMM<<''LKKlKKKL!"AHz 
!/ 
2H ,8'(.H$H$qx455H$,(0(0qx455
 
 
 	H 88'ZVVXX(	
 	
 	
 	
 	 +\***/	mx$hn  18011 H(h,h,18011  M & 	)

>2..0@%    %0OR00   !!++.@""E"EFF G '$&''x+hn(("18#899(H0h4h4"18#899    (   ...... q/**HAO""$$$**$*GG 	
 CBBBqzBBB F
 F
%2F
 F
 F
 
  	%AJG	 	 	 	 	  HN
w}}QX233
 z!(/00

 	H!88(ZVVXX(	
 	
 	
 	
 	
 	

 
s   =EN 
PA0P  PTc                 p+  AB i }si |                                  r#t          t          j        |                      |S t          j        t
                    }	g }
g }g }t          j        | j        j                  5  t          j
        |           Addd           n# 1 swxY w Y   dAd<   t          rt          j	        d         Ad<   | j        rt          | d           |dv 	r=t          | j        j                   t          | j        j                   t%          | ||fg          }t'          |          r t          |d	         d
         j                   g }g }| }d}|D ]\  }}|                                 s| j        j        r3t+          |d          r#|                    t/          |                     n"|                    t/          |                     |                                |                                 k    r|}d}|sQt          d| j        p|                                 d                    |                                                      |S |sg }|D ]Bt          j                            B          d
         rSt;          Bfdt<          D                       r3|                    t          j                            B                     z|                    B           t          d|           t          j         | j        j!        gfd|D             | j                   d | "                    d          D             }t;          d | j#        $                    dg           D                       r|%                    ddg           | j&        }|r||vr|dk    rdn|}t          j        '                    tQ          j)        || j        j                  pd          }|sZ|dk    st;          d |D                       s,|                    |           |	*                    d|           ntW          d          |r5t          j,        |j#        $                    di           |j        j        d           t          j,        |j#        $                    di           |j        j        d           d}t[          |j        j        $                    dg                     }|r|j        j        $                    d i           .                                D ]}||v r|/                    |           |r1ta          j1        d!2                    d" |D                                 }tg          | d|           ti          ||           tk          |            t          j        | j        j                  5  t          | dd#           ddd           n# 1 swxY w Y   |r| j6        s| 7                    d$           n|rtq          |           } ts          | t          j        2                    | j        j:        d%                     | j        j:        }tw          |          r| j        j<        rt          d&|           n/| j        j<        rt          d'           t          j=        |           t          j>        | j        j?                   t          j@        | j        jA        (          }t          te          | j        jC        d)          d*          5 }|D                    d+2                    t          t          |                                         |D                    d+           ddd           n# 1 swxY w Y   t          jG        | H                    d,d                    }|rd+2                    |          }tw          |          r@i }t          jI        rte          | j        d-          } |rmte          |d-          } d	dlJ}! |!K                    d.          t          | d/                    5 }"|"D                    |           ddd           n# 1 swxY w Y   t          jM        | | ||0           nVte          | j        d1          } tO          |           r|rt          d2          tO          |           s|rt          | ||           \  }#}|st          g| j        jQ        rd3gng z   d4d5|#gz   }$| j        jQ        s| j        jR        rd}%nd6d7g}&| jS        s|&T                    d
d8           Afd9|&D             }%|%U                                D ]@\  }'}(t          d:                    | V                    d;          rd<nd=|'|(                     AAd>= t          jW        |$A|%||?           t          jX        | j        jA                   |r<|s:t          |d@|                                             |||t          | d          <   te          | j        jC        d)          })t[                      }*t          j        '                    |)          rZt          |)          5 }t[          |[                                \                                          }*ddd           n# 1 swxY w Y   t          j@        | j        jA        (          |*z
  }+|},|
s|dAv 
r|p| ]                    dB          }-t          |-d	         d
         j                   | }.te          | j        jC        d)          })t          j        '                    |)          r[t          |)          5 }t[          |[                                \                                          }*ddd           n# 1 swxY w Y   nt[                      }*| j        j^        dCk    r| j        j^        n| j        j_        }/t                      5 }0|+D ]_}t          ja        t          j        2                    | j        jA        |          t          j        2                    |0|          dD           `|-D 	]\  }1} t          | j        j                   t          | j        j                   |                                  r"t          t          j        |                      n| j        j        rFt+          | d          r6t          t          j        |                      |1| f|,t/          |           <   |.                                |1$                    dE          k    rO|1$                    dF          s:|1$                    dG          s%t          j@        | j        jA        (          |*z
  |1dF<   dG|1v rHt          ja        t          j        2                    | j        |1dG                   | j        j:                   |1$                    dHi           $                    dG          }2|2rt          j        '                    t          j        2                    | j        |2                    s"tW          dI                    |2                    t          ja        t          j        2                    | j        |2          t          j        2                    | j        j:        |2                     |1$                    dJ          dKk    s'| j6        s J dL| b                                 dM            t/          |           }3|3vrD|3|,vr?|	c                    dN|                                             | jd        sot          j        ;                    | j        jA                  r/t'          t          je        | j        jA                            d
k    s|	Q                    dO           n| jS        | j        _f        t          j>        | j        jA                   t          j>        | j        j                   t          j>        | j        jg                   | "                    d          }4| "                    d          }5| jh        r| jS        st          ji        | j        jA        t          |4          d| j        j^        | j        jQ        | j        j<        | j        jk        t          | j        jl                  | j        jm        | j        jn        | j        jo        | j        jp        t          | j        jq                  P          }
t          jr        | j        jA        |
d| j        |/| jh        |                                 dKk    Q           n|5%                    |4           t          ji        | j        j        t          |5          d| j        js        | j        jQ        | j        j<        | j        jk        t          | j        jl                  | j        jm        | j        jn        | j        jo        | j        jp        t          | j        jq                  P          }t          jr        | j        j        |d| j        | j        js        | jh        |                                 dKk    Q           t[                      }6|1$                    dFg           D ],}|t                    dR          r|6u                    |           -dF|1v rt[          |1dF                   |6z
  |1dF<   |+D ]_}t          ja        t          j        2                    |0|          t          j        2                    | j        jA        |          dD           `t          j        | j        j                  5  t          j
        |           Addd           n# 1 swxY w Y   t          | dJ          sdKn| jw        }7t          |7         |1| A|          }8dS|1v r|1dS         U                                D ]\  }9}:|,U                                D ]q\  }};|;\  }<}|9|<$                    dSi           v rO|<dS         |9         }=|:|=k    rdTndU}>|	y                    dV                    |>|9|1dE         |<dE                              r|8D ]	}?|1| f|,|?<   
| jz        s| j{        rdCn| j        j^        }@| jh        r_t          |@| j        j!        | j        jp        | j        jq        | j        jQ        | j        j<        | j        jk        | j        jm        ddW
  
         t          |@| j        j!        | j        jp        | j        jq        | j        jQ        | j        j<        | j        jk        | j        jm        ddW
  
         		 ddd           n# 1 swxY w Y   n$|s"t          dX| b                                           |,S )Ya  
    Build the package with the specified metadata.

    :param m: Package metadata
    :type m: Metadata
    :type post: bool or None. None means run the whole build. True means run
    post only. False means stop just before the post.
    :type need_source_download: bool: if rendering failed to download source
    (due to missing tools), retry here after build env is populated
    r  NBUILDCONDA_BUILD_STATECONDA_PATH_BACKUPFno_download_sourceFNr   r(   Tr  zPackages for zwith variant {} are already built and available from your configured channels (including local) or are otherwise specified to be skipped.c              3   f   K   | ]+}t           j                                      d          |v V  ,dS )r(   N)r   r|   r  )rL   r   r!  s     rO   r   zbuild.<locals>.<genexpr>	  sN       4 48;BG$$S))!,34 4 4 4 4 4rQ   zBUILD START:c                     g | ]}|v|	S r   r   )rL   r!  built_packagess     rO   rP   zbuild.<locals>.<listcomp>	  s#    KKKSN1J1JS1J1J1JrQ   c                     g | ]	}|j         
S r   )r  )rL   mss     rO   rP   zbuild.<locals>.<listcomp>	  s    999R999rQ   rq   c              3   H   K   | ]}|                     d           dk    V  dS )r   r  NrS   )rL   r  s     rO   r   zbuild.<locals>.<genexpr>	  s1      OOcswwv')OOOOOOrQ   r  pipr  	mercurialhgrr   c              3   H   K   | ]}|                     d           od|v V  dS )rQ  z3.Nr   r  s     rO   r   zbuild.<locals>.<genexpr>	  sH       8 8CGDOOH-->$$,8 8 8 8 8 8rQ   zYour recipe depends on %s at build time (for templates), but you have not listed it as a build dependency.  Doing so for this build.zYour recipe uses mercurial in build, but mercurial does not yet support Python 3.  Please handle all of your mercurial actions outside of your build script.r  ignore_versionpin_run_as_build|c              3   "   K   | ]
}d | dV  dS )z(?:^z(?:\s|$|\Z))Nr   )rL   excs     rO   r   zbuild.<locals>.<genexpr>
  s.      !P!P";#";";";!P!P!P!P!P!PrQ   )r  raise_error)allow_no_other_outputszmetadata_conda_debug.yamlzsource tree in:z&no source - creating empty work folderr  zprefix_files.txtr  r   r  zbld.batr   rS  )r  provision_onlyzbuild.shzFound a build.sh script and a build/script section inside meta.yaml. Either remove the build.sh script or remove the build/script section in meta.yaml.-x-oerrexitPREFIXSRC_DIRBUILD_PREFIXc                 *    i | ]}|v ||         S r   r   rL   rM   r}  s     rO   ro  zbuild.<locals>.<dictcomp>a
  s%    *W*W*WaSVhh1c!fhhhrQ   {} {}={}rn   r   exportCONDA_BUILD)r}  rewrite_stdout_envr  r  z	building TNpermit_unsatisfiable_variantsrT  )r  rU   r   r  r  zetest script specified as {} does not exist.  Please check for typos or create the file and try again.r   r)  zoutput metadata for z is not finalizedz
Packaging z?Not creating new env for output - already exists from top-levelr  r  r  r  ExactInexactz+{} overlap between {} in packages {} and {})
rT   rT  rS  rs  rJ  rj  rx   r   clear_cacheomit_defaultszSTOPPING BUILD BEFORE POST:)}skiprg   r   get_skip_messager   r   path_prependedrJ   r  r   r:  r2   r   needs_source_for_renderr$   r  variantsrK   r    r   skip_existingis_package_builtrW   r   rU   r|   rh   r  r  r  r<   r  remove_existing_packagesrT  r  r{   rS   r   uses_vcs_in_buildr   r   r   r   r  r  r   r  r  r+  r,  r	   r   r  warn_on_use_of_SRC_DIRfinalparse_until_resolvedr#   r!   r  r   rj  r   rC  r  r  r}   r   build_folderrT  r?  r
  r  r  ry   codecs	getwriterwindowsrq   r   write_build_scripts
shell_pathrJ  no_rewrite_stdout_envr  insertr   r   r>  remove_pycache_from_scriptsrl   r]   r   r   r  r~   rT   r/   r   r  r  r   r  r  r  r  r  r  rx   r  r   r  r  rS  rs  r  r  r   addr  r   bundlersr  rT  r  r   )Cr   r  postneed_source_downloadneed_reparse_in_envr  r  r  default_returnr   r  r  output_metasskippedpackage_locationstop_level_pkgtop_level_needs_finalizingrH   omprinted_fnsspecs
vcs_sourcevcs_executablehas_vcs_availableexclude_patternexcludesr\   r  files1r   r  build_stats
build_filer  bf	work_filer  rewrite_envrewrite_varsrM   rM  prefix_file_listr]  new_prefix_filesnew_pkgsr  top_level_metarT   prefix_files_backupoutput_dtest_scriptpkg_pathr  sub_build_ms_deps	to_removepkg_typenewly_built_packagesr2  csumprev_omprev_output_d	prev_csumnaturebuilt_packageindex_subdirr}  r!  sC        `                                                           @@rO   rq   rq   |	  s   ( N vvxx e$Q''(((

8
$
$CLML		ah3	4	4 $ $###$ $ $ $ $ $ $ $ $ $ $ $ $ $ $&C! C#%:.A#B  	  2Q51111}QX.///QX-...%+?AT'U&VWW| 	< a!3!:;;; %)"! 	3 	3EArwwyy :QX3 :8HV8T8T :{2////!((R999wwyyAFFHH$$ "-2*  
	""!&&((NNTf''))O O   "! 		/K( , ,7##C((+ , 4 4 4 4?W4 4 4 1 1 ,  &&rw'7'7'<'<====&&s++++.+...(X!"KKKK-KKKH	
 	
 	
 :91<<#8#8999OOQVZZ	25N5NOOOOO 	+LL%)*** (
 	*E11%/;%>%>TTJN "(9NOOUSU! ! % ,,C 8 8KP8 8 8 5 5, LL,,,HH- #	    %O   & 	9)"&&~r::$,  
 )"&&~r::$,   #O=/7;;<LbQQRRH 	(/7;;& $&&- -C h ,,, &(j		!P!Px!P!P!PPP' 'O a888-000 	q!!!
 !!("788 	H 	Hu$GGGG	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	 	""$"????  	

A 	Arw||AH$57RSSTTT (#>> 	!x 2'111x @>???K   AH%&&&#18+?@@@$qx,.@AA3GG 	1GGDIIfT&\\2233444GGDMMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
 "1;;~t#D#DEE 	'YYv&&F>> A	?K| ;P!!&)44
 )!%gy!9!9J!MMM2))'224
D3I3IJJ )b((() ) ) ) ) ) ) ) ) ) ) ) ) ) )z^     "!&*55
*%% & -K   *%% 'P 'P#6q&*#M#MLIq) %P'L)*?vvRA#Y	:;  8> "QX-K "*.KK,4i+@L#$? G , 3 3A~ F F F*W*W*W*Wl*W*W*WK(3(9(9(;(; 	" 	"1 %$.$5$5+5+>+>v+F+F)6-5()()%& %&!" !" !" !"  . , #/: '"-    9!(:NOOO ?> ?+'=16688'='=>>>$3>E)Aw//0AH13EFFEEM	w~~&'' 7"## 	7q 3 3 5 566M	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7)1EFFFVH q;dl22 
!";";*/ #< #
 #
 	WQZ]1222   57IJJ7>>*++ 	"&'' ;1 #AFFHH$7$7$9$9 : :; ; ; ; ; ; ; ; ; ; ; ; ; ; ;  EEM
 x#x// H   	  !! W	%8%  GLL!5q99GLL!4a88!      ' I I!$QX%6777$QX%56666688 %033444 8) .>q&.I.I %033444/7{H[^^,!&&((HLL,@,@@@LL)) A-5\\(-C-C A *!(2FGGG-W W%
 x''OQVXh-?@@!(BS  
 'll6266::8DD 7>>"',,qv{*K*KLL (PPVPV +Q Q   OQV[99QX%6DD   LL((G33qw33E!&&((EEE 433&q>>>11hh6N6NHH4!&&((44555
 H GMM!(*>??H !$BJqx/C$D$D E E J J
 		]    67_2AH$8999AH$9:::AH$8999'(||F';';,-LL,A,A): Cao C+2+F ! 4 %l 3 3 &'(x';&'hn()(8()(8-2183H-I-I()(8,-H,@./h.D./h.D-2183H-I-I, , ,L $. ! 4 ,$*'(x'-)*)*W)<     .44\BBB(/(CH1!"344##$8#8"#(.$%H$4$%H$4).qx/D)E)E$%H$4()(<*+(*@*+(*@).qx/D)E)E) ) )  *H1) '#$8#$8#8%&Z%&VVXX%8    !$I%\\'266 - -<<55 -%MM!,,,
 (**,/0A,B,BY,N) .  GLL)<a@@GLL)=qAA%)     -ah.CDD 4 4%.3334 4 4 4 4 4 4 4 4 4 4 4 4 4 4.5a.@.@LwwafH+3H+=h3PU+V+V("h..*2;*?*E*E*G*G & &JD$.6nn.>.> & &
73: 0q#'=+<+<["+M+M#M#M0=k0J40PI8<	8I8IWWyF$'KK(U(\(\,2,0,4V,<,9&,A	)* )*%& %& %&& *> @ @3;Q-// H2()2X1 !
 z '#/()(<*+(*@)*)>"#(.$%H$4$%H$4$%H$4(,*/    $+$%H$8&'h&<%&X%:hn ! 0 ! 0 ! 0$(&+   }IW	 W	 W	 W	 W	 W	 W	 W	 W	 W	 W	 W	 W	 W	 W	r  	;/::: Os   >B  B$'B$	W((W,/W,(A^^^a--a14a1<4j<<k k 54n55n9<n9]=AVNAN$NAVN$AN(N(AVN+AN(N,GAVVAV
VAV
c                    t           j        rddgnddgt          j                            dd          ddgg d	d
gd}t          j                            |           d         }|                                D ]0\  }}|                                	                    |          r|} n$1t          d                    ||                     |S )Nzbash.exez-elrC   z-eCOMSPECcmd.exe/d/c)
powershellz-executionpolicybypassz-FilerQ  )ro   rn   z.ps1z.pyr(   zPDon't know how to run {} file.   Please specify script_interpreter for {} output)r   ry   r   r   rS   r|   r  r   r"  r   NotImplementedErrorrh   )script_filenameextensions_to_run_commandsfile_extr   commandinterpreter_commands         rO   r;  r;  }  s     ',lF
E""	955tTBEEEz	" " w003H288:: 
 
W>>&&s++ 	")E	 "//5vh/P/P
 
 	
 rQ   c                 V   t          t          j                            | j        d                    }|D ]s}t	          |          5 }|                                }d d d            n# 1 swxY w Y   d|v r2d|                     d          vr| j        j        rt          d          td S )Nz	run_test*r  source_filesr  a)  In conda-build 2.1+, the work dir is removed by default before the test scripts run.  You are using the SRC_DIR variable in your test script, but these files have been deleted.  Please see the  documentation regarding the test/source_files meta.yaml section, or pass the --no-remove-work-dir flag.)
r>   r   r|   r	   r   r   rt  rJ   remove_work_dirr  )rN   
test_filesr   r  contentss        rO   r  r    s    bgll8=+>>??J  !WW 	!wwyyH	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! !!h&:&:6&B&BBB/ C 9   s   A''A+	.A+	c                    d|_         d |_        i }t          t          | |d                    d         d         }t	          j        t                    }|                    d           t	          j        |j	        j
                   |j                            di                               d          r|j        st          |d           ||fS )	NFrJ   reset_build_idr   r(   zTesting based on recipes is deprecated as of conda-build 3.16.0.  Please adjust your code to pass your desired conda package to test instead.r  rO  r  )need_cleanupr  r    r"   r   r   r   r   rC  rJ   r  r{   rS   source_providedr$   )r  rJ   
hash_inputrN   r   s        rO   (_construct_metadata_for_test_from_reciperY    s    FFJjFFF 		
H 
8
$
$CHH	H  
 
K()))}$$((88 =' 	=e<<<<ZrQ   c                    t          j        |           \  }}||_        ||_        i }t          j                            t          j                            |d                    }t          t          j                            |d                    5 }t          j
        |          }d d d            n# 1 swxY w Y   |d         |_        t          j                            |d          }t          j                            |          rZt          t          j                            |d                    5 }t          j
        |          }d d d            n# 1 swxY w Y   n	d|_        i }||_        t          j        t                     }t          j                            t          j                            t          j                            |                               }	t          j                            |	          }
d}dD ]}|
                    |          rd}|s|                    d           |j        }	 t	          j        |           n#  Y nxY wt          j                            |t          j                            |                     }	t          j        | |	           |}	t          j                            |	          }t3          ||j        d	
           	 t7          t          j                            |d          |d          d         d         }nd# t8          t:          f$ rP t=          j        |d         |d         dtA          |d                   |d         dd|d         id|          }Y nw xY w|j!        rd|j"        j        d<   tG          |$                                          |j"        _%        tG          t          j&        |j"        j'                            }tQ          |          fd|D             }|vr|)                    d           ||j"        _'        t          j*        |j"        j+                   ||fS )Nr  r  rT   r  F)rt   zlinux-zosx-rT  TaM  Copying package to conda-build croot.  No packages otherwise alongside yours will be available unless you specify -c local.  To avoid this warning, your package must reside in a channel structure with platform-subfolders.  See more info on what a valid channel is at https://conda.io/docs/user-guide/tasks/create-custom-channels.htmlr(   r4  r  rT  r   rU   rV   )rU   rV   build_numberrq   )numberr  r  r  )packagerq   r  r  rT  rG   c                 $    g | ]}|d k    r|nS )localr   )rL   url
local_paths     rO   rP   z=_construct_metadata_for_test_from_package.<locals>.<listcomp>  s%    BBBc3'>>CCzBBBrQ   ),r   get_recipe_abspathrV  r  r   r|   r  r	   r   r  r  r~   r   r  rK   r   r   abspathr   r  r   r   rT  r   r   r   rJ  r"   r   
SystemExitr   fromdictintrT  rJ   r
  r  	used_varsr  rs  r9   r  rC  r  )r]  rJ   r  rV  rX  r  r   package_datar   local_pkg_locationlast_element
is_channelr   	local_dirlocal_channelrN   rJ  ra  s                    @rO   )_construct_metadata_for_test_from_packagern    s   $7@@J&F"FJwZ @ @AAH	bgll8\22	3	3 $qy||$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ &h/Fh(9::J	w~~j!! "',,x):;;<< 	&1J	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& #(
  FN

8
$
$C ))"'//"'//':R:R*S*STT 7##$677LJ8  ""8,, 	J 'Q	
 	
 	
 &		K	""""	DW\\)RW5E5Eg5N5NOO!3444&GOO$677M M6<KKKK
 GLL8,,VE
 
 


 Z  
 
 
 $ )0+I6 
 ",~">??*73  "'Y(? @
 
 
 
 

(  >5= 12 $Z__%6%6 7 7HO!(/">??@@D-((JBBBBTBBBDAz"""#'HO 	K()))ZsC   B44B8;B88EE EI I*<L' 'ANNc                    t          | j        d          r| j        j        n| j        }|rt          j                            t          j                            |d                    }t          j                            |d          }t          j                            |          rt          j                            |          rt          j
        || j        j        | j        j        d| j        j        d           t          j                            |d          }g }t          j                            |          r;t          |          5 }t!          j        |          }d d d            n# 1 swxY w Y   | j                            di           }||d<   || j        d<   d S | j                            di                               d          r| j        st+          | d	
           d S d S d S d S )Nr  r  r  T)r  rx   r~  ztest_time_dependencies.jsonr  rO  Fr  )r  rJ   r  r|   r   r  r	   r`  r   r   r   r  r   rx   r   r   r  r  r{   rS   rW  r$   )rN   r  r  rQ  dependencies_file	test_depsr   test_sections           rO    _extract_test_files_from_packagers  !  s$    8?L11	""] 
  E7##BGLLV$D$DEEW\\(F33
7>>*%% 	E"'--
*C*C 	E O(' /    !#Z9V W WIw~~/00 -+,, - $	!I- - - - - - - - - - - - - - -#=,,VR88L'0L$$0HM&!!! }  ,,00@@ E/ E eDDDDDD=E E8E EE Es   E00E47E4c                     t           j                            |           s#t           j                            |           dk    rt	          | |          \  }}nt          | |          \  }}||fS )Nrz  )r   r|   r   r  rY  rn  )recipedir_or_packagerJ   r   rX  s       rO   construct_metadata_for_testrv  H  sv    
*++

7011[@@@ &
 
:: B &
 
: j=rQ   c           	         t          j        | j        j        d          5  t          j        | j        j        d          5  t          j        |           }d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d|d<   d|d<   d|d<   d|d	<   | j        j        |d
<   d|d<   | j        dk    rd|d<   d|v r|d= t          | j        j
        d          }t          | j        j
        d          }t          |d          5 }|                                D ])\  }}|dk    r||                    d| d| d           *| j        rt          ||            d d d            n# 1 swxY w Y   t          |d          5 }|                    d           |                    d| d           |                    d           |r|                    |           t!          |          r6|s4|                    t          |                                                     d d d            n# 1 swxY w Y   t%          j        |d           ||fS )NFr  r  r  FalsePIP_NO_BUILD_ISOLATIONTPIP_NO_DEPENDENCIESPIP_IGNORE_INSTALLEDPIP_CACHE_DIRPIP_NO_INDEXrQ  PYTHONDONTWRITEBYTECODEr  zconda_build.shzbuild_env_setup.shr  rr   zexport z="r  z!if [ -z ${CONDA_BUILD+x} ]; then
z    source r   r  i  )r   r  rJ   r}   r  r   r:  pip_cache_dirrT  r	   r  r   r   rT  r8  r  r   r   r   r   )	r   r  r)  r}  r+  env_filer*  rM   rM  s	            rO   r  r  W  s    
	ah2E	:	: ( (!!("7?? 	( 	("Q'''C	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(( ( ( ( ( ( ( ( ( ( ( ( ( ( (  'C %,C ! "&C"&C 81C Cx8)-%& QX&(899IAH%';<<H	h		 -IIKK 	0 	0DAqBww1=.1.....///" 	-%b!,,,- - - - - - - - - - - - - - - 
i		 .
5666
+x+++,,,
 	HHV* 	.f 	.HHT*%%**,,---. . . . . . . . . . . . . . . HYhs[    A9 A"A9"A&	&A9)A&	*A99A= A=AE))E-0E-B H00H47H4c	           
         t          j        t                    }	t          |d          5 }
|
                    d                    t           j        rdnd|                     t           j        r|
                    d           n|
                    d| d           |r| j        j        }| 	                    d	          rt          j        d
k    r|dz   }|
                    d                    |t          | j        j        d                               t           j        r|
                    d           |r|
                    d                    | j                            | j        j        | j        j                  t          | j        j        d                               t           j        r|
                    d           |r|
                    d                    | j                            | j        j        | j        j                  t          | j        j        d                               t           j        r|
                    d           |r|
                    d                    | j                            | j        j        | j        j                  t          | j        j        d                               t           j        r|
                    d           |r|D ]}t           j        rnt&          j                            |          d         dk    r/|
                    d| d           |
                    d           f|	                    d           |t&          j                            |          d         dk    r0|
                    d                    t.          ||                     d d d            d S # 1 swxY w Y   d S )Nr  z{source} "{test_env_script}"
callr   )r   test_env_script IF %ERRORLEVEL% NEQ 0 exit /B 1
set -e
zbuild/osx_is_appr   z"{python}" -s "{test_file}"
zrun_test.py)rQ  	test_filez"{perl}" "{test_file}"
zrun_test.pl)perlr  z"{lua}" "{test_file}"
zrun_test.lua)luar  z"{r}" "{test_file}"
z
run_test.r)r  r  r(   rn   zcall "r  zCFound sh test file on windows.  Ignoring this for now (PRs welcome)ro   z'"{shell_path}" {trace}-e "{test_file}"
)r  r  trace)r   r   r   r   rT  rh   ry   rJ   test_pythonr  r   r   r	   r  perl_binr  host_platformlua_binrscript_binr   r|   r  r   r  )rN   test_run_scriptr  py_filespl_files	lua_filesr_filesshell_filesr  r   tfr  
shell_files                rO   _write_test_run_scriptr    sL    
8
$
$C	os	#	# Ir
,33!&;vv8 / 4  	
 	
 	
 < 	)HH89999HH'E'''((( 	>"/5K!!"455 0#,(:R:R)C/HH/66&"8?#;]KK 7     | ><=== 
	>HH*11!11 3X_5R  #8?#;]KK	 2     | ><=== 
	>HH)00 // 3X_5R  #8?#;^LL	 1     | ><=== 
	>HH'..o11 3X_5R  #8?#;\JJ	 /     | ><=== 	)  
< w''
33A6&@@!9*!9!9!9:::!DEEEEa    W%%j11!4==HHBII'1Zu J    KI I I I I I I I I I I I I I I I I Is   NOOOrr   c                    | j         j        r|                                 dk    rRt          j        || j         j        d          }t          j        r%| j         j        t          j        z   |d         z   |d<   |	                    t          | j         j                             d |                                D             }t          j        rdnd}t          | j         j        d|           }	t          | j         j        d	|           }
t          |	d
          5 }t          j        s|                    d| d           | j         j        r"|                                 dk    s	t          j        rp|                    d                    t$          j        | j         j        rdndt          j                            d          rdndt$          j                             nIt          j                            d          rdnd}|                    dt$          j         d| d           |                    d| j         j         d           t          j        r|                    d           t          j        s|                    d           d d d            n# 1 swxY w Y   t1          | |
|	||||||	  	         |
|	fS )Nr)  Tprepend_prefixPATHc                 N    i | ]"\  }}t          |          t          |          #S r   )rI   )rL   r\   rz  s      rO   ro  z&write_test_scripts.<locals>.<dictcomp>  s*    HHHeC#e**HHHrQ   r  r  zconda_test_env_vars.zconda_test_runner.r  r  r  zset "CONDA_SHLVL=" && @CALL {}\condabin\conda_hook.bat {}&& set CONDA_EXE={python_exe}&& set CONDA_PYTHON_EXE={python_exe}&& set _CE_I={}&& set _CE_M=-m&& set _CE_CONDA=conda
z--devrr   r  z-i)
python_exer  r  r  r  r  r  r  r  zset +e
)rJ   r9  rU   r   prepend_bin_pathr  ry   r   pathsepr!  r'   rK   r   r	   r  r   rT  rh   r   r   rJ  r   rS   r  r  )rN   rp  r  r  r  r  r  r  rY  r  r  r  r  s                rO   write_test_scriptsr    s    ?# x}}''A'A)ho1$
 
 
 < 	+bj88F;KK V
 OO)(/*ABBCCC IHx~~7G7GHHHHl,UUF8?35TF5T5TUUO8?35R&5R5RSSO	os	#	# #!r| 	)HH'E'''(((?# 	>HMMOOw,F,F| / 06v
#+?#8@b:>>*LMM #&> 06 0 0   & z~~&HIIGG 
 Z#.ZZHZZZ   HHH(CHHHIII| ><===| 	!HHZ   G#! #! #! #! #! #! #! #! #! #! #! #! #! #! #!J 
 
 
 O++s   E6JJ!$J!c                   # t          j        t                    }i }t          | d          r|                                 n| }|st          d|           t          | d          r!| }t          j        |j        j                   nt          | |          \  }}|j        j
        rdnd}	t          |           t          | d           odt          j                            |           oE|                     t                     o+t          j                            |           t$          d         v }
|
s,t'          j        |                                |j                   t+          ||j        j                   t-          |          \  }}}}}}t/          |||||g          s|j        j        st          d|           dS |j        j        rjd	|j        j        fd
|j        j        ffD ]\  }}t          j                            |          rt          j                            t          j                            |          d                    d|z  |                                t=          |j        d|z            f                    }t?          ||| d           |j         rt          j                            t          j                            |j        j!                  d                    d|                                |j        j"        f                    }t?          |j!        |d           n|#                    d           tI          |           |%                    ||||          }t          j&        |j        j'                  5  tQ          t          j        )                                          ##*                    t'          j+        ||j'                             d#d<   d#d<   tX          rt          j        d         #d<   ddd           n# 1 swxY w Y   |j        j-        r|.                                dk    r!t          j/        #|j        j'        d          #t           j0        r%|j        j'        t          j1        z   #d         z   #d<   |j        j'        #d<   d#v r#d= |j2        s|j3        rdn|j        j"        }t          j        |j        j'                   	 t'          j4        |j        j'        tk          |          d	||j        j
        |j        j6        |j        j7        tk          |j        j8                  |j        j9        |j        j:        |j        j;        |j        j<        tk          |j        j=                            }nq# t|          t~          t          t          t          f$ rK}|#                    d t          |                     t          |||j        jE        |j        !            d}~ww xY wt          t          jG                  d"k    rd#nt          t          jG                  }t          d$|t                    5  t'          jJ        |j        j'        ||j        d	||jK        |.                                dk    %           ddd           n# 1 swxY w Y   t          j&        |j        j'                  5  tQ          t          j        )                                          ##*                    t'          j+        ||j        j'                             d#d<   tX          rt          j        d         #d<   ddd           n# 1 swxY w Y   |j        rdd&lLmM}  ||j        j'                  }||jN        d'         d(                  d)         }t          |j                  }t          |d*d           t          ||||j        j'                   t          ||d|j        j'        d           |j        j        r|j        j        #d+<   t          |#||||||	          \  }}t           j0        r%t          j        T                    d,d-          d.d/|g}n t          g|j        j
        rd0gng z   d1d2|gz   }	 i }|sd|j        j
        s|j        jV        rd} no#fd3d4D             } |j        j6        rU| W                                D ]@\  }!}"t          d5X                    |                    d6          rd7nd8|!|"                     At          jY        |#|j        j        || 9           t          |d:|.                                            |4|j        j[        r(||t          |d;|.                                           <   t          j        ]                    t;          |j        j        d<                    rt          j_        d=d          t          d>|           n:# t          j_        $ r(}t          |||j        jE        |j        !            d}~ww xY w|j`        r"|ja        |st          j        |ja                   dS )?zr
    Execute any test scripts for the given package.

    :param m: Package's metadata.
    :type m: Metadata
    r  zTEST START:rJ   z-x rr   r   zNothing to test for:Tr  rq   rH   z%s_prefix_movedz	%s_subdirz prefix
work_movedworkzNot moving work directory after build.  Your package may depend on files in the work directory that are not included with your package)r   r   TESTr  r  r  r  Nr)  r  r  r  r  rT  r  z;failed to get install actions, retrying.  exception was: %s)move_broken
broken_dirrJ   r~  r   CONDA_PATH_CONFLICT)rJ   r}  rT   r  r  )get_installed_packagesr]  rU   r   Fr  rB  rC  rD  rE  r  r  r  c                 *    i | ]}|v ||         S r   r   r  s     rO   ro  ztest.<locals>.<dictcomp>  s%    TTTQ1PS88q#a&888rQ   )r  r  r  rn   r   r  )r}  r  r  r  ztesting test_TEST_FAILEDr   z	TEST END:)br   r   r   r  r  rg   rC  rJ   r  rv  rJ  rs  r   r|   r   r   r<   r   r5   r   clean_pkg_cacher  r   r  test_run_postrP  r}   r  r   r	   rL  r?   rW  r  r~   r   r   get_test_depsr  r  r  rE  r!  r:  r2   r9  rU   r  ry   r  rT  r  r  r  rj  rx   r  r   r  r  rS  rs  r   r-   r0   r)   AssertionErrorrI   tests_failedr  r1   path_conflictr=   r7   r  r  r  r  r{   r  r$   r  r   r  rS   r  r  r   rh   r>  rl   r  r]   r`  r   r   rV  r  )$ recipedir_or_package_or_metadatarJ   r  r  r  r   rX  test_package_namerN   r  in_pkg_cacherH   r  r  r  r  r  rU   r   r  r!  rT   actionsr  conflict_verbosityr  r  r   r  r4  r  
test_statsr,  rM   rM  r}  s$                                      @rO   r  r  5  sb    
8
$
$CJ 3V<<	.(--///-   0m.////:: 
3HO,----:,f 
  
* _*2EEE %X... 4h??? 	NGNN;<<	N,556NOO	N GOO<==1M	   BAAA8X_%=>>> >S> >:Ax7I{ ;)WEFF- 	$&7888t& !
X_01ho23
 	L 	LLD& w}}V$$ L w||GOOF++HH-4$MMOO#HO[45GHH 	 	 *&$68J8J8JKKK # 	E7<< 899,9TUVV D
 &fotVDDDL	
 	
 	

 x   ""8Xy'JJE		ho9	:	: G G2:??$$%%

7#hv7IJJJKKK#)  M% 	G')z2E'FC#$G G G G G G G G G G G G G G G ?# 
x}}''A'A$,T
 
 
 | Mo1BJ>VLFO/CM O	)'5	)_(  
K+,,, -O'%LL/'O+O+x;<<O+ 3"/7"/7x;<<
 
 
  	%    	I3s88	
 	
 	
 	#1?		
 	
 	
 	
 	!* w$%%22 	&'' 
 
&(:M	J	J 	
 	
O'?&]]__/	
 	
 	
 	
	
 	
 	
 	
 	
 	
 	
 	
 	
 	
 	
 	
 	
 	
 	
 
	ho9	:	: G G2:??$$%%

7#hx7RSSSTTT#) % 	G')z2E'FC#$G G G G G G G G G G G G G G G  M<<<<<<**8?+FGG	(-	26:;GD+HO<<Xud+++(L%9TUUU8UD(/*EtLLL & 2!1I'#x9g{E NK | 
z~~i33T4M L!.6vvB8Y,- 	
%
 	2$ (M "TTTT2GTTT?*  + 1 1 3 3  1&--)4)=)=f)E)E S8 ! !      O, #.    j">X]]__">">??? X_%= HRi*C(--//*C*CDDEw~~d8?#;]KKLL < 3B;;;+0111(   #1?		
 	
 	
 	
 	  'v0<^<F%&&&4sl   B PP"P-B,V #X=AXXAZ++Z/2Z/B ]  ]$']$E)g: :h1	#h,,h1c                    t          |          st          j        |           t          | d          rt	          |           }n| }t          |t          j                            |                    }|rt          j	        t                    }	 t          j        ||           |                    d                    t          j                            |          |                     n# t          $ r Y nw xY wt!          t          j                            t          j                            |                    |j        d           t'          j        dt          j                            |          z              dS )z
    Causes conda to exit if any of the given package's tests failed.

    :param m: Package's metadata
    :type m: Metadata
    rJ   z*Tests failed for {} - moving package to {}r(   r4  zTESTS FAILED: N)r   r   r   r  r   r	   r|   r  r   r   r   rb  ri  r   rh   r   r   r   rJ  r   r  )package_or_metadatar  r  rJ   r!  r  r   s          rO   r  r  E  sj      
J"H-- "-..!
BG,,S1122D 
x((	KT"""HH<CCG$$S)):    
  	 	 	D	GOOBGOOC00116<QR	
 	
 	
 	
 H 0 0 5 5566666s   AC+ +
C87C8c                     t           j                            d          rft          j        d          } | Rt          j        d                    t          j        	                    t          j
                                       d S d S d S )NlinuxpatchelfzError:
    Did not find 'patchelf' in: {}
    'patchelf' is necessary for building conda packages on Linux with
    relocatable ELF libraries.  You can install patchelf using conda install
    patchelf.
)r   r   r   r   r   r  rh   r   r  r	   	dir_paths)r  s    rO   check_externalr  f  s    
|w'' +J77H" #)&JOOH$677# #     rQ   c                   9: g }t          |           } t          j        rt          j                            t          j                            t          j                  dd          }t          j        	                    |          rt          j        d| dd           d}	t                      }
g }t          j                    }|rd}d}d|_        n|r
d}d|_        nd }d }| r@	 |                                 }t!          |d	          r|                                n|}t!          |d
          r|}|j        }|j        |_        |j        rD|                                |j        vr)|                    |                                d           t          j                            |j                  }|                    |                                           |j        s3|rt1          |          nt3          |          }t5          ||d          }n|ddff}n|}t          j                            |          }|                    d                              d          }|                    t          j                            |                     t;          |||d|j         d          }|dv r
|d d         }|D ]\  }}}t?          |j        j                    |Zt          j!        |j        j"                   t          j!        |j        j#                   t          j!        |j        j$                   |                                |j        j%        vrA|j                            |                                |&                                d           tO          ||||||
|          }|s|(                                D ]\  }}|)                    tT                    rHt          j        +                    |          r)tY          ||j        -                                |           |\  }}|j.        /                    di           /                    d          }|rta          t          j1        |j        j2                  t          j3        t          j        4                    t          j                            t          j                            |                                        gz             }t          j5        tl                    }t!          |d          r7to          |8                                          }|9                    d           nt          j1        |          }|D ]}|:                    d|            d                    d tw          d          D                       }|<                    d          t{          |          t{          d                    |>                                ?                    dd                              gz   } d | D             } 	 t          d |!          5 }!t          jB        |!| d|j        jC        |j        jD        |"          }"d d d            n# 1 swxY w Y   nH# t          t          f$ r4}#|9                    d#G                    ||#                     Y d }#~#Yd }#~#ww xY wt          ||"d$|d%          }$tY          to          |$I                                          d&         d&         |j        -                                |           |
J                    ||i           n|
J                    |           t          j        K                    |j        jL                  r|j        j        s|j        jM        s|N                    d'          sd|_        t          j                            t          j                            |j        jL                  d                     d(|>                                |j        jC        d)f                    }%t          |j        jL        |%d*           |P                                 n# t          $ r}#g d+}&d, |
(                                D             }'g }(| Q                    |g           t          |#jS        |#jT                  D ]]\  }})|U                    d          d&         U                    d-          d&         9|r0t          9fd.|W                    d/          D                       r ||v rS|P                    d0           t          d1G                    |          t          |#jZ                  z   d2z   |	z             ||&v r|                    |           d3}	t          t          j                            |9                    }*|*s.t          t          j                            |d49                    }*t          t          j                            |9d5z                       }+|+s1t          t          j                            |d49d5z                       }+d},|*s|+r|*|+z   D ]:t          :fd6|'D                       s}t;          :|j        7          }-|-D ]d}.t          j\        t{          |)          |.d&         |          r9t          d8G                    |                     |(                    :           d},e|,s|P                    d0            _|s|^                    |          r}|^                    |          t          |<                    d9                    k    rD|P                    d0           t          d:| d;t          |#jZ                  z   d2z   |	z             |                    t          j                            |                     | Q                    |(           Y d }#~#nd }#~#ww xY w| @d< |
D             }/|d=v r.d> |
D             }0t          |/|7           t          |0|7           d&d?lbmc}1  |1|/          }2t          d@           t          t          je        |2ddA                     t          d2           t          j                    |z
  }3t          dB |I                                D             pd&g          }4t          dC |I                                D             pd&g          }5t          dD |I                                D             pd&g          }6t          dE |I                                D             pd&g          }7t          dFG                    dGt          jh        |3          t          jh        |6          t          jh        |7          t          ji        |4          t          ji        |5          H                     |3|4|5dI|dJ<   |jj        rBt          |jj        dK          5 }8t          jl        ||8           d d d            n# 1 swxY w Y   to          |
8                                          S )LNpkgsz.trashzdel /s /q "z\*.*" >nul 2>&1Tr   rr   FrU   rJ   )resetr  r   r   )rJ   r  r  rU  bypass_env_checkTFr(   )r  r  r  r  r  )rJ   r  r  downstreamsr  zLDictionary keys for downstreams are being ignored right now.  Coming soon...zTesting downstream package: c              3   l   K   | ]/}t          j        t          j        t          j        z             V  0d S r   )randomchoicer  ascii_uppercasedigits)rL   rH   s     rO   r   zbuild_tree.<locals>.<genexpr>  sQ       3" 3" )* %+M(.(>(N%& %&3" 3" 3" 3" 3" 3"rQ   
   r  r  rE   r  c                 6    g | ]}t          j        |          S r   r  r  s     rO   rP   zbuild_tree.<locals>.<listcomp>  s0     )" )" )"FJE$;D$A$A)" )" )"rQ   rH   )r   rY  )r}  rT   r  rs  zFSkipping downstream test for spec {}; was unsatisfiable.  Error was {}r  )package_subsetrequire_filesr   z%build/no_move_top_level_workdir_loopsr  main_build_loopr  )rQ  r  r%  zmro-baser  r  c                 4    g | ]}|d          d          j         S )r(   r   )rL   entrys     rO   rP   zbuild_tree.<locals>.<listcomp>\  s#    "X"X"X58A;#3"X"X"XrQ   r  c              3   N   K   | ]\  }}|                                 k    V   d S r   r\  )rL   rH   output_metapkg_names      rO   r   zbuild_tree.<locals>.<genexpr>e  sL       $ $(K  0 0 2 22$ $ $ $ $ $rQ   r  )remove_foldersz2Can't build {} due to environment creation error:
r   a   Typically if a conflict is with the Python or R
packages, the other package or one of its dependencies
needs to be rebuilt (e.g., a conflict with 'python 3.5*'
and 'x' means 'x' or one of 'x' dependencies isn't built
for Python 3.5 and needs to be rebuilt.z..z
-feedstockc              3   B   K   | ]}|                               V  d S r   r  )rL   r|   r  s     rO   r   zbuild_tree.<locals>.<genexpr>  s@       # #<@DOOJ77# # # # # #rQ   r  zIMissing dependency {0}, but found recipe directory, so building {0} firstrq   zCan't build z$ due to environment creation error:
c                 F    g | ]}|                     t                    |S r   )r   r<   r|  s     rO   rP   zbuild_tree.<locals>.<listcomp>  s*    RRRaQZZ8P-Q-QRRRRrQ   r  c                 <    g | ]}|                     d           |S )z.whl)r   r|  s     rO   rP   zbuild_tree.<locals>.<listcomp>  s)    BBBqzz&/A/AB!BBBrQ   )get_hash_inputzO
INFO :: The inputs making up the hashes for the built packages are as follows:)r  r  c                 8    g | ]}|                     d           S )rb   r  rL   steps     rO   rP   zbuild_tree.<locals>.<listcomp>  s"    FFFt488E??FFFrQ   c                 8    g | ]}|                     d           S )rc   r  r  s     rO   rP   zbuild_tree.<locals>.<listcomp>  s$    BBB4dhhv&&BBBrQ   c                 8    g | ]}|                     d           S )r`   r  r  s     rO   rP   zbuild_tree.<locals>.<listcomp>  s$    HHH),,HHHrQ   c                 8    g | ]}|                     d           S )ra   r  r  s     rO   rP   zbuild_tree.<locals>.<listcomp>  s$    JJJ4$((:..JJJrQ   z{bar}
Resource usage summary:

Total time: {elapsed}
CPU usage: sys={cpu_sys}, user={cpu_user}
Maximum memory usage observed: {memory}
Total disk usage observed (not including envs): {disk}T####################################################################################)barrd   r`   ra   rf   rc   )r  rf   rc   totalr  )mr   r   ry   r   r|   r	   r   r   r  r   r   r  r   r  anaconda_uploadpopleftr  rU   rJ   set_build_idr  compute_build_idrW   r	  r%   r&   r   r  r  r"   r  r  rK   rC  r}   r  r  r  rV   rq   r   r   r<   r   r  rE  r{   rS   r  r  rs  path2urlrc  r   r   r
  r  r   r  r   r  r,   r  r  r/   r   r  r~   r  r0   r   rh   r   r  r!  r`  r  rU  r  r?   clean
extendleftrI  r  
matchspecsr  r  r  r  rI   messager>   match_peer_jobrg   r  r   handle_anaconda_uploadhandle_pypi_uploadconda_build.inspect_pkgr  r  r`  maxr$  ri   rj   
stats_filer   r  );recipe_listrJ   r  
build_onlyr  r  r  to_build_recursive	trash_dir
extra_helpr  retried_recipesinitial_timerN   r  rU   cfgrecipe_parent_dir	variants_metadata_tuplesr  r  packages_from_thisr!  dict_and_metarH   r{   r  rs  r   r(  r_stringr!  rz  r  r  
local_filer  
skip_namesbuilt_package_pathsadd_recipes	matchspecrecipe_globfeedstock_glob	available	dep_metasdep_metatarballswheelsr  hash_inputs
total_timemax_memory_used
total_disktotal_cpu_systotal_cpu_userr   r  r  s;                                                            @@rO   
build_treer  u  s    $$K| SGLL!@!@&(SS	7==## 	S OE)EEETRRRR J ]]NO9;;L !&	 !& H
 ^0\	0 ((**F$+FF$;$;G6;;===Dvx(( -!o* # # Fs|(K(K(((EEE$&GOOHM$B$B!"))(--//:::~ B $<6x@@@1(;;  ': )5' ' 'OO )1%'?&AOO$&GOOF$;$;!s++22488"))"'*:*:6*B*BCCC
 #0%27'*y=%)# # # }$$"1"1""5
 HW V VC.0C$X_%<===<K ;<<<K <===K ;<<<==??(/*FFFO44 )9)9););4 5    &+)=(;#1!& & &"  V>.@.F.F.H.H SD SD*]<<(@AA RbgnnG G R !X_-A-A-C-C5QQQQ"/4&*immFB&?&?&C&CM&R&R& I"+0 % 1(/2N O O$)N(*,.GOOBGOOC<P<P,Q,Q)* )*%& %&#"!"	, 	,L #("28"<"<C&{F;; M.2;3C3C3E3E.F.F #%I!" !" !" !"
 /4.?.L.L'2 4" 4" #)M)M)M N N N ,.77 3" 3" .32YY	3" 3" 3" ," ," )-(>(>$-cNN$-chhtyy{{7I7I#q7Q7Q.R.R$S$SB" )")" )"NS)" )" )"!-);/28*& *& *& 
%*)/292M,2,10537;3J9=9Q9E3* 3* 3*
%* 
%* 
%* 
%* 
%* 
%* 
%* 
%* 
%* 
%* 
%* 
%* 
%* 
%* 
%* %7$@(" !- !- !- %(HH)GGMvcST~~%& %& %& %-HHHH!- .F$($+$*3626." ." ."
 !%$():):)<)<$=$=a$@$C+/;+;+;+=+=*/!" !" !" !" !" '--sM.BCCCCgSDj #))*<===7>>(/":;; VO)V4V  ))*QRRV &*HN7<<(@AA , ( ( ; 1	 
 
D .ho.FfUUU NN , Z	0 Z	0 Z	0MMMJ"X"XAUAUAWAW"X"X"XK""F8,,,"%aj!,"?"? D DY99S>>!,22377:   $ $ $ $,4,L,L/3 -M - -$ $ $ ! !  ,,,IIUI333&MTT"  ai..) 	
 %%   *$$&--c222B  #27<<0A8#L#LMM" X"&rw||4EtX'V'V"W"WK!%GLL!2H|4KLL" " & %)%6h>UVV& &N "	 5. 5&1N&B 5 5
" # # # #DW# # #     5 )6 *8?) ) )I -6 5 5#(#7$-i$8$8(1+x$" $" !5 %*-: +1&++%& %& %& %0$6$6z$B$B$B04I  IIUI333 #))&11 $))&11S9L9LW9U9U5V5VVV			///"P6PPP!)nn% !!   ""27#3#3D#9#9:::"";////////uZ	0I  ^0@	 SR>RRRH|BB^BBBx77776&1111 766666 .**K	Z   
$*[D
;
;
;<<<	$KKK|+JFFu||~~FFFM1#NNOBB5<<>>BBBIqcJJJHHHHHOQCPPMJJ5<<>>JJJQqcRRN		A BH'
33'66(88$_55":.. BH B
 B
  $ ! E'N   &#S)) 	 QIeQ	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  ##%%&&&s{   (Ua> ;Z/Z	;ZZZZZa> [	$)[	a> [	F$a> >p!	Npp!-yyyc                    ddl m} t          j        |           } d}|j        s|j        rd}n|j        st          d           nd} |d          }d}t          j        rdt          j
        v rd	}d}nd
}d}|r|8d}|d                    |          z  }|d| |                    |           z   z  }|st          |           d S |6t          |           t          j        d                    |                     |g}|j        r|                    d|j        g           |                    d           |j        r|                    d           |j        r|                    d|j        g           |j        D ]}	|                    d|	g           | D ]n}
	 t          dt          j                            |
           d           t+          j        ||
gz              L# t*          j        $ r t          |            w xY wd S )Nr   r  FTz!# Automatic uploading is disabledanacondarr   MSYSTEMz \
    z ^
    z$ zA# If you want to upload package(s) to anaconda.org later, type:

zl
# To have conda build upload to anaconda.org automatically, use
# {}conda config --set anaconda_upload yes
zanaconda uploadzdError: cannot locate anaconda command (required for upload)
# Try:
# {}conda install anaconda-clientz--tokenuploadz--force--userz--label
Uploading z to anaconda.org)r  r   r   r  tokenuserr  rg   ry   r   r   rh   r	   r   r  r   rW   force_uploadlabelsr|   r  r   r  r   )r  rJ   r   r  r  no_upload_messagejoinerprompterr  labelr]  s              rO   r  r    s   ======e$$EF | v{ # 12222z**H< 9
22 	MX%T 	 	;;A6(;K;K	

 	7v77&++e:L:LLL       006x0@0@	
 	
 	
 	C | .

Iv|,---JJx 

9{ ,

Hfk*+++ ' '

Iu%&&&&  	Jrw//88JJJKKKOC7)O,,,,, 	 	 	#$$$		 s   AG'' Hc                 D   ddd|j         d|j        g}|j        r|                    d|j        g           |j        r|                    d|j        g           |j        r|                    dg           |j        r|                    d|j        g           |j        r|                    d	|j        g           |j        r|                    d|j        g           t          j	        |           } |j
        r| D ]}t          d
|            	 t          j        ||gz              .#  t          j        t                                        d           t          j        t                                        d|            Y xY wd S t          d|             d S )Ntwiner  z--sign-withz--repositoryr  z
--passwordz--signz
--identityz--config-filer  zFwheel upload failed - is twine installed?  Is this package registered?zWheel file left in z3anaconda_upload is not set.  Not uploading wheels: )	sign_with
repositoryr  r   passwordsignidentityconfig_filer   r  r  rg   r>  r   r   r   )r  rJ   r   r   s       rO   r  r  0  s   D { -Xv{+,,, 5\6?3444{  XJ 5\6?3444 ;_f&89::: 9^V%67888v&&F N 		K 		KA"q""###K$TQCZ0000K **//4    **//0Ia0I0IJJJJJ		K 		K 	LFLLMMMMMs   D**AF	c                    t          d           t          d           t          d| j        z   dz              t          j        | j                  }t          dt	          |           d           t          d           d S )Nr   r  z1Source and build intermediates have been left in rs   zThere are currently z accumulated.z?To remove them, you can run the ```conda build purge``` command)rg   crootr   get_build_foldersr   )rJ   build_folderss     rO    print_build_intermediate_warningr-  X  s|    	$KKK	(OOO	
=
Ls
RSSS+FL99M	
B]!3!3
B
B
BCCC	
KLLLLLrQ   c                 n    |st          j        | j                  }|D ]}t          j        |           d S r   )r   r+  r*  rC  )rJ   foldersr  s      rO   clean_buildr0  a  sH     8)&,77  F rQ   c                    | j         j        D ]R}t          j                            |          st          j        |           t          || j         j        dd           St          | j         | d          }|rt          | j         j
                  dgng }|t                      z  }| j         j        r|                    | j         j                   t          |                                 |                                 |                                           }ddlm} t)          |                    |||d	f
                    S )NFr(   )rj  r   r5  _subdirr_  )rU   rV   rq   r   )
SubdirDatarT  )rj  rI  )rJ   r  r   r|   r   r   r   rJ  rL  r9   rS  r4   rs  r   r,   rU   rV   r  	conda.apir3  r  	query_all)rN   r}  include_localrx  rT   rJ  r  r3  s           rO   r  r  h  s?    _) Y Yw}}Q 	KNNN8?+@uVWXXXXXX_ooo66FANVHX_233W==TVDKMMD# 2HO0111]]__h&6&6&8&8@Q@Q@S@S  D %$$$$$
$$TD68BT$UUVVVrQ   r   r  )NTFNFF)rr   r  )FNFN)T)__doc__encodings.idna	encodingsr  r  r   r  r+  rb  r   r  r   r   r  r  collectionsr   r   os.pathr   r   r   r   r	   conda_package_handling.apirF  r  r  bs4r
   r)  r   ri  conda_build.noarch_pythonr  r  os_utilsr   conda_buildr  r   r   r   r   conda_build.configr   conda_build.create_testr   conda_build.exceptionsr   r   conda_build.indexr   r   conda_build.metadatar   r   conda_build.postr   r   r   r   conda_build.renderr   r   r   r   r    r!   r"   r#   r$   conda_build.variantsr%   r&   r'   r  r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   r   conda_build.windowsr  r  ry   r]   rl   r   r   r   r   r   r(  r  r4  r:  r  rC  rQ  r   ru  r  r  r  r  r  r  r  r  r  r  r  r  r2  rF  rL  rX  rf  r~  r  r  rS  r  r  r  r4  r  r  r  r  r  r  r  r  r  rv  r}  r  r  r  r=  r  rq   r;  r  rY  rn  rs  rv  r  r  r  r  r  r  r  r  r  r-  r0  r  r   rQ   rO   <module>rJ     s	          				  				        



   * * * * * * * * 8 8 8 8 8 8 8 8 8 8 8 8 8 8 ! ! ! !         . . . . . . 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 : : : : : : 8 8 8 8 8 8 8 8 8 8 8 8 % % % % % % 9 9 9 9 9 9 T T T T T T T T F F F F F F F F 1 1 1 1 1 1 1 1           
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
                                              &                  <7))))))CLJJ
\ JJJ  .  6! ! !<  o o on  * * * +--B' B' B' B'J   +--5' 5' 5' 5'p0' 0' 0' 0'h    8 
P8 P8 P8 P8f	 	 	H0 H0 H0 H0V
 
 
 
4
 
 
(;+ ;+ ;+|     :: : :/ / /)& )& )&X
 
 
"> > >B- - -# # #LW% W% W%t] ] ]@T T T# # #*  @$3 $3 $3N< < <:' ' '	 	 		& 	& 	&? ? ?D  .    ! ! !$ $ $? ? ?D D D   >' ' 'T  :Y Y Yx_ _ _D	+E +E +E\
 
 
  d( d( d(N  &g
 g
 g
Z 
~ ~ ~ ~B  0  &     ,`  `  ` F$E $E $EN  : : :zU U Ur TVF, F, F, F,Z M M M M`7 7 7B    UYs' s' s' s'lB B BJ%N %N %NPM M M   W W W W W WrQ   