
    xhe>                       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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mZ ddlmZ ddlmZ ddlm Z m!Z!m"Z"m#Z#m$Z$ dd	l%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6 dd
l7m8Z8 ddl9m:Z: ddl;m<Z<m=Z= ddl>m?Z?m@Z@ ddlAmBZBmCZC ddlDmEZE ddlFmGZGmHZHmIZImJZJ ddlKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZSmTZT ddl$mUZUmVZVmWZWmXZXmYZYmZZZm[Z[m\Z\m]Z]m^Z^m_Z_ ddl`maZambZbmcZc e\rddlmdZd de
je        v rdZfne$j\        rdZfndZfd Zgd ZhdeCfdZid Zjd Zkd Zld  Zmd!d! e            fd"Znd# Zod! e            fd$Zpdjd%Zqd& Zrd' Zsd!i dd!fd(Ztd) Zudkd*Zvdjd+Zwd, Zxd- Zyd. Zzd/ Z{d0 Z|d1 Z}d2 Z~d3 Zd4 Zd5 Zd6 Zd7 Zd8 Zd9 Zd: Zd; Zd< ZdeCfd=Zd> Zd? ZdeCfd@ZdA ZdB ZdC ZdD ZdE ZdF ZdG ZdH ZdjdIZdJ ZdK ZdeCfdLZdMeCfdNZdMeCfdOZdP ZeeedQZdR ZdS ZdeCfdTZ	 	 	 	 	 	 dldeCfdVZdW ZdX ZdY ZdZ Zd[ Zd\ Zd] Zd^ Z	 dmd`Z	 	 dndaZdb Zdc Z	 doddZde Zdf Zdg ZdjdhZdpdiZdS )qzM
Module that does most of the heavy lifting for the ``conda build`` command.
    N)OrderedDictdeque)dirnameisdirisfileislinkjoin)UnicodeDammit)__version__   )environnoarch_pythonsourcetarcheckutils)
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)Config)create_all_test_files)CondaBuildExceptionDependencyNeedsBuildingError)_delegated_update_indexget_build_index)FIELDSMetaData)external)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)CONDA_PACKAGE_EXTENSION_V1CONDA_PACKAGE_EXTENSION_V2CONDA_PACKAGE_EXTENSIONSenv_varglobon_linuxon_macon_winshutil_move_more_retrying	tmp_chdirwrite_bat_activation_text)dict_of_lists_to_list_of_dictsget_package_variantsset_language_env_vars)windows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>h   sJ     	
 	
 	
%%% Gc(/1!4555%%%    rM   z-target_)	get_used_loop_varsr	   rP   rQ   getsubdirnameversionappend)rT   descused_loop_vars
build_varstpkeys   `     rU   	stats_keyrc   d   s    0022N	
 	
 	
 	
#	
 	
 	
 J 
	 	$	$%6	7	7B	 &bHO***/@
/R/Rj2o%
==??H,,..
/C 

:
((3--C
*CJrW   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_sysrK   cpu_userrssdiskelapsed)
descriptorre   rf   rg   memoryri   rj   )printformatrY   r   seconds2humanbytes2human)
stats_dictrk   s     rU   	log_statsrr   {   s    		 V! nn[!44~~i((E'
9(=>>>~~j))U(J)?@@@~~e$$5$Z%6777":f#566'
9(=>>  
 
    rW   mc                    t           j        rdnd}dD ]B}d|                                 v}|}|r0|                     d| |                                  d|           }||z  }d|                                  d| | }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           DdS )z0
    Create scripts to run after build step
    .bat.sh)zpre-linkz	post-linkz
pre-unlinkpackage:zbuild/rK   .win-Scriptsbini  lockingN)r   r@   get_recipe_text	get_valuer[   r	   pathr   rP   host_prefixhost_subdir
startswithr   osmakedirs	copy_intotimeoutr}   chmod)	rs   extra   	is_output
scriptnamedst_namesrcdst_dirdsts	            rU   create_post_scriptsr      sj    L
+&&eC3 ! ! a&7&7&9&99	
 	H]b]]qvvxx4F4F"4F4FGGJc
+qvvxx++"+c++16:&&#;; 		!$X1<<VDDO		% G >> ,GU+++w))COCah&6@PQQQQHS%   '! !rW   c                     |                      d          st          |           sdS t          st          |           rdS dS )Nz.pycz.pyoTF)endswithr   r?   r   r   s    rU   prefix_replacement_excludedr      sJ    }}%&& fTll t fTll  t5rW   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)rR   rS   rN   s      rU   	<genexpr>z$have_prefix_files.<locals>.<genexpr>   s,      991SVV999999rW   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rR   rg_match
prefix_lens     rU   rV   z%have_prefix_files.<locals>.<listcomp>   s?       =E  s++JKK8  rW   c                 $    g | ]}|d          S r    r   s     rU   rV   z%have_prefix_files.<locals>.<listcomp>   s"    KKKH(:;;/KKKrW   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   codecr   r@   r   minitemsr   r+   find_executable
subprocesscheck_outputextenddecode
splitlinesCalledProcessErrorrm   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_prefixrN   argsmatchesfr   filogmmmodedatarep_prefix_bytesr   s                           @rU   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        rU   chunksr   2  s      DE1c$ii    c$q'll"Q&D		Auq1u}%%%%%AXXuq1u}%%%%ED rW   c                 P    d| v r| d         S | d                              d          S )Nbytesr   r   )r   )parents    rU   get_bytes_or_text_as_bytesr   A  s/    &g&>  )))rW   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   )rR   r   pus     rU   rV   z"regex_files_rg.<locals>.<listcomp>`  sT       EFR3//66w??@@  rW       i  i c                 8    g | ]}|                     d           S )r   )r   )rR   as     rU   rV   z"regex_files_rg.<locals>.<listcomp>n  s$    888a))888rW   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   r@   r   r   rstripsplitjsonloadsr   	Exceptionr   r   r   r   r   mmap_or_readr   r   r]   rm   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   rN   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!                                   @rU   regex_files_rgr'  G  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     rU   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   r]   r  )r   r   r  r  r  r  r  r*  re_refiler   r   r   r   g_indexr#  r$  r%  s                     rU   regex_files_pyr3    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.< 	 	 	3"*	 *	 *	 *	 *	 *	 *	 *	 *	 *	 *	 *	 *	 *	 *	Z &&&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.  r/  r   rO   r   rm   r  )r  r  r  r*  r0  filenamer   r"  match_rer.  match_tigherindexs               rU   regex_matches_tighten_rer9    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 &&&rW   c                     t          t          |                                                     }|                                D ] \  }}t          |d         d           |d<   !|S )Nr  c                     | d         S )Nr   r   )xs    rU   <lambda>zsort_matches.<locals>.<lambda>H  s
    '
 rW   )rb   )r   sortedr   )r  match_records_or1  r   s       rU   r  r  E  sm    !&)<)<)>)>"?"?@@O&,,.. T Te$U<%8>R>RSSSlrW   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{} :: ({}..{}) = {})rm   r   r   r	   r   rn   )r   r  r1  r   r   r   r"  file_contents           rU   check_matchesrB  L  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'  r9  r3  rB  zipr   rm   )r   r   r  r  r  r  r  r  debugrD  match_records_rgmatch_records_rer   rS   vk2v2r"  	submatch2s                      rU   have_regex_filesrP  b  s   4 u:: KKK 	m$$m$$ ' 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7rW   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         rU   r   r     s     
B<<
J//D	dD		 R
              HT4<
