o
    Uh                  	   @   s   d Z 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	 ddl
Z
ddlmZ ddlmZ ddlmZ dejfdd	Z	dd
edee deeef fddZdde	e dee ddfddZedkrmeejdd d dS dS )zInstaller CLI.    N)DictOptionalSequence)SchemeDictionaryDestination)	WheelFile)get_launcher_kindreturnc                  C   sn   t  } | jdtdd | jdddtdd | jd	d
dtdd | jdddtg ddd | jdddd | S )zConstruct the main parser.wheelzwheel file to install)typehelpz	--destdirz-dpathz6destination directory (prefix to prepend to each file))metavarr
   r   z--prefixz-pz&override prefix to install packages toz--compile-bytecodeappendlevel)r         zHgenerate bytecode for the specified optimization level(s) (default=0, 1))actionr   r
   choicesr   z--no-compile-bytecode
store_truez-don't generate bytecode for installed modules)r   r   )argparseArgumentParseradd_argumentstrint)parser r   f/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/installer/__main__.py_get_main_parser   s<   r   distribution_nameprefixc                 C   sd   i }|du rt d}|sJ n
| |d<  |d< }t j|d}tjt jdd|id| |d< |S )zCCalculate the scheme dictionary for the current Python environment.Nbaseplatbase)varsincludeinstalled_baseheaders)	sysconfigget_config_var	get_pathsosr   joinget_path)r   r   r"   r$   scheme_dictr   r   r   _get_scheme_dict1   s   

r-   cli_argsprogramc                 C   s   t  }|r||_|| }|j}|jrg }n|sddg}t|j"}tt	|j
|jdtjt ||jd}t||i  W d   dS 1 sGw   Y  dS )z*Process arguments and perform the install.r   r   )r   )r,   interpreterscript_kindbytecode_optimization_levelsdestdirN)r   prog
parse_argscompile_bytecodeno_compile_bytecoder   openr	   r   r-   distributionr   sys
executabler   r3   	installerinstall)r.   r/   r   argsbytecode_levelssourcedestinationr   r   r   _mainI   s&   
"rB   __main__r   zpython -m installer)N)__doc__r   os.pathr)   r:   r&   typingr   r   r   r<   installer.destinationsr   installer.sourcesr   installer.utilsr   r   r   r   r-   rB   __name__argvr   r   r   r   <module>   s.    #

 