
    xheDu                        d Z ddlZddlZddlZddlmZ ddlmZ ddlm	Z	 ddl
m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mZ ej        j         dej        j         dddddd                    ej        dd         d          dderdndddddddddg ddgg dddZdddd d!dddd d!d"d#d#d$d!d%d&d'd(d%d)d*d+d%d)d,Z ej        d-d          d.         Z ddd/d0d1d2Z! e	d3          d4             Z"d5 Z#d6 Z$d7 Z%d8 Z&	 dMd:Z'dNd;Z(d< Z)d= Z*dNd>Z+dOd?Z,dPd@Z-dA Z. e	d3          dB             Z/dC Z0e0Z1dD Z2dOdEZ3dF Z4dOdGZ5dQdIZ6 e	d3          dQdJ            Z7dK Z8dL Z9dS )RziThis file handles the parsing of feature specifications from files,
ending up with a configuration matrix    N)OrderedDictcopy)	lru_cache)product   )cc_conda_buildsubdir)ensure_list
get_loggerisliston_wintrim_empty_keys)_parse.z1.22z1.23z1.26))      )r   	   )r   
   )r      )r         z5.26.253.43.5noconazx.x)min_pinmax_pin)pythonzr-baser   numpy)pin_run_as_buildignore_versionignore_build_only_depsextend_keyszhttps://cran.r-project.org)r   r    perlluar_basecpu_optimization_targetr!   r"   r#   r$   cran_mirrorvs2008vs2010vs2017)2.7z3.3r   r   91014gfortran)ccxxvcfortrangccgxx)r2   r3   r5   clangclangxx)winlinuxosx-r&   r%   r'   )PYNPYLUAPERLR)maxsizec                    t           |                                          }| dk    rgt          |          t          d          k    rd}n"t          |          t          d          k    rd}|d         |         |d<   |d         |         |d<   d |                                D             }| dk    rt           |          d         |         |d<   |S )	Nr:   r   z3.2r-   r2   r3   c                 ,    i | ]\  }}|d k    |dz   |S )r4   	_compiler ).0langpkg_names      4lib/python3.11/site-packages/conda_build/variants.py
<dictcomp>z*_get_default_compilers.<locals>.<dictcomp>l   s4       D(4<< 	{H<<    r4   )DEFAULT_COMPILERSr   parse_versionitems)platformpy_ver	compilerss      rL   _get_default_compilersrU   b   s    !(+0022I5  M%$8$888FF6""mE&:&:::F"3/	#$U+F3	% 'oo//  I 5+H5d;FC	$rN   c                    t                                           }| j        |d<   t          | d          r| j                            d          s|d         n| j        d         }|                    t          | j        |                     |S )Ntarget_platformvariantr   )	DEFAULT_VARIANTSr   r
   hasattrrX   getupdaterU   rR   )configbaser   s      rL   get_default_variantr_   w   s      ""D$mD	 	**	&28.2D2DX2N2N	&X^H% 
 	KK&v??@@@KrN   c                 &   ddl m}m} t          |           5 }|                                }d d d            n# 1 swxY w Y    || ||          d          }t          j        |t
          j        j                  pi }t          |           |S )Nr   )get_selectorsselect_linesF)variants_in_place)Loader)
metadatara   rb   openreadyamlloadloader
BaseLoaderr   )pathr]   ra   rb   fcontentscontents          rL   parse_config_filerp      s    55555555	d q6688              |HmmF&;&;uUUUHi)?@@@FBGGNs   9= =c                 l   g }|                     d D                        	 t                    }|                     fd|D                        t                      |                     fd|D                        |                     fd|D                        n9# t          $ r,}|                    t          |                     Y d }~nd }~ww xY wt          t          d |                    }|r6t          d                    | d	                    |                              d S )Nc              3   *   K   | ]}d |v d| dV  dS )r=   z  z& key contains an invalid character '-'NrH   )rI   ks     rL   	<genexpr>z validate_spec.<locals>.<genexpr>   s;        ;<q6Q666 rN   c              3   <   K   | ]}|D ]}|vd | d| dV  dS )  zip_key entry 
 in group z does not have any settingsNrH   )rI   zgrs   specs      rL   rt   z validate_spec.<locals>.<genexpr>   s_       
 

 
 }}	 LqKKBKKK }}}}
 