++dl:;;;Ks   AA!$A!c                    |                                  D ]?\  }}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    r}t          |          t          |          k     rt          d| d| 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        ||           Ad S )Nz.cbpatch.tmp zPatching '{}' in {} {}r  r   placesplacezwb+r   r   r   r   r  r   r  r   r   zERROR :: Cannot replace z with z 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   rm   rn   r   r   truncater   rS  rF  r   rG  r   r*  subljustr   r   PIPEr   outputr   move)r   r   verbosediffr1  r   r5  filename_tmpfilename_shortfile_tmp
last_indexr"  lengthr   originalr  
new_stringactual_originaldiffor  s                       rU   perform_replacementsru    s   }} E0 E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??::! q8 q q: q qgo q q   &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,,,C!-#- #- #- #- #- #- #- #- #- #- #- #- #- #- #-%	- %	- %	- %	- %	- %	- %	- %	- %	- %	- %	- %	- %	- %	- %	-N 7>>,'' 	0 -f//VnVV%&3vx>z  E ]]]]    "4 % % %HEEEEEE%ell7++,,,w~~h'' $	(###Kh///KE0 E0sO   %M1G<L:.M:L>>ML>MM	M	7OO'O""O'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 )r\  N)r   r   r   )rR   r   r   s     rU   r   z)_copy_top_level_recipe.<locals>.<genexpr>  s7      DD		$-44DDDDDDrW   c                 *    g | ]}|d k    |dk    |S )	meta.yamlconda_build_config.yamlr   rR   r   s     rU   rV   z*_copy_top_level_recipe.<locals>.<listcomp>  s8     
 
 
$$-F(F(F (F(F(FrW   Tr   r}   clobber)r   rec_globr>  r	   filter_filesr   r   r}   )r   rP   dest_dirdestination_subdirr   
file_pathsr   s   `      rU   _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	
 	
 	
 	
 	

 
rW   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   )rR   r  s     rU   rV   z'_copy_output_recipe.<locals>.<listcomp>,  s    888V8&888rW   Tr}  )r  r   rP   get_rendered_outputr[   rY   r   r  r   r	   r   r}   )rs   r  this_outputinstall_scriptbuild_inputsinputsr  r   s           rU   _copy_output_reciper  %  s    1618Xx@@@''117RK __X..NL,F88v888J#J77J 
 
OO1H$H$	
 	
 	
 	
 	

 
rW   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reciper\  build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{  ) rP   include_reciper	   info_dirr   r   r   r  r  r   	meta_pathrD  metarY   build_idr   sort_list_in_nested_structurer5   r   r
   r   unicode_markuprS  conda_build_versionr   get_repository_infor   r   r}   yamldumprQ   )rs   
recipe_diroriginal_recipeoutput_metadatar  renderedr   original_recipe_texts           rU   copy_reciper  9  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: %sr|   r   >   	README.md
README.rstREADMEzNWARNING: anaconda.org only recognizes about/readme as README.md and README.rstr1  )r   r	   rP   work_dirr   sysexitr  r   r   r   r}   r   r   r  rm   r_  )rs   readmer   r   s       rU   copy_readmer  w  s    [[((F 18$f--c{{ 	;H069:::18$f--S!("2AH<LMMMM7==  #+PPP.Z       QPrW   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basenamerP   r  r   r   r  	full_loadr  r  r]   )rs   iydijdr   resrootdirsr   r1  bnr   r   r   or  s                  rU   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rs   s    rU   copy_prelink_messager    s    %'899999rW   c                 (    t          | dd           d S )Nlicenselicense_filer  r  s    rU   copy_licenser    s    I~.....rW   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   r\  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.rx   z{}{}{}z.txtr   sr|   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	   rP   r  r   r   r   r   r   
ValueError
capitalizer   r   rn   upperr   r  r   r}   rm   )rs   r[   field	all_filescountsingle_filesrc_filer5  s           rU   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
$
$
$%%%%%rW   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.jsonr|   )r   r   r   r	   r   rP   r  r   r   r  r   r}   )rs   log_filer  s      rU   copy_recipe_logr    s     {{233H7HHw||AFH--H7>>(## 5)844	w~~h 
"$566HH$		
 	
 	
 	
 	
 	

 
rW   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 ]}|r|t           j                            |          r\||k    rUt          j        |                     dg                     D ]+}t          j        rd|v rt          d          t          t          ||                    }|s$d	}t          |                    |                    |D ]}	 t          j        ||                    ||          | j        j        d
d           ;# t(          $ rK}t          j        t,                    }	|	                    d| 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 )Nr\  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)r}   r~  zFailed to copy z into test files.  Error was: r   z
test/filesr}  )r   listdirrP   r  hasattrr  r   r	   r   r]   r   r  r   r@   RuntimeErrorr=   rn   r   r   r   r   r   r   r   rO   get_ext_filesremover   r}   )rs   destinationsrc_dirsrc_dirspatternr   msgr   r  r   r   recipe_test_filesorig_recipe_dirbasedirdests                  rU   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WaWWsSTvvWW       
 * % %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&&
H;	0AH6	6H;	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	   rP   r  r  r  )rs   recipe_inputr   s      rU   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]' ()rF  r#   rQ   dictr	  )rQ   repls     rU   get_all_replacementsr  .  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 KrW   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	   rR   r   r   s     rU   r   z(get_files_with_prefix.<locals>.<genexpr>Y  sG      VVbgnnRW\\&RS=T=T.U.UV1VVVVVVrW   __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   r[   r   r  s     rU   rV   z)get_files_with_prefix.<locals>.<listcomp>d  s     	 	 	  BGLL++U3388::??HHBNN O  #	
	 	 	rW   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	   )rR   r   ignore_filesignore_typesr   s     rU   r   z(get_files_with_prefix.<locals>.<genexpr>n  st        aDL  QqT%=%=&rw||FAaD'A'ABB &> 	
!%=%=%=%= rW   c                 (    g | ]}|d          v|S r  r   )rR   r   r  s     rU   rV   z)get_files_with_prefix.<locals>.<listcomp>t  s'    RRRq1\9Q9Q9Q9Q9QrW   r   r   winr   'c                 :    g | ]}|                     d d          S )r   r   r   )rR   pfxs     rU   rV   z)get_files_with_prefix.<locals>.<listcomp>  s&    OOO3S[[v66OOOrW      (   |c              3   h   K   | ]-}|                     d                               dd          V  .dS )r      \s   \\N)r   r   )rR   rL  s     rU   r   z(get_files_with_prefix.<locals>.<genexpr>  s>      TT!AHHW%%--eW==TTTTTTrW      )c                     g | ]
}|d          S r  r   r|  s     rU   rV   z)get_files_with_prefix.<locals>.<listcomp>  s    )))!1)))rW   r   )r   r  r  r  r  r  rI  c                     h | ]
}|d          S )r   r   )rR   sms     rU   	<setcomp>z(get_files_with_prefix.<locals>.<setcomp>  s    &P&P&Pbr&z&P&P&PrW   r  r   r\  c                 X    g | ]%t          fd d         D                       #&S )c              3   B   K   | ]}t          j         |          V  d S r   fnmatch)rR   r  r1  s     rU   r   z3get_files_with_prefix.<locals>.<listcomp>.<genexpr>  sC        #  g66     rW   glob_patternsany)rR   r1  replacements    @rU   rV   z)get_files_with_prefix.<locals>.<listcomp>  se           '2?'C      rW   r  r  r  r  )r   r   r  r  r  r  r  rI  "z", c                 :    t          |          d                   S )Nr  r   )r   all_matchess    rU   r=  z'get_files_with_prefix.<locals>.<lambda>  s    c+a.677 rW   z\INFO :: Time taken to mark (prefix){}
        {} replacements in {} files was {:.2f} secondsz and mark+peform ())"timer>  ignore_prefix_filessetr  updater   r   r[   r   r   r   r@   r   r   rP   rZ   r   r  lowerr   r	   rP  rI  r   r]   r   r   	enumerateru  summaprm   rn   )rs   r  files_inr   r  r   r   files_with_prefixprefix_upfx_variantsre_testpfx_matchesprefixes_for_filer5  r   files_with_prefix_newrN   r   npr	  replacement_tagslastr8  r   total_replacementsr  r  r  r  s      `                     @@@@rU   get_files_with_prefixr3  T  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 #$$$rW   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 ]*\  }
}}d }||v s
|r|rF|dk    r@||v r"|dk    rd}n||v r|rt          d	| d
           ||v r|                    |           np||v s+|s|dk    s#t          j                            |          dk    r<|dk    rd}n||v r|st          d	| d           ||v r|                    |           nd|z  }t          d                    |||rdnd|r|nd                     |3|	                    ||
||fz             |                    |
||f           ,	 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   zFile zr force-identified as 'binary', But it is 'binary' anyway, suggest removing it from `build/binary_has_prefix_files`r   python-scriptszg 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Patchingr\  )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   r@   rm   r   r   r	   rP   r  r  r   r   r   rn   rS  r]   r  )rs   r(  filteredr<  text_has_prefix_fileslen_binary_has_prefix_fileslen_text_has_prefix_filesfmt_strdetect_binary_files_with_prefixrZ  pfixr   r9  ignored_becauseerrstrr   s                   rU   record_prefix_filesrG    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 !B !B !B  
 444/66r:::///5 0:>&..wr**.>>>v~~%444=V47B 7 7 7  
 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   D/HHHc                 X    t          |                               ddg          d         S )NFr\  )with_credentialssubdirsr   )r   urls)channels    rU   sanitize_channelrM  N  s+    W%%**EB4*PPQRSSrW   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   r{   r6  rz   )r   get_entry_point_script_namesr   r	   rP   r  noarchr>  r   rS  r   r   )rs   r   entry_point_scriptsentry_point_script_names	mode_dictrZ  r   s          rU   write_info_files_filerY  R  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   rR  rO  entry_pointsrU  zbuild/preferred_envr[   z$build/preferred_env_executable_pathsexecutable_pathspreferred_envr   package_metadata_versionz	link.jsonr  Tr  r  r  )r   r   rO   r#  r   r   r   r	   rP   r  rS  r  dumps)
