
    .Phh                        d dl mZ d dl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mZ d	dlmZ d	dlmZ  ej        e          Z G d de          ZdgZdS )    )annotationsN)copy)handle_store_python)
PythonInfo)ProcessCallFailedError)
ensure_dir)run_cmd   )ViaGlobalRefApiViaGlobalRefMeta)CPython3macOsBrew)Pypy3Windowsc                  r     e Zd Zd fdZ fdZed             Z fdZd Zd Z	d	 Z
d
 Z fdZd Z xZS )VenvreturnNonec                    |j         | _         t                                          ||           t          j                    }||u o|j        |j        k    | _        d | _        d S N)	describesuper__init__r   current
executablesystem_executablecan_be_inline_context)selfoptionsinterpreterr   	__class__s       e/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/virtualenv/create/via_global_ref/venv.pyr   zVenv.__init__   s^    (+...$&&(G3o8NR]Ro8o    c                    t                                                      | j        rd| j        j        j        fgng z   S )Nr   )r   _argsr   r    __name__)r   r    s    r!   r$   z
Venv._args   s9    ww}}VZVc"kJ0G0P#Q"R"Rikllr"   c                    |j         rSt          j        |          rt          j        |          S t	                      }|j        dk    rt          ||          }|S d S )Nwin32)has_venvr   can_describe
setup_metar   platformr   )clsr   metas      r!   
can_createzVenv.can_create   sd     	 -k:: A(3K@@@#%%D#w..*4==Ktr"   c                   | j         r|                                  n|                                  | j        D ]}t	          |           t                                                       |                                  d S r   )r   create_inlinecreate_via_sub_processlibsr   r   create!executables_for_win_pypy_less_v37)r   libr    s     r!   r3   zVenv.create)   s     	*    '')))9 	 	CsOOOO..00000r"   c                    | j         }t          |t                    r?|j        r:|                    | j                  D ]!}|                    || j                   dS dS dS )z
        PyPy <= 3.6 (v7.3.3) for Windows contains only pypy3.exe and pypy3w.exe
        Venv does not handle non-existing exe sources, e.g. python.exe, so this
        patch does it.
        N)r   
isinstancer   less_v37executablesr   runsymlinks)r   creatorexes      r!   r4   z&Venv.executables_for_win_pypy_less_v373   s~     -g|,, 	01A 	0**4+;<< 0 0////	0 	0 	0 	00 0r"   c                    ddl m}  || j        d| j        d          }|                    t          | j                             d S )Nr   )
EnvBuilderF)system_site_packagesclearr;   with_pip)venvr?   enable_system_site_packager;   r3   strdest)r   r?   builders      r!   r0   zVenv.create_inline>   s]    ######*!%!@]	
 
 
 	s49~~&&&&&r"   c                    |                                  }t                              dd                    |                     t	          |          \  }}}|dk    rt          ||||          d S )Nz)using host built-in venv to create via %s r   )get_host_create_cmdLOGGERinfojoinr	   r   )r   cmdcodeouterrs        r!   r1   zVenv.create_via_sub_processI   sg    &&((?#OOO c3199(sC=== 9r"   c                    | j         j        dddg}| j        r|                    d           |                    | j        rdndt          | j                  f           |S )Nz-mrC   z--without-pipz--system-site-packagesz
--symlinksz--copies)r   r   rD   appendextendr;   rE   rF   )r   rN   s     r!   rJ   zVenv.get_host_create_cmdP   sc    14Q* 	1JJ/000

DMALLz3ty>>RSSS
r"   c                    t          | j                                                  }t                                                       | j                            |           d S r   )r   	pyenv_cfgrefreshr   set_pyenv_cfgupdate)r   venv_contentr    s     r!   rX   zVenv.set_pyenv_cfgW   sP    DN224455l+++++r"   c                    t                               | d          }|7t          ||          r't          ||          }t	          |          r|dk    r|S t                               | |          S )Nr   script)object__getattribute__hasattrgetattrcallable)r   itemr   elements       r!   r^   zVenv.__getattribute__]   sp    **4<<GHd$;$;h--GG$$ (8(8&&tT222r"   )r   r   )r%   
__module____qualname__r   r$   classmethodr.   r3   r4   r0   r1   rJ   rX   r^   __classcell__)r    s   @r!   r   r      s             m m m m m   [1 1 1 1 1	0 	0 	0	' 	' 	'> > >  , , , , ,3 3 3 3 3 3 3r"   r   )
__future__r   loggingr   &virtualenv.create.via_global_ref.storer   virtualenv.discovery.py_infor   virtualenv.util.errorr   virtualenv.util.pathr   virtualenv.util.subprocessr	   apir   r   builtin.cpython.mac_osr   builtin.pypy.pypy3r   	getLoggerr%   rK   r   __all__ r"   r!   <module>ru      s   " " " " " "        F F F F F F 3 3 3 3 3 3 8 8 8 8 8 8 + + + + + + . . . . . . 2 2 2 2 2 2 2 2 5 5 5 5 5 5 , , , , , ,		8	$	$P3 P3 P3 P3 P3? P3 P3 P3h r"   