
    wi                       d dl m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 d dl
mZ d dlmZ d dlmZ d dlmZ d dlmZ d d	lmZ d
ZdZej        Zej        Zej        ZddZej        dd            Zej        dd            Z ddZ!dS )     )annotationsN)	Generator)Sequence)	lang_base)
envcontext)PatchesT)Var)Prefix	dotnetenvbinvenvstrreturnr   c                    dt           j                            | t                    t           j        t          d          fffS )NPATH)ospathjoinBIN_DIRpathsepr	   )r   s    k/root/.openclaw/workspace/chatterbox_venv_py311/lib/python3.11/site-packages/pre_commit/languages/dotnet.pyget_env_patchr      s3    	"',,tW--rz3v;;GH     prefixr
   versionGenerator[None]c              #     K   t          j        | t          |          }t          t	          |                    5  d V  d d d            d S # 1 swxY w Y   d S )N)r   environment_dirENVIRONMENT_DIRr   r   )r   r   envdirs      r   in_envr!       s      &vHHF	M&))	*	*                   s   AAAGenerator[str]c               #  $  K   t          j                    5 } t          j                            | d          }t          |d          5 }|                    d           d d d            n# 1 swxY w Y   |V  d d d            d S # 1 swxY w Y   d S )Nznuget.configwzw<?xml version="1.0" encoding="utf-8"?><configuration>  <packageSources>    <clear />  </packageSources></configuration>)tempfileTemporaryDirectoryr   r   r   openwrite)tmpdirnuget_configfs      r   _nuget_config_no_sourcesr,   '   s     		$	&	& &w||FN;;,$$ 	GG#  	 	 	 	 	 	 	 	 	 	 	 	 	 	 	                  s5   1BA)B)A-	-B0A-	1BB	B	additional_dependenciesSequence[str]Nonec                   t          j        d|           t          j        d|           t          j        | t          |          }|                     d          }t          j        | dddddd| f           |                     |          }d t          j        |          D             }|st          d	          |D ]}t          j        t          j                            ||                    5 }d
 |                                D             \  }	|                    |	          5 }
t          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        d|                                j                  }|st          d          |                    d|d          d          }|t          d          |j        }|st          d          t3                      5 }t          j        | dddd|dt          j                            |t4                    d||f
           d d d            n# 1 swxY w Y   d S )Ndotnetzpre-commit-buildpackz--configurationReleasez
--propertyzPackageOutputPath=c                <    g | ]}|                     d           |S )z.nupkgendswith.0xs     r   
<listcomp>z'install_environment.<locals>.<listcomp>M   s)    GGGA!**X2F2FGaGGGr   z+could not find any build outputs to installc              3  D   K   | ]}|                     d           |V  dS )z.nuspecNr5   r7   s     r   	<genexpr>z&install_environment.<locals>.<genexpr>T   s3      HHQ!**Y2G2GHqHHHHHHr   z{.*}z%could not parse namespace from nuspecz.//r   idz expected to find an "id" elementz"id" element missing tool nametoolinstallz--configfilez--tool-pathz--add-source)r   assert_version_defaultassert_no_additional_depsr   r   r   	setup_cmdr   listdirAssertionErrorzipfileZipFiler   namelistr'   xmletreeElementTreeparserematchgetroottagfindtextr,   r   )r   r   r-   r    	build_dir	nupkg_dirnupkgsnupkgr+   nuspecspectree	namespacetool_id_elementtool_idr*   s                   r   install_environmentr\   7   s%   
 $Xw777'2IJJJ&vHHF.//I fy:y::	
   I&&IGGI..GGGF LJKKK  _RW\\)U;;<< 	9HH!**,,HHHGF 94y,224889 9 9 9 9 9 9 9 9 9 9 9 9 9 9	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9
 HWdllnn&899	 	J !HIII))$:)A,$:$:$:;;" !CDDD!& 	C !ABBB &'' 
	<fi"L!27<<#@#@"I	 	 	
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	' sI   46E2*%EE2EE2"E#E22E6	9E6	AII#	&I#	)r   r   r   r   )r   r
   r   r   r   r   )r   r"   )r   r
   r   r   r-   r.   r   r/   )"
__future__r   
contextlibos.pathr   rL   r%   xml.etree.ElementTreerH   rE   collections.abcr   r   
pre_commitr   pre_commit.envcontextr   r   r	   pre_commit.prefixr
   r   r   basic_get_default_versionget_default_versionbasic_health_checkhealth_checkbasic_run_hookrun_hookr   contextmanagerr!   r,   r\    r   r   <module>rm      sn   " " " " " "      				       % % % % % % $ $ $ $ $ $             , , , , , , * * * * * * % % % % % % $ $ $ $ $ $
9 +#           8 8 8 8 8 8r   