rs   package_metadatanoarch_typenoarch_type_strnoarch_dictr\  r_  preferred_env_dictr^  r  s
             rU   write_link_jsonrg  g  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)rR   evs     rU   
<dictcomp>z$write_about_json.<locals>.<dictcomp>  s&    HHHBRYr;77HHHrW   env_varsr  z6Adding the following extra-meta data to about.json: %s	root_pkgsr  Tr  r  )r   r	   rP   r  r)   r   r   r	  r   r  rj  r  r   channel_urlsr]   rM  get_section
extra_metar   r   r  r"  r   Environmentr!   package_specsr  r  )rs   rZ  drb   defaultvaluestripped_channelsrL  evarsr  r   envs               rU   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           
      v   |                                  }| j        rA| j        dk    r|                     dg           }||d<   nt          j        | d          }t          t          | j        j        d          d          5 }|	                    d| 
                                 d| j        j         d	           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runrequiresr  z.# This file as created when building:
#
#     z.tar.bz2  (on 'z')
#
# It can be used to create the runtime environment of this package using:
# $ conda create --name <env> --file <this file> rK   r  z%s
=r   rP  
index.jsonTrs  )
info_indexpin_dependsr   r   get_pinned_depsr   r	   rP   r  rS  distbuild_subdirr>  rsplitr  r  r  )rs   r  runtime_depsrZ  r  rX  s         rU   write_info_jsonr    s;   J} :=H$$;;'92>>L$0Jy!!"21e<<L$qx(*55s;; 
	:rHHCC C23(2GC C C   |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EEEF..F25F2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  )rR   pr   s     rU   r   z write_no_link.<locals>.<genexpr>  s/      >>wq!,,>>>>>>rW   r   )	r   rF  r	  r   r	   rP   r  r  rS  )rs   r   r  rZ  r   s       @rU   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   r@   r]   )rV  scriptsentry_pointcmds       rU   rT  rT    s    G* + +1K,,S111288::< 	+NN2S8999NN,s23333NN8c>****NrW   c                    |                      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 )Nzbuild/run_exportszrun_exports.jsonr  keysweak)r   r   r   r   r	   rP   r  r  r   RUN_EXPORTS_TYPESr  r  r  )rs   run_exportsr   rS   s       rU   write_run_exportsr    s   ++1266K &"',,qx02DEEsKK 	&q;// 4%{3, G G##%*%6{1~%F%FKNIk1%%%	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	&& &s   AB88B<?B<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          | |           t3          t#          | j        j        d          dd          5 }|                     d          D ]}|                    d	          rit9          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   )rR   _fs     rU   rV   z%create_info_files.<locals>.<listcomp>  s&    7772D#&&777rW   r  )test_dirgitr  r   )rQ  r   git_urlfolderr\  N)r  rj  rZ  zapp/iconzicon.pngr|   )'r   r@   rP   filename_hashingr  r  r  rg  r  r  r  r  r  r  r   r  r$   r	   r  r  rY  r3  rG  create_info_files_json_v1r  r   ru  rY   r   git_infor   r   r  build_prefixrj  r   r   r   r}   )rs   r  r   r   r(  	checksumsrZ  source_dicts           rU   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	d18$e,,cG	D	D	D 	==22 	 	Ky)) GLL!2KOOHb4Q4QRRH)H,   		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	{{: 
Z0011"J//HH$		
 	
 	
 	
 s   BI''I+.I+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 )	NrR  rO  rS  r   r{   r6  rz   build/noarch_python)rU  rT  r   r   r   r   )rs   target_filerW  s      rU   get_short_pathr  )  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rW   c                 0    |D ]\  }}}| |k    r||fc S dS )N)NNr   )
short_pathr(  r   r   r5  s        rU   r5  r5  @  s=    "3    h!!4< ":rW   c                 j    t          j        |           } t          fd| D                       rdS d S )Nc              3   B   K   | ]}t          j         |          V  d S r   r  )rR   r  r  s     rU   r   zis_no_link.<locals>.<genexpr>I  s/      
;
;a7?:q))
;
;
;
;
;
;rW   T)r   r  r  )r  r  s    `rU   
is_no_linkr  G  sG    ((G

;
;
;
;7
;
;
;;; t rW   c                 4    t          j        |           j        S r   )r   lstatst_inor  s    rU   	get_inoder  M  s    8D>>  rW   c                     t          j        |            t          t          |                    fd| D             }t	          |          S )Nc                 j    g | ]/}t          j        t          |                    j        k    -|0S r   r   r  r	   r  )rR   spr   target_short_path_inodes     rU   rV   z#get_inode_paths.<locals>.<listcomp>T  sF       8D$$%%,0GGG 	GGGrW   )r   r  r  r	   r>  )r   target_short_pathr   hardlinked_filesr  s     ` @rU   get_inode_pathsr  Q  sm    	e'V5F(G(GHH      
 "###rW   c                      fd| D             S )Nc                 ^    g | ])}t          j        t          |                    j        *S r   r  )rR   r  r   s     rU   rV   zget_inodes.<locals>.<listcomp>]  s0    >>>"BHT&"%%&&->>>rW   r   )r   r   s    `rU   
get_inodesr  \  s    >>>>>>>>rW   c                 P    t          |           rt          j        nt          j        S r   )r   r   softlinkhardlinkr   s    rU   	path_typer  `  s     &tC8(2CCrW   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      rU   r  r  d  s    |uu4wRW__T-B-BBKPTDUDU V VWW ;; 		vd|| 		1D\\ 	&,, 	74==((D\\ 	+Dt<<<< 	M?$FTTT11rW   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  r   	file_moder   c                 2    g | ]\  }}|k    |         S r   r   )rR   r8  inor   r  s      rU   rV   z,build_info_files_json_v1.<locals>.<listcomp>  s7       E3111 e111rW   inode_paths)r   r  r>  r5  r   r   r	   r  r   r   sha256_checksumr  r   r  r   r   r  r  r   r  rY   st_nlinkr  r$  r]   )rs   r   r   r(  no_link_files
files_jsonfiles_inodesr   r   r  r   r  	file_infor  r  r  s     `            @rU   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$)$$$$rW   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  r   r   r	   r  r  r   r  )
rs   r  r   r   r(  files_json_filesfiles_json_infor  r  r1  s
             rU   r  r    s    065BSTT! O ? 	$x..44 	
I&!   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 I  2 2#'>	$w-  s    A))A-0A-c                                                       } j        j        g }|D ]T}t          j                            t          j                            |                    s|                    |           Ut          |          r5t          j
        t                    }|                    d| d| d           t                      t                       j        dk    r.t          j                             d           j                   t          j                  }t          j                             j        j                  r j        j        n j        j        }t-          |                                 t1          ||z
             j        t3                               d                                         d	                               d
                     t          j                  }t1          ||z
            }	 t          j        |          } j        j        t9          fd|D                       r5t;           fd|D                       f}	t=          j        d|	 d           tA           ||           tC                               d                     j        dk    rfd|D             }
n|}
                     d          rtE          j#         |           n" j        dk    rtE          j$         |
           t          j                  }||z
  }tK          |           |S )Nz The install/build script(s) for zB deleted the following files (from dependencies) from the prefix:
