U
    8Yc                     @   s^   d dl Z d dlZd dlmZ d dlZddlmZmZ dddZdddZe	d	krZedd
 dS )    N)pprint   )api__version__c                 C   s  t  }|jdddddt d |jddd	d
}|jdddgd}|jddd |jddd |jddd |jdddd |jdddgd}|jddd |jdd d |jd!d"d |jd#d$d |jd%d&d'gd}|jd(d)d |jd*d+t d, |jd-d.d/d0d, |jd1td2d3 |jd4d5d6gd}|jd7d8d |jd9d:d |jd#d$d |jd;dd<d= |jd1td2d3 |jd>d?tt	d@dAdAdB |
| S )CNz-Vz	--versionversionz8Show the conda-package-handling version number and exit.zconda-package-handling )actionhelpr   Zsubcommands
subcommandT)titledestZrequiredextractzextract package contentsx)r   aliasesarchive_pathzpath to archive to extract)r   z--destzdestination folder to extract to.  If not set, defaults to package filename minus extension in the same folder as the input archive. May be relative path used in tandem with the --prefix flag.z--prefixzbase directory to extract to. Use this to set the base directory, while allowing the folder name to be automatically determined by the input filename. An abspath --prefix with an unset --dest will achieve this.z--infozIf the archive supports separate metadata, this flag extracts only the metadata in the info folder from the package.  If the archive does not support separate metadata, this flag has no effect and all files are extracted.
store_true)r   r   createzbundle files into a packagecprefixzfolder of files to bundle.  Not strictly required to have conda package metadata, but if conda package metadata isn't present, you'll see a warning and your file will not work as a conda packageout_fnzFFilename of archive to be created.  Extension determines package type.z--file-listzPath to file containing one relative path per line that should be included in the archive.  If not provided, lists all files in the prefix.z--out-folderzFolder to dump final archive toverifyz.verify converted files against their referencevglobzfilename glob pattern to match pairs and verify.  Usethe --reference-ext argument to change which extension is used as the ground truth, and which is considered corrupt in any mismatchz--target-dirz4folder for finding pairs of files.  Defaults to cwd.)r   defaultz--reference-extz-rzZfile extension to consider as 'ground truth' in comparison.  Use this with the --all flag.z.tar.bz2z--processeszHMax number of processes to use.  If not set, defaults to your CPU count.)typer   	transmutez(convert from one package type to anothertin_filez7existing file to convert from.  Glob patterns accepted.out_extz<extension of file to convert to.  Examples: .tar.bz2, .condaz--forcez Force overwrite existing package)r   r   z--zstd-compression-levelzmWhen building v2 packages, set the compression level used by conda-package-handling. Defaults to the maximum.r      )r   r   choicesr   )argparseArgumentParseradd_argumentr   Zadd_subparsersZ
add_parserosgetcwdintrange
parse_args)Z
parse_thisparserZspZextract_parserZcreate_parserZverify_parserZconvert_parser r)   9lib/python3.8/site-packages/conda_package_handling/cli.pyr'   	   s      	         r'   c              
   C   sH  t | } t| dr>| jr>tjtjtj| jtj | _| j	dkr| j
rhtj| j| jd| jd ntj| j| j| jd n| j	dkrt| j| j| j| j n| j	dkrtj| j| j| j| jpd| jd	d
d| j fd}|rDtd t| td n@| j	dkrDt| j| j| j }|rDtd t| td d S )N
out_folder)r   r   info)Z
componentsr   )r   )r   r   )r   r   r   z.tar.zstZzstdzzstd:compression-level=)forceZcompression_tuplezfailed files:)r   r   )!r'   hasattrr+   r#   pathabspathnormpath
expandusersepr	   r,   r   r   r   r   r   r   Z	file_listr   r   r   r   Z	processesr-   Zzstd_compression_levelprintr   sysexitZverify_conversionr   Z
target_dirZreference_ext)argsZfailed_filesr)   r)   r*   main   sP    
   
  r8   __main__)r7   )N)N)
r    r#   r   r5    r   r   r'   r8   __name__r)   r)   r)   r*   <module>   s   
x
'