rN   c              3   f   K   | ]+}|D ]&}|v r	d | d| dn                     |          V  ',dS )rv   rw   z1 is a duplicate, keys can only occur in one groupN)add)rI   rx   rs   uniques      rL   rt   z validate_spec.<locals>.<genexpr>   s       
 
 
 
  F{{q  B     A
 
 
 
 
 
 
rN   c              3   j   K   | ]-}t          fd |D             dhz
            dk    %d| dV  .dS )c                 `    h | ]*}|v r"t          t          |                             nd +S N)lenr   rI   rs   ry   s     rL   	<setcomp>z*validate_spec.<locals>.<genexpr>.<setcomp>   s:    NNNaa4ii[a))***TNNNrN   Nr   z  zip fields in zip_key group z are not all the same length)r   rI   rx   ry   s     rL   rt   z validate_spec.<locals>.<genexpr>   s       	
 	
 NNNN2NNNRVQWW   	 NRMMM   	
 	
rN   z&Variant configuration errors in {}:
{}
)
extend_get_zip_keysset
ValueErrorappendstrlistfilterformatjoin)srcry   errorszip_keyser|   s    `   @rL   validate_specr      s   F MM  @D     
$
 &&
 	 
 
 
 

 
 
 	
 	
 	
  
 
 
 
 
 
 
 	
 	
 	
 	 	
 	
 	
 	
	
 	
 	
 		
 		
 		
 		
3    c!ffJ &v&&''F 
5<<S$))FBSBSTT
 
 	

 
s   B& &
C0"CCc                 0   d fdt          |j                  D             }|s|j        st          j        d          r t          d                   }n) t
          j                            dd                    }t
          j                            |          r|	                    |            d          }t
          j                            |          r|	                    |           t          | d|           } t
          j                            |d                    }t
          j                            |          r|	                    |           |                    fdt          |j                  D                        |S )a  
    Find config files to load. Config files are stacked in the following order:
        1. exclusive config files (see config.exclusive_config_files)
        2. user config files
           (see context.conda_build["config_file"] or ~/conda_build_config.yaml)
        3. cwd config files (see ./conda_build_config.yaml)
        4. recipe config files (see ${RECIPE_DIR}/conda_build_config.yaml)
        5. additional config files (see config.variant_config_files)

    .. note::
        Order determines clobbering with later files clobbering earlier ones.

    :param metadata_or_path: the metadata or path within which to find recipe config files
    :type metadata_or_path:
    :param config: config object specifying config file settings
                   (see exclusive_config_files, ignore_system_variants, and variant_config_files)
    :type config: :class:`Config`
    :return: List of config files
    :rtype: `list` of paths (`str`)
    c                     t           j                            t           j                            t           j                            |                               S r   )osrl   abspath