z|
This will cause the post-link checks to mis-report. Please try not to delete and files (DSOs in particular) from the prefixrR  rO  rP   r   zbuild/preserve_egg_dirr[  zbuild/skip_compile_pyc)r   rP   preserve_egg_dirrU  skip_compile_pycc              3   <   K   | ]}t          |          v V  d S r   )r	   )rR   r   r   meta_dirs     rU   r   z%post_process_files.<locals>.<genexpr>  s2      
?
?8tK+++
?
?
?
?
?
?rW   c              3   T   K   | ]"}j         j        t          |          v |V  #d S r   )rP   r  r	   )rR   r   r   rs   s     rU   r   z%post_process_files.<locals>.<genexpr>  s=      TT!(*;tKQR?S?S*S*S!*S*S*S*STTrW   zError: Untracked file(s) z 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   )rR   r   rW  s     rU   rV   z&post_process_files.<locals>.<listcomp>  s$    RRRBr9Q/Q/QR/Q/Q/QrW   r  )&r[   rP   r   r   r   r`  r	   r]   r   r   r   r   warningr-   r   rU  create_entry_pointsr   r  r   r  host_pythonr/   r\   r>  boolr  r  r  tupler  r  r.   rT  r   	transformpopulate_filesr,   )rs   initial_prefix_filespackage_namemissingr   r   current_prefix_filesrR  	new_files
meta_files	pkg_filesrW  r   r  s   `          @@@rU   post_process_filesr     s   6688L(&KG!  w~~bgll;::;; 	NN1
7|| 
x((|  ;B  	
 	
 	
 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

 	/
 / / /	
 	
 	

 q)&1111;	())    	x8RRRR)RRR			 	{{()) 
9k::::	
X		$y+'?	
 	
 	
 !-[AAA$';;II{+++rW   rT   c           
        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          rNt1          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<   |j        |d<   d|d<   d|d<   t          j        |                    d                    D ]}d|v r9|#                    dd          d         }|#                    dd          d         }n@|t          j        vr tQ          j)        d |z  tT                     d!}nt          j        |         }|||<   t          j                            |j        j        | d                   }t          j+        t          j                            |j        | d                   |           dd"lm,}  ||          }t          j-        ||j.        d#z             |rt_          ||           i }t          j0        ||gz   |j        j        ||$           tc          |d%|'                                            |(||te          |d&|'                                           <   |rgd' t          j3        ||j        j
                  D             7ti          t          j$        |j        j
                            }7fd(|7z
  D             }nM|                     d          s7|5                                s|)                    d)                    |                     d*                               |                    d+          }|                    d,          }d- |D             }d. |D             }d/d0d1}|6                                D ]a\  6}to          6fd2||fD                       rtq          d36 d46 d5| d6          6|v r"|j9        rd7} tq          d36 d86 d9|  d:          bti          t          j$        |j        j
                            }|5                                D ]j}!d;}"ti          |          D ]>}tu          j:        ||!          r'tA          d<|           |;                    |           d=}"?|"s|)                    d>|!           kty          ||          }|                     d*          r+|                     d*          d?k    rd@|vrdA|vs
J dB            t          j=        ||j        j
        C          }t          j>        t          j                            |j        j?        dD                     t          |j        j
                  5  t          ||	||j        j
        C          | dE<   d d d            n# 1 swxY w Y   ti          t          j$        |j        j
                            }#t          j=        |#|z
  |j        j
        C          }dF                    | d*         |&                                |B                                g          }$g }%g }&i }'t          }(|                     dG          dHk    s|j        jD        dIk    rt          }(dJdKdL|j        jF         f|'dM<   t                      5 })t          jI        jJ        |j        j
        ||$|(z   fdN|)i|' t          j                            |)|$|(z             g}%|%D ]q}*|*K                    t                    rt          jM        |*|j                   t          j        N                    |*          }+	 ddOlOmP}, n'# t          $ r d },|)                    dP           Y nw xY wt          |j        dQd;          r|,r |,            }-t          j        |j        jS                  |S                                z   }.	 |-T                    |*|.|j        jU        R           n/# t          $ r"}/|)                    dS|/            Y d }/~/nd }/~/ww xY w	 |j        jW        }0n# t          $ r |j        jY        }0Y nw xY w|jZ        s|j[        rdTn|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`        d;U           |&a                    |3           s	 d d d            n# 1 swxY w Y   t          t          j        ]                    |2          |j        jc        dV           |j        jd        r|j        j
        }4t          j                            t          j        ]                    |4          dW                    dX|                                |j        jY        f                    }5t          |4|5dY           nt          j>        |j        j
                   |&S )ZNzPackaging %sr   r  rw   r  r  r   batshzoutput_script.r  r  script_interpreterr   z4Did not find an interpreter to run {}, looked for {}system32rI   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_VERSION
RECIPE_DIRinheritMSYS2_PATH_TYPE1CHERE_INVOKINGzbuild/script_envr  zCThe environment variable '%s' specified in script_env is undefined.r\  )r      cwdr~  statsz	bundling bundle_c                 L    h | ]!}t           j                            |          "S r   )r   r   r  )rR   pths     rU   r  zbundle_conda.<locals>.<setcomp>  s8     
 
 
 GS!!
 
 
rW   c                 L    h | ]t          fd D                        S )c              3   f   K   | ]+}|                     t          j        j        z             V  ,d S r   )r   r   r   r   )rR   	keep_fileitems     rU   r   z)bundle_conda.<locals>.<setcomp>.<genexpr>  sK        =F	$$TBGK%788     rW   r  )rR   r  
keep_filess    @rU   r  zbundle_conda.<locals>.<setcomp>  s`     
 
 
    JT    

 
 
rW   z&No files or script found for output {}r[   zrequirements/buildzrequirements/hostc                 B    g | ]}|                                 d          S r   r  rR   pkgs     rU   rV   z bundle_conda.<locals>.<listcomp>  s$    ???S#))++a.???rW   c                 B    g | ]}|                                 d          S r  r  r  s     rU   rV   z bundle_conda.<locals>.<listcomp>  s$    ===CQ===rW   PYTHONR)rR  r-basec              3       K   | ]}|v V  	d S r   r   )rR   	pkgs_listdeps     rU   r   zbundle_conda.<locals>.<genexpr>  s(      QQIsi'QQQQQQrW   zEmpty package; zQ present in build and host deps.  You probably picked up the build environment's z9  executable.  You need to alter your recipe to  use the z/ env var in your recipe to run that executable.zOhttps://conda.io/docs/user-guide/tasks/build-packages/define-metadata.html#hostzH dep present in build but not host requirements.  You need to move your z, dep to the host requirements section.  See z 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  rK   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 rU  r|   rj  threadsrN   _h_env_movedzhost env)fr   r   r   r  r  r  rP   rY   r   r   r   r   r  r   r~   $get_top_level_recipe_without_outputsactivate_build_scriptactivater	   r@   r   r   r  rS  r   get_dictguess_interpreterr+   r   r  errorrn   rm   r  r  r  r  rD  r\   r[   r  r   r  r   r   r   rU  _write_activation_textcheck_call_envrr   rc   expand_globsr!  always_include_filesr   allr%   "uses_new_style_compiler_activationr  r  r   r  rm_rfr  rB   r  r  r9   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   rU  r   output_folderr   bldpkgs_dirr   r   r]   r'   rI  keep_old_workrA   )8rh  rT   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   rY  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-  verifierr0  r  crossed_subdirrZ   rQ  final_outputr   r  r&  r  s8                                                         @@rU   bundle_condart  $  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( E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
=!!)
:#+=
< (1
$%'*
#$$X%7%78J%K%KLL 	" 	"CczziiQ''*iiQ''*BJ&&Y  
 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 -/# / /JM/ / %1/ / /   J&&8+V&4  . #    EH   BF        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+

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

 	
 	
 	
 S(S.99: % 7	/ 7	/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[WX[ [       
=!)!>! = = =!)!<= O$'/'=$# 
 ,  "X_-JF S S "GOOHO$?@@&! ! 7<<GGLw~~l++ *L))) O,(?      ....o7	/B/ B/ B/ B/ B/ B/ B/ B/ B/ B/ B/ B/ B/ B/ B/F 
&&0Eq    $ 1,w||GOOF##HHnhmmoox7RSTT
 
 	"&$
;;;;HO/000s   /B 
BBA HH#&H#!b::b>b>5B%ri"!r"!jrjAr"lr
l.l)$r)l..r2l?>r?mrmD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	<   t%          |          }i }	t          j        ||gz   |j        j        ||	           t)          |	d|                                            |(|	|t+          |d|                                           <   t-          t          j                            |d                    }
|
st/          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 )Nru   rv   wheel_outputr  r   zpip wheel --wheel-dir z --no-deps .r  r  r  r  r	  r  zbundling wheel bundle_wheel_z*.whlz9Wheel creation failed.  Please see output above to debug.r   r|   )r   r@   r   rB   rP   r  r   r   r	   r   rS  r7  r;  r   r8  rD  r\   r[   r9  r<  rr   rc   r=   r  rQ  rZ   rR  r   r}   r  )rh  rT   r~  r  r   tmpdirr_  r   rZ  r`  wheel_files
wheel_filerQ  s                rU   bundle_wheelr{  G  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;;J?J?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*.jsonr[   N)r  r=   r   r   r	   r   r  load)r   	installedr5  r1  r   s        rU   scan_metadatar  u  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          }
|
rt-          |
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)           |                     d&           |                     d*           |                     d+| d,           |dk    rM|                     d-|
 d.           |                     d/|
 d0           |                     d1|
 d2           o|dk    rwt7          d3           t          |j
        j        d
