
    e`"                         d dl mZmZ d dlZd dlZd dlZddlmZ ddlm	Z	m
Z
mZ  G d dej                  Zd Z e            Zd	 Zde	fd
Zedk    r e             dS dS )    )print_functionabsolute_importN   )__version__)packCondaPackExceptioncontextc                   (     e Zd Zd fd	ZddZ xZS )MultiAppendActionNc                 n    |t          d           t          t          |           j        ||fi | d S )Nznargs not allowed)
ValueErrorsuperr   __init__)selfoption_stringsdestnargskwargs	__class__s        .lib/python3.11/site-packages/conda_pack/cli.pyr   zMultiAppendAction.__init__   sF    0111/&&/OOOOOOO    c                     t          || j                  t          || j        g            t          || j                                      |                    d          |f           d S )N-)getattrr   setattrappendstrip)r   parser	namespacevaluesoption_strings        r   __call__zMultiAppendAction.__call__   sa    9di((0Ity"---	49%%,,m.A.A#.F.F-OPPPPPr   )N)__name__
__module____qualname__r   r"   __classcell__)r   s   @r   r   r      s_        P P P P P P
Q Q Q Q Q Q Q Qr   r   c                     d} t          d| d          }t          j        dk    rd|d<   t          j        dOi |}|                    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#g d$d%d&'           |                    d(d)t          d*d+,           |                    d-d.d/t          d0d1,           |                    d2d3d45           |                    d6d3d75           |                    d8d3d95           |                    d:d3d;5           |                    d<t          d=d>d?@           |                    dAt          d=d>dB@           |                    dCdDd3dE5           |                    dFdGd3dH5           |                    dIdJdKdL5           |                    dMd3dN5           |S )PNz;Package an existing conda environment into an archive file.z
conda-packF)progdescriptionadd_help)      allow_abbrevz--namez-nENVz~The name of the environment to pack. If neither --name nor --prefix are supplied, the current activated environment is packed.)metavarhelpz--prefixz-pPATHzTThe path to the environment to pack. Only one of --name/--prefix should be supplied.z--outputz-ozrThe path of the output file. Defaults to the environment name with a ``.tar.gz`` suffix (e.g.  ``my_env.tar.gz``).z	--arcroot zJThe relative path in the archive to the conda environment. Defaults to ''.)r/   defaultr0   z--dest-prefixz-da%  If present, prefixes will be rewritten to this path before packaging. In this case the `conda-unpack` script will not be generated. This option should not be used with parcels, which instead generate their destination prefix from the --parcel-root, --parcel-name, and --parcel-version options.z--parcel-rootz{(Parcels only) The location where all parcels are unpacked on the target Hadoop cluster (default: '/opt/cloudera/parcels').)r3   r0   z--parcel-namez(Parcels only) The name of the parcel, without a version suffix. The default value is the local environment name. The parcel name may not have any hyphens.z--parcel-versionzu(Parcels only) The version number for the parcel. The default value is the current date, using the format YYYY.MM.DD.z--parcel-distrozt(Parcels only) The distribution type for the parcel. The default value is 'el7'. This value cannot have any hyphens.z--format)inferzipztar.gztgzztar.bz2tbz2tarparcelr4   zUThe archival format to use. By default this is inferred by the output file extension.)choicesr3   r0   z--compress-levelLEVEL   zThe compression level to use, from 0 to 9. Higher numbers decrease output file size at the expense of compression time. Ignored for ``format='zip'``. Default is 4.)r/   typer3   r0   z--n-threadsz-jNr   zThe number of threads to use. Set to -1 to use the number of cpus on this machine. If a file format doesn't support threaded packaging, this option will be ignored. Default is 1.z--zip-symlinks
store_truea  Symbolic links aren't supported by the Zip standard, but are supported by *many* common Zip implementations. If set, store symbolic links in the archive, instead of the file referred to by the link. This can avoid storing multiple copies of the same files. *Note that the resulting archive may silently fail on decompression if the ``unzip`` implementation doesn't support symlinks*. Ignored if format isn't ``zip``.)actionr0   z--no-zip-64zDisable ZIP64 extensions.z--ignore-editable-packagesz#Skips checks for editable packages.z--ignore-missing-filesz&Skip checks for missing package files.z	--excludePATTERNfiltersz#Exclude files matching this pattern)r@   r/   r   r0   z	--includez+Re-add excluded files matching this patternz--forcez-fz2Overwrite any existing archive at the output path.z--quietz-qzDo not report progressz--helpz-hr0   z Show this help message then exitz	--versionzShow version then exit )dictsysversion_infoargparseArgumentParseradd_argumentintr   )r)   r   r   s      r   build_parserrK      s6   OK|) " " "F 6!!!&~$..v..F
$ %G  H H H
 
D &J  K K K 
D &;  = = =
  &=  ? ? ?  &:  < < < [  \ \ \ 9  : : : *DR  S S S )4V  W W W 
!: !: !: 'G	  I I I * '  !@	  B B B t #  !F	  H H H (+	/  1 1 1 +8  : : : 4+B  D D D 0+E  G G G 0 )&B	  D D D
 0 )&J	  L L L
 	4+Q  S S S 	4+5  7 7 7 $v?  A A A
+5  7 7 7 Mr   c                 d    t          | t          j                   t          j        d           d S )N)filer   )printrE   stderrexit)msgs    r   failrR      s(    	#CJHQKKKKKr   c                 >   t                               |           } | j        r+t          dt          z             t          j        d           	 t          j                    5   |di d| j	        d| j
        d| j        d| j        d| j        d	| j        d
| j        d| j        d| j         d| j        d| j        d| j        d| j        d| j        d| j        d| j         d| j        d| j        d| j         d d d            n# 1 swxY w Y   nn# t8          $ r}t;          d|z             Y d }~nMd }~wt<          $ r t;          d           Y n/t>          $ r# t;          tA          j!                               Y nw xY wt          j        d           d S )N)argszconda-pack %sr   nameprefixoutputformatforcecompress_level	n_threadszip_symlinkszip_64arcrootdest_prefixparcel_rootparcel_nameparcel_versionparcel_distroverboserB   ignore_editable_packagesignore_missing_fileszCondaPackError: %sInterruptedrC   )"PARSER
parse_argsversionrN   r   rE   rP   r	   set_clirU   rV   rW   rX   rY   rZ   r[   r\   	no_zip_64r^   r_   r`   ra   rb   rc   quietrB   re   rf   r   rR   KeyboardInterrupt	Exception	traceback
format_exc)rT   r   es      r   mainrs      s   $''D | o+,,,%_ 	A 	AD A A Adii AAA A zz	A
 !% 3 3A  >>A #//A !N**A A "--A "--A "--A !% 3 3A  $11A "ZA  !A" +/*G*G#A$ '+&?&?%A A	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A(  ' ' '!A%&&&&&&&&   ] % % %Y!##$$$$$%HQKKKKKsI   D "B!DD DD DD 
F%D<<F)FF__main__)
__future__r   r   rG   rE   rp   r2   r   corer   r   r	   Actionr   rK   rh   rR   rs   r#   rC   r   r   <module>rx      s   6 6 6 6 6 6 6 6  



           3 3 3 3 3 3 3 3 3 3	Q 	Q 	Q 	Q 	Q 	Q 	Q 	Qp p ph 
  
  # # # #L zDFFFFF r   