o
    Vh                     @  s   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 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 erbd dlmZ d dlmZ G dd deZdS )    )annotations)TYPE_CHECKING)ClassVar)argument)option)Version)InvalidVersionError)Command)PythonRemoveCommand)PoetryRuntimeError)PythonDownloadNotFoundError)PythonInstallationError)PythonInstaller)PoetryPythonPathProvider)Argument)Optionc                	   @  sz   e Zd ZU dZeddgZded< edddd	d
edddd	d
eddddddedddd	d
gZded< dZ	dddZ
dS ) PythonInstallCommandzpython installpythonzThe python version to install.zClassVar[list[Argument]]	argumentscleancz%Clean up installation if check fails.T)flagfree-threadedtz'Use free-threaded version if available.implementationiz-Python implementation to use. (cpython, pypy)Fcpython)r   default	reinstallrz)Reinstall if installation already exists.zClassVar[list[Option]]optionszyInstall the specified Python version from the Python Standalone Builds project. (<warning>experimental feature</warning>)returnintc           
   
   C  sJ  |  d}| d }| d}| d}zt|}W n ttfy3   | jd| d Y dS w |rQ|tdk rQ| jd	 | jd
 | jd	 dS t	|||}z#|
 ry|sy| jdt|| d | jd| d W dS W n ty   | jd Y dS w |}|r|d7 }d| d| d}z| jd| d |  W n- ty }	 z!| jd | jd	 | jt|	 | jd	 W Y d }	~	dS d }	~	ww | jd | jd| d z|
  W n, ty }	 z| jd |j
 r| drtt|j|| j |	d }	~	ww | jd dS )Nr   r   r   r   z+<error>Invalid Python version requested <b>z</></error>   z3.13.0 zFree threading is not supported for Python versions prior to <c1>3.13.0</>.

See https://docs.python.org/3/howto/free-threading-python.html for more information.z'Python version already installed at <b>z</>.
zJUse <c1>--reinstall</> to install anyway, or use <c1>poetry python remove z
</> first.zDNo suitable standalone build found for the requested Python version.z, free-threadedz<c1>z</> (<b>z</>)zDownloading and installing z ... z<fg=red>Failed</>
z<fg=green>Done</>
zTesting r   r   )r   r   lowerr   parse
ValueErrorr   iowrite_error_liner   existsr   installation_dirr   writeinstallr   strr   installation_directoryr
   remove_python_installationversion)
selfrequestimplr   free_threadedr1   	installeradd_inforequest_titlee r:   z/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/poetry/console/commands/python/install.pyhandle6   s   





zPythonInstallCommand.handleN)r!   r"   )__name__
__module____qualname__namer   r   __annotations__r   r    descriptionr<   r:   r:   r:   r;   r      s,   
 r   N)
__future__r   typingr   r   cleo.helpersr   r   'poetry.core.constraints.version.versionr   poetry.core.version.exceptionsr   poetry.console.commands.commandr	   %poetry.console.commands.python.remover
   poetry.console.exceptionsr   !poetry.utils.env.python.installerr   r   r   !poetry.utils.env.python.providersr   cleo.io.inputs.argumentr   cleo.io.inputs.optionr   r   r:   r:   r:   r;   <module>   s$    