d          }t          |          sat          t          |                    s!t          j        t          |                     t!          |d                                           d S d S )4Nz$(cygpath -u r\  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   ccacheFr   rq  symlinksnativeccache_methodTzccache-ln-binzmkdir r   zpushd zif [ -n "$CC" ]; then
z  [ -f z( ] && [ ! -f $(basename $CC) ] && ln -s z $(basename $CC) || true
fi
zif [ -n "$CXX" ]; then
z) ] && [ ! -f $(basename $CXX) ] && ln -s z $(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   r@   r   r   rY   rS  r  
executableis_crossr	   rP   r   r   r   r   r   r   r   r   r  os_utils.externalr   rF  r	  r  r  r   rm   )file_handlers   cygpath_prefixcygpath_suffixpy_flagshistory_filehost_prefix_pathbuild_prefix_pathstackr   r  ccache_methodsdone_necessary_envmethodr{  dirname_ccache_ln_bins                   rU   _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222222_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%%&?@@@%%t&ttRXttt    %%f---%%&@AAA%%v&vvSYvvv    %%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%%'''''( (rW   c                 h   t          | d          5 }|                                }|                    d           t          j                            |           d                                         dk    rt          ||           n~t          j                            |           d                                         dk    rt          ||           n2t          j
        t                    }|                    d|  d           |                    |           d d d            d S # 1 swxY w Y   d S )Nzr+r   r   ru   rv   znot adding activation to z/ - I don't know how to do so for this file type)r   r   seekr   r   r  r#  rC   r  r   r   r   r   rS  )script_pathrs   r  r   r   s        rU   r;  r;    sZ   	k4	 	  Bwwyy



7K((+1133v==%b!,,,,Wk**1-3355>>%b!,,,,"8,,CHH!K ! ! !   	                 s   D	D''D+.D+c                 R	  
 |                      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        |                     d          | j        j        d	           g t1          j        |                     d
g                     t1          j        |                     dg                     }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!
 tE          | d          r| j#        $                                n| %                    d          }
fd|j&        D             d |D             z
  }	|	r	|	|_&        |Y d }~nd }~ww xY w| j        j'        rGtP          j)        *                    | j        j                  rtQ          j+        | j        j                  sQt          j        | j        j        |d| j        | j        j        | j        |                                 dk               d S d S )Nr  c                 6    g | ]}t          j        |          S r   r   ensure_valid_specrR   specs     rU   rV   z%create_build_envs.<locals>.<listcomp>	  s#    MMMtU,T22MMMrW   hostc                 6    g | ]}t          j        |          S r   r  r  s     rU   rV   z%create_build_envs.<locals>.<listcomp>	  s#    KKKdE+D11KKKrW   
rZ   rI  rj  r}   bldpkgs_dirsr   disable_pipmax_env_retryrQ  rt  r'  r~  rP   rZ   r  is_condarequirementsr  ztest/requiresr  r  r   )r   other_outputsTpermit_undefined_jinjac                 0    h | ]} |          j         S r   r]  )rR   r  r   s     rU   r  z$create_build_envs.<locals>.<setcomp>T	  s$    BBB		#+BBBrW   c                 <    h | ]\  }}|                                 S r   r]  )rR   rN   outs      rU   r  z$create_build_envs.<locals>.<setcomp>T	  s7     F
 F
 F
!1cCHHJJF
 F
 F
rW   ),
ms_dependsbuild_is_hostrP   _merge_build_hostr  r   get_package_recordsr   r  r   rI  rj  r}   r  r   r  r  rQ  rt  
create_envr[   r   r  r  r   insert_variant_versionsru  rQ   r  r   test_prefixr&   conda_interfacer   r  r  valuesget_output_metadata_setpackagesdirtyr   r   r   r  )rs   notestbuild_ms_depshost_ms_deps
host_precsbuild_precstest_run_ms_depsr  r  missing_depsr   s             @rU   create_build_envsr    s   LL))MMM}MMMM<<''LKKlKKKL!"AHz 
!/ 
0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  K ' 	)n--qx/?   "1;;#C#CDD "1;;/A2#F#FG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   =D>M< <
P A0O;;P Tc                 h+  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 	rHt          | 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}|sBt          d| j        p|                                 d|                                  d           |S |sg }|D ]Bt          j                            B          d
         rSt9          Bfdt:          D                       r3|                    t          j                            B                     z|                    B           t          d|           t          j        | j        j         gfd|D             | j                   d | !                    d          D             }t9          d | "                    d          D                       r|#                    ddg           | j$        }|r||vr|dk    rdn|}t          j        %                    tM          j'        || j        j                  pd          }|sZ|dk    st9          d |D                       s,|                    |           |	(                    d|           ntS          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          j=        | j        jB        d*           t          te          | j        jB        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                    d0          t          | d1                    5 }"|"D                    |           ddd           n# 1 swxY w Y   t          jM        | | ||2           nVte          | j        d3          } tK          |           r|rt          d4          tK          |           s|rt          | ||           \  }#}|st          g| j        jQ        rd5gng z   d6d7|#gz   }$| j        jQ        s| j        jR        rd}%nd8d9g}&| jS        s|&T                    d
d:           Afd;|&D             }%|%U                                D ]@\  }'}(t          d<V                    | W                    d=          rd>nd?|'|(                     AAd@= t          jX        |$A|%||A           t          jY        | j        jA                   |r<|s:t          |dB|                                             |||t          | d          <   te          | j        jB        d+          })t[                      }*t          j        %                    |)          rZt          |)          5 }t[          |\                                ]                                          }*ddd           n# 1 swxY w Y   t          j@        | j        jA        )          |*z
  }+|},|
s|dCv 
r|p| ^                    dD          }-t          |-d	         d
         j                   | }.te          | j        jB        d+          })t          j        %                    |)          r[t          |)          5 }t[          |\                                ]                                          }*ddd           n# 1 swxY w Y   nt[                      }*| j        j_        dEk    r| j        j_        n| j        j`        }/t                      5 }0|+D ]_}t          jb        t          j        2                    | j        jA        |          t          j        2                    |0|          dF           `|-D ]\  }1} t          | j        j                   t          | j        j                   |                                  r"t          t          j        |                      n| j        j        rFt+          | d          r6t          t          j        |                      |1| f|,t/          |           <   |.                                |1,                    dG          k    rO|1,                    dH          s:|1,                    dI          s%t          j@        | j        jA        )          |*z
  |1dH<   dI|1v rHt          jb        t          j        2                    | j        |1dI                   | j        j:                   |1,                    dJi           ,                    dI          }2|2rt          j        %                    t          j        2                    | j        |2                    stS          dK|2 dL          t          jb        t          j        2                    | j        |2          t          j        2                    | j        j:        |2                     |1,                    dM          dNk    s'| j6        s J dO| c                                 dP            t/          |           }3|3vrD|3|,vr?|	d                    dQ|                                             | je        sot          j        ;                    | j        jA                  r/t'          t          jf        | j        jA                            d
k    s|	Q                    dR           n| jS        | j        _g        t          j>        | j        jA                   t          j>        | j        j                   t          j>        | j        jh                   | !                    d          }4| !                    d          }5| ji        r| jS        st          jj        | j        jA        t          |4          d| j        j_        | j        jQ        | j        j<        | j        jl        t          | j        jm                  | j        jn        | j        jo        | j        jp        | j        jq        t          | j        jr                  S          }
t          js        | j        jA        |
d| j        |/| ji        |                                 dNk    T           n|5#                    |4           t          jj        | j        j        t          |5          d| j        jt        | j        jQ        | j        j<        | j        jl        t          | j        jm                  | j        jn        | j        jo        | j        jp        | j        jq        t          | j        jr                  S          }t          js        | j        j        |d| j        | j        jt        | ji        |                                 dNk    T           t[                      }6|1,                    dHg           D ],}|u                    dU          r|6v                    |           -dH|1v rt[          |1dH                   |6z
  |1dH<   |+D ]_}t          jb        t          j        2                    |0|          t          j        2                    | j        jA        |          dF           `t          j        | j        j                  5  t          j
        |           Addd           n# 1 swxY w Y   t          | dM          sdNn| jx        }7t          |7         |1| A|          }8dV|1v r|1dV         U                                D ]\  }9}:|,U                                D ]q\  }};|;\  }<}|9|<,                    dVi           v rO|<dV         |9         }=|:|=k    rdWndX}>|	z                    dYV                    |>|9|1dG         |<dG                              r|8D ]	}?|1| f|,|?<   
| j{        s| j|        rdEn| j        j_        }@| ji        r_t          |@| j        j         | j        jq        | j        jr        | j        jQ        | j        j<        | j        jl        | j        jn        ddZ
  
         t          |@| j        j         | j        jq        | j        jr        | j        jQ        | j        j<        | j        jl        | j        jn        ddZ
  
         	 	 ddd           n# 1 swxY w Y   n$|s"t          d[| c                                           |,S )\a  
    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 zwith variant zz 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  )rR   r   r  s     rU   r   zbuild.<locals>.<genexpr>	  sN       4 48;BG$$S))!,34 4 4 4 4 4rW   zBUILD START:c                     g | ]}|v|	S r   r   )rR   r  built_packagess     rU   rV   zbuild.<locals>.<listcomp>	  s#    KKKSN1J1JS1J1J1JrW   c                     g | ]	}|j         
S r   )r  )rR   mss     rU   rV   zbuild.<locals>.<listcomp>	  s    999R999rW   r  c              3   H   K   | ]}|                     d           dk    V  dS )r   r  NrY   )rR   r  s     rU   r   zbuild.<locals>.<genexpr>	  s1      NNcswwv')NNNNNNrW   r  pipr  	mercurialhgr\  c              3   H   K   | ]}|                     d           od|v V  dS )rR  z3.Nr   r  s     rU   r   zbuild.<locals>.<genexpr>	  sH       8 8CGDOOH-->$$,8 8 8 8 8 8rW   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   )rR   excs     rU   r   zbuild.<locals>.<genexpr>	  s.      !P!P";#";";";!P!P!P!P!P!PrW   )r  raise_error)allow_no_other_outputszmetadata_conda_debug.yamlzsource tree in:z&no source - creating empty work folderr  )exist_okzprefix_files.txtr  r   r  zbld.batr   rR  )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   rR   rS   r~  s     rU   rp  zbuild.<locals>.<dictcomp>N
  s%    *W*W*WaSVhh1c!fhhhrW   {} {}={}ru   r!  exportCONDA_BUILD)r~  rewrite_stdout_envr  r  z	building TNpermit_unsatisfiable_variantsrU  )r  r[   r   r  r  ztest script specified as zJ 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 {})
rZ   rR  rQ  rt  rI  rj  r}   r   clear_cacheomit_defaultszSTOPPING BUILD BEFORE POST:)~skiprm   r   get_skip_messager   r   path_prependedrP   r  r   r8  r   r   needs_source_for_renderr8   r  variantsrQ   r4   r   skip_existingis_package_builtr]   r1   r[   r   r  r  r  r;   r  remove_existing_packagesrR  r  ru  r   uses_vcs_in_buildr   r+   r   r   r  r  r  rY   r!  r  r  r*  r+  r	   r0   r  warn_on_use_of_SRC_DIRfinalparse_until_resolvedr7   r5   r  r   rj  r   rA  r  r  r   build_folderr   rS  r>  r	  r  r   r@   codecs	getwriterrG   r  r%   write_build_scripts
shell_pathrI  no_rewrite_stdout_envr  insertr   rn   r   r<  remove_pycache_from_scriptsrr   rc   r   r   r  r   rZ   r   r   r  r  r   r  r  r  r  r  r  r}   r  r   r  r  rQ  rt  r  r  r   addr  r   bundlersr  rU  r   r(   )Crs   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_finalizingrN   omprinted_fnsspecs
vcs_sourcevcs_executablehas_vcs_availableexclude_patternexcludesrb   r  files1r   r  build_stats
build_filer
  bf	work_filer  rewrite_envrewrite_varsrS   rL  prefix_file_listr[  new_prefix_filesnew_pkgsr  top_level_metarZ   prefix_files_backupoutput_dtest_scriptpkg_pathr  sub_build_ms_deps	to_removepkg_typenewly_built_packagesr1  csumprev_omprev_output_d	prev_csumnaturebuilt_packageindex_subdirr~  r  sC        `                                                           @@rU   r  r  j	  s	   ( N vvxx e$Q''(((

8
$
$CJK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 3 3 5 5 N N N   "! 		/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NNQ]]95M5MNNNNN 	+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+?@@@
AH)D9999$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 o;dl22 
!";";*/ #< #
 #
 	WQZ]1222   57IJJ7>>*++ 	"&'' ;1 #AFFHH$7$7$9$9 : :; ; ; ; ; ; ; ; ; ; ; ; ; ; ;  EEM
 x#x// H   	  !! U	%8%  GLL!5q99GLL!4a88!      ' G G!$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 P P P   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)0)D ! 4 %l 3 3 &'(x';&'hn()(8()(8-2183H-I-I()(8,-H,@./h.D./h.D-2183H-I-I* * *J $. ! 4 *$*'(x'-)*)*W)<     .44\BBB&-&A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$(&+   yGU	 U	 U	 U	 U	 U	 U	 U	 U	 U	 U	 U	 U	 U	 U	n  	;/::: Os   >B  B$'B$4WWW3A^^^a88a<?a<4kkk 4o  oo].AVM>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| d|  d          |S )Nzbash.exez-elrI   z-eCOMSPECcmd.exe/d/c)
powershellz-executionpolicybypassz-FilerR  )rv   ru   z.ps1z.pyr   zDon't know how to run z/ file.   Please specify script_interpreter for z output)r   r@   r   r   rY   r   r  r   r#  r   NotImplementedError)script_filenameextensions_to_run_commandsfile_extr   commandinterpreter_commands         rU   r9  r9  h  s     ',lF
E""	955tTBEEEz	" " w003H288:: 
 
W>>&&s++ 	")E	 "?X ? ?&5? ? ?
 
 	
 rW   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   ru  rP   remove_work_dirr  )rT   
test_filesr   r  contentss        rU   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rP   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  rL  r  )need_cleanupr  r4   r6   r   r   r   r   rA  rP   r  r  rY   source_providedr8   )r  rP   
hash_inputrT   r   s        rU   (_construct_metadata_for_test_from_reciperV    s    FFJjFFF 		
H 
8
$
$CHH	H  
 
K()))}$$((88 =' 	=e<<<<ZrW   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  rZ   r  F)ry   zlinux-zosx-rU  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   r2  r  rQ  r   r[   r\   )r[   r\   build_numberr  )numberr  r  r  )packager  r  r  rU  rM   c                 $    g | ]}|d k    r|nS )localr   )rR   url
local_paths     rU   rV   z=_construct_metadata_for_test_from_package.<locals>.<listcomp>  s%    BBBc3'>>CCzBBBrW   ),r   get_recipe_abspathrS  r  r   r   r  r	   r   r  r}  r   r   r  rQ   r   r   abspathr   r  r   r   rR  r   r   r'   rI  r6   r   
SystemExitr*   fromdictintrU  rP   r	  r  	used_varsr  rt  r"   r  rA  r  )rZ  rP   r  rS  rU  r  r   package_datar   local_pkg_locationlast_element
is_channelplatform	local_dirlocal_channelrT   rK  r^  s                    @rU   )_construct_metadata_for_test_from_packagerl    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  r}   r~  ztest_time_dependencies.jsonr  rL  Fr  )r  rP   r  r   r   r  r	   r`  r   r   r   r  r   r}   r   r   r  r}  r  rY   rT  r8   )rT   r  r  rN  dependencies_file	test_depsr   test_sections           rU    _extract_test_files_from_packagerq    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  rV  rl  )recipedir_or_packagerP   rs   rU  s       rU   construct_metadata_for_testrt  3  sv    
*++

7011[@@@ &
 
:: B &
 
: j=rW   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_INDEXrR  PYTHONDONTWRITEBYTECODEr  zconda_build.shzbuild_env_setup.shr  r\  zexport z="r  z!if [ -z ${CONDA_BUILD+x} ]; then
z    source r   r  i  )r   r  rP   r   r  r   r8  pip_cache_dirrU  r	   r  r   r   rS  r6  r  r   r   r   r   )	rs   r  r&  r~  r(  env_filer'  rS   rL  s	            rU   r  r  B  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          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    r$|
                    dt,           d| d| d           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_appz"{python}" -s "{test_file}"
zrun_test.py)rR  	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)rr  r   ru   zcall "r  zCFound sh test file on windows.  Ignoring this for now (PRs welcome)rv   r  z" z-e ")r   r   r   r   rS  rn   r@   rP   test_pythonr   r?   r	   r  perl_binr  host_platformlua_binrscript_binr   r   r  r   r  )rT   test_run_scriptr  py_filespl_files	lua_filesr_filesshell_filestracer   tfr  
shell_files                rU   _write_test_run_scriptr    sV    
8
$
$C	os	#	# EKr
,33!&;vv8 / 4  	
 	
 	
 < 	)HH89999HH'E'''((( 	>"/5K!!"455 0& 0)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	 /     | ><=== 	K) K K
< 
Kw''
33A6&@@!9*!9!9!9:::!DEEEEa    W%%j11!4==HHIIIuII*IIIJJJKEK EK EK EK EK EK EK EK EK EK EK EK EK EK EK EK EK EKs   N
OOOr\  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   )rO   )rR   rb   r{  s      rU   rp  z&write_test_scripts.<locals>.<dictcomp>  s*    HHHeC#e**HHHrW   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--devr\  r  z-i)
python_exer  r  r  r  r  r  r  r  zset +e
)rP   r7  r[   r   prepend_bin_pathr  r@   r   pathsepr"  rF   rQ   r   r	   r  r   rS  rn   r  r   rI  r   rY   r  r  )rT   rq  r  r  r  r  r  r  rW  r  r  r  r  s                rU   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           oXt          j                                       o9                     t                     ot#           fdt$          D                       }
|
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'l mL}  ||j        j'                  }||jM        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        S                    d-d.          d/d0|g}n t          g|j        j
        rd1gng z   d2d3|gz   }	 i }|sd|j        j
        s|j        jU        rd} no#fd4d5D             } |j        j6        rU| V                                D ]@\  }!}"t          d6W                    |                    d7          rd8nd9|!|"                     At          jX        |#|j        j        || :           t          |d;|.                                            |4|j        jZ        r(||t          |d<|.                                           <   t          j        \                    t9          |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"|j`        |st          j        |j`                   dS )@zr
    Execute any test scripts for the given package.

    :param m: Package's metadata.
    :type m: Metadata
    r  zTEST START:rP   z-x r\  c              3   Z   K   | ]%}t           j                                      |v V  &d S r   )r   r   r   )rR   pkgs_dir recipedir_or_package_or_metadatas     rU   r   ztest.<locals>.<genexpr>Q  sK       
 
 GOO<==I
 
 
 
 
 
