
    xhe                    D   d dl 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Zd dl	m
Z
 ddlmZmZ dd	lmZmZmZ dd
lmZmZ ddlmZ ddlmZ ddlmZmZ  ej        e          Z G d dej                  Z d Z!ddZ" ej#        ddd          ddd            Z$dS )    )annotationsN)	Namespace)pprint)Sequence)ParserError   )__version__api)ArgumentParseradd_parser_channelscc_conda_build)get_channel_urlsget_or_merge_config)
deprecated)LoggingContext)get_package_variantsset_language_env_varsc                      e Zd ZddZdS )ParseYAMLArgumentNc           	     |   t          |          dk    rt          d          	 t          j        |d         t          j                  }t          |t                    st          d| d          t          || j        |           d S # t          $ r'}t          d| dt          |                     d }~ww xY w)N   z)This switch requires exactly one argumentr   )LoaderzThe argument of z is not a YAML dictionary.z. is not a valid YAML. The parser error was: 

)lenRuntimeErroryamlload
BaseLoader
isinstancedictsetattrdestr   str)selfparser	namespacevaluesoption_stringmy_dictes          ;lib/python3.11/site-packages/conda_build/cli/main_render.py__call__zParseYAMLArgument.__call__   s    v;;!JKKK	iq	$/BBBGgt,, "P}PPP   Ity'22222 	 	 	j=jjbefgbhbhjj  	s   A$B
 

B;"B66B;N)__name__
__module____qualname__r+        r*   r   r      s(             r1   r   c            	        t          ddd          } |                     ddddd	t          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"d#d$%           |                     d&d'd(%           |                     d)d*dd+           |                     d,d-d.dd/           |                     d0d1d2t          j        d1d3                                          d3k    d45           |                     d6dd7d89           |                     d:d;t          d<=           t          |            | S )>Nzconda rendera  
Tool for expanding the template meta.yml file (containing Jinja syntax and
selectors) into the rendered meta.yml files. The template meta.yml file is
combined with user-specified configurations, static recipe files, and
environment information to generate the rendered meta.yml files.resolve)progdescriptionconflict_handlerz-Vz	--versionversionz-Show the conda-build version number and exit.zconda-build %s)actionhelpr7   z-nz--no-source
store_truezgWhen templating can't be completed, do not obtain the source to try fill in related template variables.r8   r9   z--outputz?Output the conda package filename which would have been createdz--pythonappendz+Set the Python version used by conda build.z--perlz)Set the Perl version used by conda build.z--numpyz*Set the NumPy version used by conda build.z--Rz&Set the R version used by conda build.r_base)r8   r9   r!   z--luaz(Set the Lua version used by conda build.z--bootstrapzProvide initial configuration in addition to recipe.
        Can be a path to or name of an environment, which will be emulated
        in the package.r9   z--append-filezcAppend data in meta.yaml with fields from this file.  Jinja2 is not done
        on appended fieldsappend_sections_file)r9   r!   z--clobber-filezfClobber data in meta.yaml with fields from this file.  Jinja2 is not done
        on clobbered fields.clobber_sections_filez-mz--variant-config-fileszAdditional variant config files to add.  These yaml files can contain
        keys such as `c_compiler` and `target_platform` to form a build matrix.z-ez--exclusive-config-filesz--exclusive-config-filea}  Exclusive variant config files to add. Providing files here disables
        searching in your home directory and in cwd.  The files specified here come at the
        start of the order, as opposed to the end with --variant-config-files.  Any config
        files in recipes and any config files specified with --variant-config-files will
        override values from these files.z--old-build-stringfilename_hashingstore_falsetruezDisable hash additions to filenames to distinguish package variants from one another. NOTE: any filename collisions are yours to handle. Any variants with overlapping names within a build will clobber each other.)r!   r8   defaultr9   z--use-channeldatause_channeldatazxUse channeldata, if available, to determine run_exports. Otherwise packages are downloaded to determine this information)r8   r!   r9   z
--variantsr   zbVariants to extend the build matrix. Must be a valid YAML instance, such as "{python: [3.8, 3.9]}")nargsr8   r9   )r   add_argumentr	   r   getlowerr   r   )ps    r*   get_render_parserrK   ,   s   D
 #	 	 	A NN< ;.     NN3	     NNN    
 NN:    
 NN8    
 NN9    
 NN9	     NN7    
 NN     NN#	     NN $	     NN S	     NN"!-  
 
 
 NN"#5v>>DDFF&P-     NN;     NN -     Hr1   argsSequence[str] | Nonereturn tuple[ArgumentParser, Namespace]c                    t                      }|                    ddd           |                    ddd           |                    d	d
d           ||                    |           fS )Nz-fz--filezSwrite YAML to file, given as argument here.              Overwrites existing files.r>   recipeRECIPE_PATHzPath to recipe directory.)metavarr9   z	--verboser:   z>Enable verbose output from download tools and progress updatesr;   )rK   rG   
parse_args)rL   r$   s     r*   rT   rT      s      F
*     (     M     6$$T****r1   z24.1.1z24.3.0print_resultsintc                   t          |           \  }}t          di |j        }t          |j        ||j                  }ddlm}  ||           t          |           t          |j                  |_
        |j        |_        |j        rd|_        d|_        t          j        |j        ||j        |j                  }|j        r6t'          |          dk    r#t(                              d|j         d           |j        rt-          t.          j        dz             5  t          j        ||	          }t5          d
                    t9          |                               d d d            n# 1 swxY w Y   |j        r*|d         d         }t          j        ||j        d           nt/          j        t.          j                   |D ]\  }}}t5          d           t5          d           t5          d           tA          |!                                           t5          d           t5          d           t5          d           t5          t          j        ||j        d                     dS )N)variantsr   )get_all_replacementsF)configno_download_sourcerX   r   zPMultiple variants rendered. Only one will be written to the file you specified (z).)rZ   
r   T)suppress_outputs)levelz--------------zHash contents:z
----------z
meta.yaml:r,   )"rT   r   __dict__r   rQ   rX   buildrY   r   r   channel_urlsoverride_channelsoutputverbosedebugr
   render	no_sourcefiler   logwarningr   loggingCRITICALget_output_file_pathsprintjoinsortedoutput_yamlbasicConfigINFOr   get_hash_contents)	rL   _parsedrZ   rX   rY   metadata_tuplespathsms	            r*   executer{      s   4  IAv 9999F#FM6FOTTTH,,,,,,"""(###*6?;;F%7F} j!+	  O { 
s?++a//SCI;S S S	
 	
 	

 } JG,q011 	, 	,-ofMMME$))F5MM**+++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, ; 	C#A&AOAv{TBBBB',////& 	J 	JGAq!"###"###"###1&&(())),,,#/!V[4HHHIIII1s   !AE33E7:E7)rL   rM   rN   rO   r,   )rL   rM   rN   rV   )%
__future__r   argparserl   r   r   typingr   r   yaml.parserr    r	   r
   conda_interfacer   r   r   rZ   r   r   deprecationsr   utilsr   rX   r   r   	getLoggerr-   rj   Actionr   rK   rT   argumentr{   r0   r1   r*   <module>r      s   # " " " " "                      # # # # # #         Q Q Q Q Q Q Q Q Q Q : : : : : : : : % % % % % % " " " " " " B B B B B B B Bg!!       &z z zz+ + + +0 Xx993 3 3 3 :93 3 3r1   