
    Ee                        d dl Z d dlZd dlZd dlZd dlmZmZmZmZm	Z	 ddl
mZ  ee      Zd Zdadadadt"         ej$                  d	      fz  adad
 Zd Zd Zd Zd Zd ZddZedk(  r ej:                   e              yy)    N)basenamedirnameexistsjoinrelpath   )__version__c                  8   t        j                  d      } | j                         }|j                  ddd       |j                  ddd       |j                  d	dt         j                         |j                  d
dd       | j                  dddd       | S )z,Configure the given argparse parser instancez"The anaconda-anon-usage installer.)descriptionz--enable
store_truez|Install the anaconda_anon_usage patch. This is used by the pre-install and activate scripts to ensure the package is active.)actionhelpz	--disablezRemove the the anaconda_anon_usage patch. This is used by the pre-unlink script. It is not useful in normal operation; to disable the telemetry, use conda config --set anaconda_anon_usage false.z--expectz--statusz+Print the anaconda_anon_usage patch status.z--quietquietz+Silent mode; disables all non-error output.)destr   r   )argparseArgumentParseradd_mutually_exclusive_groupadd_argumentSUPPRESS)pgs     ;  /croot/anaconda-anon-usage_1710965072196/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/python3.12/site-packages/anaconda_anon_usage/install.pyconfigure_parserr      s    ,PQA	&&(ANNL   NNK   NN:l9J9JNKNN:  
 NN:	   H    Ts   anaconda_anon_usagesp  
# %s %s
# The following code hooks anaconda-anon-usage into the conda
# context system. It augments the request header data that conda
# delivers to package servers during index and package
# requests without revealing personally identifying information.
#
# More information about anaconda-anon-usage can be found on:
# https://github.com/Anaconda-Platform/anaconda-anon-usage

try:
    from anaconda_anon_usage import patch
    patch.main()
except Exception as exc:
    import os, sys
    print("Error loading anaconda_anon_usage:", exc, file=sys.stderr)
    if os.environ.get('ANACONDA_ANON_USAGE_RAISE'):
        raise
zutf-8c                  H    t         t        j                         d   a t         S )Npurelib)__sp_dir	sysconfig	get_paths r   r   _sp_dirr!   U   s     &&(3Or   c                 F    d| v }|d|v k7  r|rdnd} |j                   | }|S )N   
)   
r#   )r#   r$   )replace)textptextwineolargss       r   	_eolmatchr*   \   s8    _F'U"##)/?t$Lr   c                     t        |       syt        | d      5 }|j                         }d d d        t        |      }|j	                  |      rd}||fS ||v rd}||fS d}||fS # 1 sw Y   <xY w)N)NNOT PRESENTrbENABLEDNEEDS UPDATEDISABLED)r   openreadr*   endswith)pfile
patch_text
patch_namefpr&   statuss         r   _readr9   d   s    %="	eT	 bwwy4,J}}Z 
 <	 
t	 < < s   A%%A.c                 B    | j                  d|z         }|dk\  r| d | } | S )Ns   # r   )find)r&   r6   ndxs      r   _stripr=   s   s,    
))EJ&
'C
axDSzKr   c                 r   t         r t        dt        |t                             t	        |||      \  }}t         rt        d|        | j
                  r%|dk7  r t        d       t        j                  d       |dk(  ry |dk(  rd}| j                  rd	nd
}n4|dk(  rd}d	}n*| j                  r|dk(  }d}n| j                  r|dk(  }d	}nd}|sy t         rt        d| dd       d}	 t        ||      }t        |dz   d      5 }|j                  |       |d	k7  rt        ||      }|j                  |       d d d        |dz   }	t        |	      rt        j                   |	       t        j"                  ||	       d}t        j"                  |dz   |       t         rt        d       t	        |||      \  }}t         rt        d|        y y # 1 sw Y   xY w# t$        $ rR}
t         rd}ndt        |t                      }t        | d|
        |rt        j"                  	|       Y d }
~
d }
~
ww xY w)Nzpatch target: ...z
| status: r.   z exiting due to unexpected statusr,   r/   TremovingupdatingzNEEDS REMOVALr0   applyingFz| z	 patch... )endz.newwbz.origsuccessfailedzfailed to patch z: z| new status: )verboseprintr   r!   r9   expectsysexitdisableenabler=   r1   writer*   r   osunlinkrename	Exception)r)   r4   r5   r6   r&   r8   need_changerenamedr7   
pfile_origexcwhats               r   _patchrY   z   s   !'%";!<=>
J7LD&
6(#${{v*01	>	!#||	?	"	
*		)6()$"-G)dJ' %&.$' 	%2HHTN#&tZ8
$		%
 W_
*IIj!
		%$
		%&.%() 
J7LD&vh'( -	% 	%  )D%geWY&?%@ADbIIj%()s2   +G 4G:A/G GG 	H6$AH11H6c                     t         rt        dt        j                         t	        t               ddd      }t        | |t        t               y )Nzconda prefix:condabasez
context.py)	rH   rI   rK   prefixr   r!   rY   
PATCH_TEXT
PATCH_NAME)r)   r4   s     r   manage_patchr`      s5     oszz*GV\:E
4
J/r   c                    t               }| dt        j                  d<   |j                  |       } | j                  r| j
                  sdat        r|t        t        t                    }|dz   }t        |       dt        |      z  }t        |       t        t        j                        dk  rdt        j                  d<   t        |       yt        |        t        rt               y)Nzanaconda-anon-usager   Fz
 installer-r   )r   rK   argv
parse_argsr   r8   rH   r   r   __file__rI   lenr`   )r)   r   pkg_namemsgs       r   mainri      s     	A|+<<Dzz$++GH-.%c
CHnc
sxx=A/CHHQK#Jc
r   __main__)N)r   rP   rK   r   os.pathr   r   r   r   r   rC   r	   re   THIS_DIRr   rF   rH   r_   encoder^   r   r!   r*   r9   r=   rY   r`   ri   __name__rL   r    r   r   <module>ro      s     	 
  < < 8B 
 $
& Kw%
. :)z0: zCHHTV r   