rW   zNothing to test for:Tr  r  rN   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)rs   r   TESTr  r  r  r  Nr'  r  r  r  r  rU  r  z;failed to get install actions, retrying.  exception was: %s)move_broken
broken_dirrP   r~  r   CONDA_PATH_CONFLICT)rP   r~  rZ   r  r  r   )get_installed_packagesrZ  r[   r   Fr  r?  r@  rA  rB  r  r  r  c                 *    i | ]}|v ||         S r   r   r  s     rU   rp  ztest.<locals>.<dictcomp>  s%    TTTQ1PS88q#a&888rW   )r  r  r  ru   r!  r  )r~  r  r  r  ztesting test_TEST_FAILEDr   z	TEST END:)ar   r   r   r  r  rm   rA  rP   r  rt  rI  rq  r   r   r   r   r;   r  r   r   clean_pkg_cacher  r$   test_run_postrM  r   r  r   r	   r   rJ  rA   rT  r  r   r   r-   get_test_depsr  r  r  rD  r"  r8  r   r7  r[   r  r@   r  rU  r   r  r  rj  r}   r  r   r  r  rQ  rt  r&   r   r   r   AssertionErrorrO   tests_failedr  r   path_conflictr<   r    r  r  r  r  r  r8   r  r.   r  rY   r  r  r   rn   r<  rr   r  rc   r`  r   r   rS  r  )$r  rP   r  r  r  r   rU  test_package_namerT   r  in_pkg_cacherN   r  r  r  r  r  r[   r   r  r  rZ   precsr  conflict_verbosityr  r~  r   r  r1  r  
test_statsr)  rS   rL  r~  s$   `                                  @rU   r  r    sx    
8
$
$CJ 3V<<	.(--///-   0m.////:: 
3HO,----:,f 
  
* _*2EEE %X... 4h??? 	
GNN;<<	
,556NOO	
  
 
 
 
%
 
 
 
 
	   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111111**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 #W=2AW88W=AZ  Z$'Z$	B ]]]E)g/ /h&>#h!!h&c                    t          |          st          j        |           t          | d          rt	          |           }n| }t          |t          j                            |                    }|rt          j	        t                    }	 t          j        ||           |                    dt          j                            |           d|            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
    rP   zTests failed for z - moving package to r   r2  zTESTS FAILED: N)r   r   r   r  r1   r	   r   r  r   r   r   rb  ri  r   r   r'   r   rI  r  r  )package_or_metadatar  r  rP   r  r  r   s          rU   r  r  3  sf      
J"H-- "-..!
BG,,S1122D 
x((	KT"""HH\BG$4$4S$9$9\\PZ\\     	 	 	D	GOOBGOOC00116<QR	
 	
 	
 	
 H 0 0 5 5566666s   AC 
C*)C*c                      t           rWt          j        d          } | Ct          j        dt
          j                            t          j                   d           d S d S d S )Npatchelfz'Error:
    Did not find 'patchelf' in: z
    '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   r  r	   	dir_paths)r  s    rU   check_externalr  R  sv     	+J77H"35:??8CU3V3V" " "    	 	rW   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   n:# t          t          f$ r&}#|9                    d#| d$|#            Y d }#~#Kd }#~#ww xY wt          ||"d%|gd&          }$tY          to          |$H                                          d'         d'         |j        -                                |           |
I                    ||i           n|
I                    |           t          j        J                    |j        jK                  r|j        j        s|j        jL        s|M                    d(          sd|_        t          j                            t          j                            |j        jK                  d                     d)|>                                |j        jC        d*f                    }%t          |j        jK        |%d+           |O                                 n# t          $ r}}#g d,}&d- |
(                                D             }'g }(| P                    |g           t          |#jR        |#jS                  D ]B\  }})|T                    d          d'         T                    d.          d'         9|r0t          9fd/|V                    d0          D                       r ||v rD|O                    d1           t          d2| d3t          |#jY                  z   d4z   |	z             ||&v r|                    |           d5}	t          t          j                            |9                    }*|*s.t          t          j                            |d69                    }*t          t          j                            |9d7z                       }+|+s1t          t          j                            |d69d7z                       }+d},|*s|+r|*|+z   D ]:t          :fd8|'D                       sqt;          :|j        9          }-|-D ]X}.t          j[        t{          |)          |.d'         |          r-t          d:| d;| d<           |(                    :           d},Y|,s|O                    d1            D|s|]                    |          r}|]                    |          t          |<                    d=                    k    rD|O                    d1           t          d2| d3t          |#jY                  z   d4z   |	z             |                    t          j                            |                     | P                    |(           Y d }#~#nd }#~#ww xY w| d> |
D             }/|d?v r.d@ |
D             }0t          |/|9           t          |0|9           ddAlamb}1  |1|/          }2t          dB           t          t          jd        |2ddC                     t          d4           t          j                    |z
  }3t          dD |H                                D             pd'g          }4t          dE |H                                D             pd'g          }5t          dF |H                                D             pd'g          }6t          dG |H                                D             pd'g          }7t          dHg                    dIt          jh        |3          t          jh        |6          t          jh        |7          t          ji        |4          t          ji        |5          J                     |3|4|5dK|dL<   |jj        rBt          |jj        dM          5 }8t          jl        ||8           d d d            n# 1 swxY w Y   to          |
8                                          S )NNpkgsz.trashzdel /s /q "z\*.*" >nul 2>&1Tr   r\  Fr[   rP   )resetr  r   r   )rP   r  r  rR  bypass_env_checkTFr   )r  r  r  r  r  )rP   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)rR   rN   s     rU   r   zbuild_tree.<locals>.<genexpr>  sQ       3" 3" )* %+M(.(>(N%& %&3" 3" 3" 3" 3" 3"rW   
   r  r  rK   r  c                 6    g | ]}t          j        |          S r   r  r  s     rU   rV   zbuild_tree.<locals>.<listcomp>  s0     )" )" )"FJE$;D$A$A)" )" )"rW   rN   )r   rW  )r~  rZ   r  rt  z"Skipping downstream test for spec z ; was unsatisfiable.  Error was r  )package_subsetrequire_filesr   z%build/no_move_top_level_workdir_loopsr  main_build_loopr  )rR  r  r#  zmro-baser  r  c                 4    g | ]}|d          d          j         S )r   r   )rR   entrys     rU   rV   zbuild_tree.<locals>.<listcomp>F  s#    "X"X"X58A;#3"X"X"XrW   r  c              3   N   K   | ]\  }}|                                 k    V   d S r   r]  )rR   rN   output_metapkg_names      rU   r   zbuild_tree.<locals>.<genexpr>O  sL       $ $(K  0 0 2 22$ $ $ $ $ $rW   r  )remove_folderszCan't build z$ 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  )rR   r   r  s     rU   r   zbuild_tree.<locals>.<genexpr>w  s@       # #<@DOOJ77# # # # # #rW   r  zMissing dependency z*, but found recipe directory, so building z firstr  c                 F    g | ]}|                     t                    |S r   )r   r;   r|  s     rU   rV   zbuild_tree.<locals>.<listcomp>  s*    RRRaQZZ8P-Q-QRRRRrW   r  c                 <    g | ]}|                     d           |S )z.whl)r   r|  s     rU   rV   zbuild_tree.<locals>.<listcomp>  s)    BBBqzz&/A/AB!BBBrW   )get_hash_inputzO
INFO :: The inputs making up the hashes for the built packages are as follows:)r  r  c                 8    g | ]}|                     d           S )rh   r  rR   steps     rU   rV   zbuild_tree.<locals>.<listcomp>  s"    FFFt488E??FFFrW   c                 8    g | ]}|                     d           S )ri   r  r  s     rU   rV   zbuild_tree.<locals>.<listcomp>  s$    BBB4dhhv&&BBBrW   c                 8    g | ]}|                     d           S )rf   r  r  s     rU   rV   zbuild_tree.<locals>.<listcomp>  s$    HHH),,HHHrW   c                 8    g | ]}|                     d           S )rg   r  r  s     rU   rV   zbuild_tree.<locals>.<listcomp>  s$    JJJ4$((:..JJJrW   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####################################################################################)barrj   rf   rg   rl   ri   )r  rl   ri   totalr  )mr   r   r@   r   r   r	   r   r  r  r   r   r  r   r  anaconda_uploadpopleftr  r[   rP   set_build_idr  compute_build_idr]   r  rD   rE   r2   r
  r  r6   r  r  rQ   rA  r   r  r  r	  r\   r  r   r   r;   r   r  rD  r  rY   r  r  rt  path2urlr`  r   r   r	  r  r   r  r   r  r   r  r  r   r   r  r   r  r   r&   r3   r  r"  r`  r  rS  r   rA   clean