expanduser
expandvars)ps    rL   <lambda>z#find_config_files.<locals>.<lambda>   s4    (:(:27;M;Ma;P;P(Q(QRR rN   c                 &    g | ]} |          S rH   rH   rI   rm   resolves     rL   
<listcomp>z%find_config_files.<locals>.<listcomp>   s!    LLLAWWQZZLLLrN   config_file~zconda_build_config.yamlrl   c                 &    g | ]} |          S rH   rH   r   s     rL   r   z%find_config_files.<locals>.<listcomp>   s!    OOO''!**OOOrN   )r   exclusive_config_filesignore_system_variantsr	   r[   r   rl   r   isfiler   getattrr   variant_config_files)metadata_or_pathr]   filescfgrl   r   s        @rL   find_config_filesr      s   * SRG MLLLV-J!K!KLLLE 6 m,, 	H'.788CC'"',,s,EFFGGC7>># 	LLg/007>># 	LL#V-=>>D
'"',,t%>??
@
@C	w~~c S	LLOOOOk&2M&N&NOOOPPPLrN   Tc                    i t          |          }t          |          }|                                 D ]\  }r|r,t          t                    }|                    d|                                            D ]\  }|r|v r|v rt          |d          rNv r2t                   d          r                             |           W|                                <   ot                              g                     <            	                    t          |                     t          t                                       <   dk    rd |D             }t          |d         t                    st          |d         t                    s|g}                    g           <            	                    |           t          d d          D             D                       <   t          |d          r|                                <   g}	|r|D ]
}
|
v r|
}	 nt          fd|	D                       r|	D ]}t          t          |                             t          t          |                    k    r`t!          d	                    ||t          t          |                    t          t          |                                                 t          |                   |<   v r|	D ]}|v rBt          t          |                             t          t          |                    k    r n^|v rBt          t          |                             t          t          |                    k    r n|                                <   fd
t          |          D             }fd|	D             }t          |          r-t!          d                    |||                             S )NzAdding in variants from keysr   c                     g | ]}||S rH   rH   )rI   subvals     rL   r   z._combine_spec_dictionaries.<locals>.<listcomp>  s    >>>v>V>>>rN   r   c              3   4   K   | ]}t          |          V  d S r   )r   )rI   	set_groups     rL   rt   z-_combine_spec_dictionaries.<locals>.<genexpr>  s<       ) ) ) !OO) ) ) ) ) )rN   c                 ,    h | ]}t          |          S rH   )tuple)rI   groups     rL   r   z-_combine_spec_dictionaries.<locals>.<setcomp>  s    -R-R-RueEll-R-R-RrN   c              3       K   | ]}|v V  	d S r   rH   rI   
group_itemry   s     rL   rt   z-_combine_spec_dictionaries.<locals>.<genexpr>,  s(      "V"V*:#5"V"V"V"V"V"VrN   znAll entries associated by a zip_key field must be the same length.  In {}, {} and {} are different ({} and {})c                 (    g | ]}|         v|S rH   rH   )rI   subvaluers   valuess     rL   r   z._combine_spec_dictionaries.<locals>.<listcomp>I  s2     5" 5" 5"(0'/vay'@'@ %-'@'@'@rN   c                     g | ]}|v|	S rH   rH   r   s     rL   r   z._combine_spec_dictionaries.<locals>.<listcomp>N  s.     7" 7" 7"(2'1'='= %/'='='=rN   zvariant config in {} is ambiguous because it
does not fully implement all zipped keys (To be clear: missing {})
or specifies a subspace that is not fully implemented (To be clear:
.. we did not find {} from {} in {}:{}).)r   rQ   r   __name__inforZ   r\   r   r[   r   r   r   
isinstancer   allr   r   r   )specsr$   filter_keysr   
log_outputr   spec_sourcelogvkeys_in_groupr   r   missing_subvaluesmissing_group_itemsrs   ry   r   s                 @@@rL   _combine_spec_dictionariesr      s   
 F{##Dk**K"[[]] a& a&T `	& C **AKAABBB

 \& \&1 [&qDyyK''"1f-- 	= F{{wvay&/I/I{ &q	 0 0 3 3 3 3,-FFHHq		(3FJJq"4E4E(F(FF1I"1I,,[^^<<<(,S^^(<(<F1IIj>>!>>>)!A$55 $j1u>U>U $!"A$*JJq"$5$5q	q	((+++$( ) )-R-Rq	-R-R-R) ) ) % %q		
 #1f-- B&()F1II ./CM' .-5 !. !.E'(Ezz8=(- (2  #"V"V"V"V"V"V"VVV 4&2? !W !WJ'*;tJ7G+H+H'I'IS(3AN& N& (& (& /9-DDJF0;010:03KNN0C0C03KZ@P4Q4Q0R0RE. E.
/* 
/* 
)* :ET*EU9V9VF:$6$6!W  "#f2? 
!9 
!9J'1T'9'9c(3D4D(E(E?& ?&),[^^)<)<?= ?= ).'1V';';(3F:4F(G(GA& A&),[^^)<)<A= A= ).01F1I5" 5" 5" 5" 5"4?NN5" 5" 5" 1
7" 7" 7" 7"6C7" 7" 7" 3
 $''8#9#9 !&*4)S TZSY,7,?,=,0,-,21IT* T*	+& +& %& MrN   c                    t           d         dd         }|                    d |                                 D                        t          | |dg|                              dg           }t          | |||          }|S )a  With arbitrary sets of sources, combine into a single aggregate spec.

    Later specs in the input set have priority and overwrite duplicate entries.

    specs: list of dictionaries.  Keys are arbitrary, but correspond to variable
           names used in Jinja2 templated recipes.  Values can be either single
           values (strings or integers), or collections (lists, tuples, sets).
    r$   Nc                 `    g | ]+}|t          |                    d                     D ]}|,S )r$   )r   r[   )rI   ry   keys      rL   r   z!combine_specs.<locals>.<listcomp>p  s]     	
 	
 	
	
 #488M#:#:;;		
 	
  	
 	
 	
 	
rN   r   )r$   r   r   )r$   r   r   )rY   r   r   r   r[   )r   r   r$   r   r   s        rL   combine_specsr   e  s     #=1!!!4K	
 	
	
 	
 	
   *;ZLZ  	c*b  (;j  F MrN   c                 2   d t                                           D             }i }|                                D ]\\  }}|| v rSt          | |                   }|dk    r0d                    |                    d          dd                   }||d|z   <   ]|S )zGiven args passed into conda command, set language env vars to be made available.

    Search terms: CONDA_PY, CONDA_R, CONDA_PERL, CONDA_LUA, CONDA_NPY
    c                     i | ]\  }}||	S rH   rH   rI   rs   r   s      rL   rM   z)set_language_env_vars.<locals>.<dictcomp>  s    777DAq1a777rN   r?    r   Nr   CONDA_)
SUFFIX_MAPrQ   r   r   split)rX   inverse_mapenvvariant_nameenv_var_namevalues         rL   set_language_env_varsr     s    
 87J$4$4$6$6777K
C&1&7&7&9&9 1 1"l7""-..Et##C 0 0! 455+0C<'(JrN   c                     |                      d          }|st                      S t          |d           rt          |          hS t          |d           rd |D             S t	          d          )a+  
    Extracts 'zip_keys' from `spec` and standardizes value into a list of zip_groups
    (tuples of keys (string)).

    :param spec: Variants specification
    :type spec: dict
    :return: Standardized 'zip_keys' value
    :rtype: set
    :raise ValueError: 'zip_keys' cannot be standardized
    r   c                 ,    t          | t                    S r   r   r   r   s    rL   r   z_get_zip_keys.<locals>.<lambda>  s    Jq#,>,> rN   uniformc                 &    t          | d           S )Nc                 ,    t          | t                    S r   r   r   s    rL   r   z1_get_zip_keys.<locals>.<lambda>.<locals>.<lambda>  s    
1c@R@R rN   r   )r   r   s    rL   r   z_get_zip_keys.<locals>.<lambda>  s    F16R6R$S$S$S rN   c                 ,    h | ]}t          |          S rH   )	frozenset)rI   rx   s     rL   r   z _get_zip_keys.<locals>.<setcomp>  s    111"	"111rN   z;'zip_keys' expect list of string or list of lists of string)r[   r   r   r   r   )ry   r   s     rL   r   r     s     xx
##H 2uu	">">	?	?	? 2(##$$	SS
 
 
 2 211111
R
S
SSrN   c                     ddh}|r |                     t          d                    |                    t          |                     d                              S )a  
    Extracts 'extend_keys' from `spec`.

    :param spec: Variants specification
    :type spec: dict
    :param include_defaults: Whether to include default 'extend_keys'
    :type include_defaults: bool, optional
    :return: Standardized 'extend_keys' value
    :rtype: set
    r   r$   )r\   rY   unionr   r[   )ry   include_defaultsr$   s      rL   _get_extend_keysr     sX     }-K <+M:;;;[-)@)@AABBBrN   c                     |t          |           }|t          |           }h d} |                    |          j        |                     |           S )a  
    Keys in `spec` that are not exploded and are simply carried over from the `spec`
    into the variants without modification.

    :param spec: Variants specification
    :type spec: dict
    :param zip_keys: Keys defined as 'zip_keys' (see :func:`_get_zip_keys`)
    :type zip_keys: set, optional
    :param extend_keys: Keys defined as 'extend_keys' (see :func:`_get_extend_keys`)
    :type extend_keys: set, optional
    :return: Passthru (not exploded) keys defined in `spec`
    :rtype: set
    N>   r   r$   replacements)r   r   r   
differenceintersection)ry   r   r$   passthru_keyss       rL   _get_passthru_keysr     sa      &&&t,,???M6={++6ANNtTTTrN   c                 l    |t          | ||          }t          |                               |          S )a  
    Keys in `spec` that are that are exploding into the variants.

    :param spec: Variants specification
    :type spec: dict
    :param passthru_keys: Passthru (not exploded) keys (see :func:`_get_passthru_keys`)
    :type passthru_keys: set, optional
    :param zip_keys: Keys defined as 'zip_keys' (see :func:`_get_zip_keys`) and is passed
                     to :func:`_get_passthru_keys` if `passthru_keys` is undefined
    :type zip_keys: set, optional
    :param extend_keys: Keys defined as 'extend_keys' (see :func:`_get_extend_keys`) and
                        is passed to :func:`_get_passthru_keys` if `passthru_keys` is
                        undefined
    :type extend_keys: set, optional
    :return: Exploded keys defined in `spec`
    :rtype: set
    )r   r   r   )ry   r   r   r$   s       rL   _get_explode_keysr     s5    $ *4;GGt99...rN   c                 N   g }t          |d          r| }n| D ]}|                    |          -|                    |          |v r|                    |           Dt          t                    }|                    d| d| d| d|                    |                      |S )zvariants is the exploded out list of dicts, with one value per key in each dict.
    key and values come from subsequent variants before they are exploded out.r   NzFiltering variant with key z not matching target value(s) (z) from z	, actual )rZ   r[   r   r   r   debug)variantsr   r   source_namereduced_variantsrX   r   s          rL   filter_by_key_valuer     s     vv #   	 	G{{3+C0@0@F0J0J ''0000 **		P# P PP P'2P P=D[[=M=MP P    rN   c                 ,    |                      |          S r   )r   )stringchars     rL   
_split_strr     s    <<rN   c                     t                     }t           |          } fd|D             }t           |          } fd |j        | D             }|                     fd|D                        t          |           g }t          |                                 D ]b}d |                                D             }|                    d t          ||          D                        |
                    |           c|S )a  
    Helper function to explode spec into all of the variants.

    .. code-block:: pycon
        >>> spec = {
        ...     # normal expansions
        ...     "foo": [2.7, 3.7, 3.8],
        ...     # zip_keys are the values that need to be exploded as a set
        ...     "zip_keys": [["bar", "baz"], ["qux", "quux", "quuz"]],
        ...     "bar": [1, 2, 3],
        ...     "baz": [2, 4, 6],
        ...     "qux": [4, 5],
        ...     "quux": [8, 10],
        ...     "quuz": [12, 15],
        ...     # extend_keys are those values which we do not explode
        ...     "extend_keys": ["corge"],
        ...     "corge": 42,
        ... }

        >>> explode_variants(spec)
        [{
            "foo": 2.7,
            "bar": 1, "baz": 2,
            "qux": 4, "quux": 8, "quuz": 12,
            "corge": 42,
            "zip_keys": ..., "extend_keys": ...,
        },
        {
            "foo": 2.7,
            "bar": 1, "baz": 2,
            "qux": 5, "quux": 10, "quuz": 15,
            "corge": 42,
            ...,
        }, ...]

    :param spec: Specification to explode
    :type spec: `dict`
    :return: Exploded specification
    :rtype: `list` of `dict`
    c                 J    i | ]}|         s|         d k    ||          S )r   rH   r   s     rL   rM   z$explode_variants.<locals>.<dictcomp>1  s1    NNNqT!WNQ247rN   c                 R    i | ]#}|fd  t          |                   D             $S )c                 0    g | ]}t          |d           S )F)include_dictr   )rI   r   s     rL   r   z/explode_variants.<locals>.<dictcomp>.<listcomp>6  s%    PPPa{15111PPPrN   r   r   s     rL   rM   z$explode_variants.<locals>.<dictcomp>5  sH        
PP;tAw;O;OPPP  rN   c           	      V    i | ]%}|t          t          fd |D                        &S )c              3   B   K   | ]}t          |                   V  d S r   r   r   s     rL   rt   z.explode_variants.<locals>.<dictcomp>.<genexpr>:  s/      99DG,,999999rN   )r   zipr   s     rL   rM   z$explode_variants.<locals>.<dictcomp>:  s=    OOOT#9999b999:;;OOOrN   c                 4    i | ]\  }}|t          |          S rH   r   r   s      rL   rM   z$explode_variants.<locals>.<dictcomp>C  s$    ;;;$!Q1d1gg;;;rN   c                 F    i | ]\  }}t          ||          D ]\  }}||	S rH   )r  )rI   rx   zvrs   r   s        rL   rM   z$explode_variants.<locals>.<dictcomp>E  s7    MMMfb"RMMAQMMMMrN   )r   r   r   r   r\   r   r   r   rQ   r  r   )	ry   r   r   passthruexplode_keysexploder   r   rX   s	   `        rL   explode_variantsr
    sN   R T""H 'tX66MNNNNMNNNH %T=99L   (((3  G NNOOOOhOOO   G
 H7>>++, ! !;;(..*:*:;;;MMGV 4 4MMM	
 	
 	
 	    OrN   c                    | sdS t                      t                      }d}d| d         v r| d         d         r| d         d         ng }|rt          | d         d         d         t                    s't          | d         d         d         t                    r| d         d         }n| d         d         g}|D ]}|D ]}|                    |           | D ]*}|                                D ]\  }}|dk    rt          |d          r=                    |t                                }	|		                    |           |	|<   Zt          |t                    rCt                              |t                                          t          |          z  |<   t                              |g                     t          |          z   |<   ||vr%t          t          |                             |<   ,|r[|D ]X}t          t          t          t          fd|D                                   }
t          |          D ]\  }}|
|         |<   Y|d<   S )zOpposite of dict_of_lists_to_list_of_dicts function.

    Take broken out collection of variants, and squish it into a dict, where each value is a list.
    Only squishes string/int values; does "update" for dict keys
    Nr   r   r   c              3   (   K   | ]}|         V  d S r   rH   )rI   r   squisheds     rL   rt   z1list_of_dicts_to_dict_of_lists.<locals>.<genexpr>z  s'      (H(H3#(H(H(H(H(H(HrN   )r   r   r   r   r   r{   rQ   rZ   r[   r\   r   r  	enumerate)list_of_dictsall_zip_keysgroupszip_key_groupsr   itemrX   rs   r   existing_valuer   idxr   r  s                @rL   list_of_dicts_to_dict_of_listsr  O  s     }}H55LF q)))mA.>z.J) 	a$$ 
  	'mA&z215t<< 	4
!Z(+UA
 A
 	4 #1%j1FF#A&z23F 	' 	'E ' '  &&&&'  9 9MMOO 	9 	9DAqJq&!! 	9!)a!?!?%%a(((,At$$ 9!(,,q#%%"8"899CFFB"8<<2#6#677+a..HL(("&s8A;'7'7"8"8HQK	9  , 	, 	,E#s3(H(H(H(H%(H(H(H#IJJKLLF%e,, , ,S &s,)HZOrN   c                    t          | d          r| j        }|sddlm}  |            }t          | |          }t	          t          |                    }|D ]}t          ||          ||<   t          |d          r|j        r
|j        |d<   |r||d<   |                                D ]\  }}t          ||           t          ||j                  }||fS )	Nr]   r   )Config)internal_defaultsrX   zconfig.variantargument_variants)r   )rZ   r]   r  r   r   r_   rp   rX   rQ   r   r   verbose)	recipedir_or_metadatar]   r   r  r   r   rm   ry   combined_specs	            rL   get_package_combined_specr    s    $h// .&- """"""3V<<E*=f*E*EFFFE 0 0$Q//a vy!! 1fn 1"(. .%-!";;==  4a "%FNCCCM%rN   c                 r   t          |           }|                                }|d= t          |           } t                      }t	          |                                          D ]Q\  }}|                                D ]7\  }}||vr.||vr*t          | |||          p| } |                    |           8R| S )Nr  )r   )r   r   r
  r   reversedrQ   r   r{   )r  r   r$   	seen_keyssourcesource_specsrs   vss           rL   !filter_combined_spec_to_used_keysr%    s    "=11K JJLLE!" %]33M I ( 7 7 
! 
!!'')) 		! 		!EAr##(:(:
 (q"&QQQ %$  a   		! rN   c                 N    t          | ||          \  }}t          ||          S )N)r]   r   )r   )r  r%  )r  r]   r   r  r   s        rL   get_package_variantsr'    s7    4fx  M5 -]%HHHHrN   Fc           	           h d                     t          t           d                             d                                          fd d         D             }|S )z|For purposes of naming/identifying, provide a way of identifying which variables contribute
    to the matrix dimensionality>   r   r"   r!   r   r$   c                 j    g | ].vr$t          fd dd         D                       ,/S )c              3   H   K   | ]}|         d                   k    V  dS )r   NrH   )rI   rX   rs   r   s     rL   rt   z&get_vars.<locals>.<listcomp>.<genexpr>  s4      LLG71:!Q/LLLLLLrN   r   N)any)rI   rs   	loop_onlyspecial_keysr   s    @rL   r   zget_vars.<locals>.<listcomp>  si       L   ! LLLLLx|LLLLL ! 	
   rN   )r\   r   r   r[   )r   r,  	loop_varsr-  s   `` @rL   get_varsr/    s     FEELK(F(FGGHHIII     !  I rN   c           	      T   t                      }|                                }| D ]~g t          j        d          }|rS|sQ|                    d          dt          j                  z  }                    |           fd|D             }nfd|D             }|st          j                  }d                    t          t          j        	                    d                              }	d|z  }
d	|z  }d
|z   dz   }d|	z  }|r
                    d|           n                    |
||g           d                              t          fd|D                       r2|                               dv rd| v r|                    d           |S )Nz(.*?)_compiler(_version)?$r   z&\{\s*compiler\([\'\"]%s[\"\'][^\{]*?\}c                 $    g | ]}|v s|v 
|S rH   rH   )rI   linecompiler_langr   s     rL   r   z/find_used_variables_in_text.<locals>.<listcomp>  s2       dmt>S>S>S>S>SrN   c                 D    g | ]}|                     d d          v |S )r=   _)replace)rI   r2  r   s     rL   r   z/find_used_variables_in_text.<locals>.<listcomp>  s8       dll36L6L1L1L1L1L1LrN   z[-_]r5  z-\{\s*(?:pin_[a-z]+\(\s*?['\"])?%s[^'\"]*?\}\}z/^[^#\[]*?\#?\s\[[^\]]*?(?<![_\w\d])%s[=\s<>!\]]z(?:^|[^\{])\{%\s*(?:el)?if\s*.*z\s*(?:[^%]*?)?%\}z^\s+\-\s+%s\s*(?:\s[\[#]|$)r   |c              3   B   K   | ]}t          j        |          V  d S r   )research)rI   r2  all_ress     rL   rt   z.find_used_variables_in_text.<locals>.<genexpr>  s/      BBDry$''BBBBBBrN   )
c_compilercxx_compilerCONDA_BUILD_SYSROOT)r   
splitlinesr9  matchr   escaper   r   mapr   insertr   r+  r{   )rX   recipe_textselectors_onlyused_variablesrecipe_linescompiler_matchcompiler_regexvariant_linesv_regexv_req_regexvariant_regexselector_regexconditional_regexrequirement_regexr;  r3  r   s                 @@@rL   find_used_variables_in_textrQ    s   UUN))++L %> %>"?CC 	. 	*0033MFJ J N NN>***    !-  MM   !-  M  	)A,,kk#bi">">??H7RKgU.8;OO 	 ;[H 	RNN1n----NNM+<>OPQQQ))G$$BBBBMBBBBB 	>q!!!222(G33"&&'<===rN   c                 2   t          |          5 }|                                }d d d            n# 1 swxY w Y   t                      }| D ]J}d|z  }t          j        ||t          j        t          j        z            r|                    |           K|S )Nz(^[^$]*?\$\{?\s*%s\s*[\s|\}])flagsrf   rg   r   r9  r:  	MULTILINEDOTALLr{   rX   	file_pathrm   textrF  r   rM  s          rL   #find_used_variables_in_shell_scriptr[    s    	i Avvxx              UUN " "81<9]Dry0HIII 	"q!!!   155c                 8   t          |          5 }|                                }d d d            n# 1 swxY w Y   t                      }| D ]M}d|z   dz   }t          j        ||t          j        t          j        z            r|                    |           N|S )Nz\%rS  rU  rX  s          rL   #find_used_variables_in_batch_scriptr^    s    	i Avvxx              UUN " "	E)9]Dry0HIII 	"q!!!r\  )NNNT)T)NN)NNN)F):__doc__os.pathr   r9  syscollectionsr   r   	functoolsr   	itertoolsr   rh   conda_interfacer	   r
   utilsr   r   r   r   r   versionr   rP   version_infomajorminorr[   rY   rO   rsplit	arch_namer   rU   r_   rp   r   r   r   r   r   r   r   r   r   r   r   r
  dict_of_lists_to_list_of_dictsr  r  r%  r'  r/  rQ  r[  r^  rH   rN   rL   <module>rn     s\  ) )  				 



 # # # # # #                    3 3 3 3 3 3 3 3 K K K K K K K K K K K K K K , , , , , , !'BB#*:*@BB   
c#
2A2
'' (ee5'#66#66  '1   09  J 	
 
 	
 
 	
 
 ' ,    7    D FM#q!!"%	 	 
 4  (	 	 	  4
 4
 4
n. . .d JNl l l l^   >  "T T T0C C C C"U U U U,/ / / /.  ( 4  D D DP "2 / / /d       @  6I I I I   " 4) ) ) )X      rN   