extendleftrH  r  
matchspecsr  r  r  r  rO   messager=   match_peer_jobrm   r  r   handle_anaconda_uploadhandle_pypi_uploadinspect_pkgr  r  ra  maxr%  rn   ro   rp   
stats_filer   r  );recipe_listrP   r  
build_onlyr  r  r  to_build_recursive	trash_dir
extra_helpr  retried_recipesinitial_timerT   r  r[   cfgrecipe_parent_dir	variants_metadata_tuplesr  r  packages_from_thisr  dict_and_metarN   r  r  rt  r   r&  r_stringr  rx  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;                                                            @@rU   
build_treer  _  s    $$K| SGLL!@!@&(SS	7==## 	S OE)EEETRRRR J ]]NO9;;L !&	 !& H
 Z0X	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*& *& *& 
%*)/070K,2,10537;3J9=9Q9E1* 1* 1*
%* 
%* 
%* 
%* 
%* 
%* 
%* 
%* 
%* 
%* 
%* 
%* 
%* 
%* 
%* %7$@(" !- !- !- %(HH)IS )I )IEF)I )I%& %& %& %-HHHH!- .F$($)$*47526." ." ."
 !%$():):)<)<$=$=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 , V	0 V	0 V	0MMMJ"X"XAUAUAWAW"X"X"XK""F8,,,"%aj!,"?"? @ @Y99S>>!,22377:   $ $ $ $,4,L,L/3 -M - -$ $ $ ! !  ,,,IIUI333&TvT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 %*)7c )7 )7+.)7 )7 )7%& %& %&
 %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:::"";////////mV	0I  Z0x SR>RRRH|BB^BBBx77776&1111 ,+++++ .**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a1 ;Z/Z	;ZZZZZa1 [
	$[	?a1 [
	
F%a1 1o9<M3o44o9x''x+.x+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|)d}|d| dz  }|d| |                    |           z   z  }|st          |           d S |s't          |           t          j        d| 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anacondar\  MSYSTEMz \
    z ^
    z$ zA# If you want to upload package(s) to anaconda.org later, type:

zC
# To have conda build upload to anaconda.org automatically, use
# z'conda config --set anaconda_upload yes
zanaconda uploadzEError: cannot locate anaconda command (required for upload)
# Try:
# zconda install anaconda-clientz--tokenuploadz--force--userz--label
Uploading z to anaconda.org)r  r   r   r  tokenuserr  rm   r@   r   r   r	   r  r  r   r]   force_uploadlabelsr   r  r   r  r   )r  rP   r   r  r  no_upload_messagejoinerprompterr  labelrZ  s              rU   r  r    s   222222e$$EF | v{ # 12222z**H< 9
22 	MX%Q 	 	DD D D	

 	7v77&++e:L:LLL     
   99 9 9	
 	
 	
 	C | .

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

9{ ,

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

Iu%&&&&  	Jrw//88JJJKKKOC7)O,,,,, 	 	 	#$$$		 s    AG		 G)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  rm   r<  r   r   r   )r  rP   r   r   s       rU   r  r    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 rx   zThere are currently z accumulated.z?To remove them, you can run the ```conda build purge``` command)rm   crootr   get_build_foldersr   )rP   build_folderss     rU    print_build_intermediate_warningr-  >  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LrW   c                 n    |st          j        | j                  }|D ]}t          j        |           d S r   )r   r+  r*  rA  )rP   foldersr  s      rU   clean_buildr0  G  sH     8)&,77  F rW   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   r3  _subdirr\  )r[   r\   r  r   )
SubdirDatarU  )rk  rJ  )rP   r  r   r   r   r   r'   rI  rJ  r"   rQ  r   rt  r   r   r[   r\   r  	conda.apir3  r  	query_all)rT   r~  include_localry  rZ   rK  r  r3  s           rU   r  r  N  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VrW   r   r  )NTFNFF)r\  r  )FNFN)T)__doc__r  r  r   r  r*  rb  r   r  r   r  r  r  collectionsr   r   os.pathr   r   r   r   r	   conda_package_handling.apirD  r  bs4r
   r'  r   rj  r\  r  r   r   r   r   r   r  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   rP   r#   create_testr$   
exceptionsr%   r&   r8  r'   r(   rT   r)   r*   os_utilsr+   r  r,   r-   r.   r/   renderr0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   r  rD   rE   rF   rG   ri  r  rc   rr   r   r   r   r   r   r'  r  r3  r9  r  rB  rP  r   ru  r  r  r  r  r  r  r  r  r  r  r  r  r3  rG  rM  rY  rg  r  r  r  rT  r  r  r  r5  r  r  r  r  r  r  r  r  r   rt  r{  r  r  r  r;  r  r  r9  r  rV  rl  rq  rt  r  r  r  r  r  r  r  r  r  r-  r0  r  r   rW   rU   <module>r@     s
      				  				        



   * * * * * * * * 8 8 8 8 8 8 8 8 8 8 8 8 8 8 ! ! ! !        . . . . . . 0 0 0 0 0 0 = = = = = = = = = = = = = =                                     &       . . . . . . I I I I I I I I ; ; ; ; ; ; ; ; & & & & & & & &                 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
                                   
 CLJJ
\ JJJ  .  6!8 ! ! ! !6  o o on  * * * +--B' B' B' B'J   +--:' :' :' :'z0' 0' 0' 0'h    8 
Q8 Q8 Q8 Q8h	 	 	F0 F0 F0 F0R
 
 
 
4
 
 
(;+ ;+ ;+|     :: : :/ / /)& )& )&X
 
 
"< < <~- - -# # #LW% W% W%t] ] ]@T T T# # #*  @$3 $3 $3N<x < < < <4' ' '	 	 		& 	& 	& 	& 	&; ; ;|  .    ! ! !$ $ $? ? ?D D D   >' ' 'T  :W( W W W Wt`8 ` ` ` `F	+E8 +E +E +E +E\
 
 
  b( b( b(J  "h
 h
 h
 h
 h
\ 
{ {{ { { {|  0  &     ,`  `  ` F$E $E $EN  : : :zQK QK QKj TVF, F, F, F,Z T T T Tn7 7 7>
 
 
 UYo' o' o' o'dB B BJ%N %N %NPM M M   W W W W W WrW   