Your IP : 3.144.119.149


Current Path : /opt/alt/python312/lib64/python3.12/venv/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/venv/__pycache__/__init__.cpython-312.opt-1.pyc

�

�Q�f�c��*�dZddlZddlZddlZddlZddlZddlZddlZdZeje
�ZGd�d�Z		dd�Z
d
d�Ze
dk(rd	Z	e�dZej(e�yy#e$r!Zed
ezej&��YdZ[�5dZ[wwxYw)z�
Virtual environment (venv) package for Python. Based on PEP 405.

Copyright (C) 2011-2014 Vinay Sajip.
Licensed to the PSF under a contributor agreement.
�N)�pipc��eZdZdZ			dd�Zd�Zd�Zd�Zed��Z	d�Z
d	�Zejd
k7rdd�Zndd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�
EnvBuildera�
    This class exists to allow virtual environment creation to be
    customized. The constructor parameters determine the builder's
    behaviour when called upon to create a virtual environment.

    By default, the builder makes the system (global) site-packages dir
    *un*available to the created environment.

    If invoked using the Python -m option, the default is to use copying
    on Windows platforms but symlinks elsewhere. If instantiated some
    other way, the default is to *not* use symlinks.

    :param system_site_packages: If True, the system (global) site-packages
                                 dir is available to created environments.
    :param clear: If True, delete the contents of the environment directory if
                  it already exists, before environment creation.
    :param symlinks: If True, attempt to symlink rather than copy files into
                     virtual environment.
    :param upgrade: If True, upgrade an existing virtual environment.
    :param with_pip: If True, ensure pip is installed in the virtual
                     environment
    :param prompt: Alternative terminal prefix for the environment.
    :param upgrade_deps: Update the base venv modules to the latest on PyPI
    Nc���||_||_||_||_||_||_|dk(r1tjjt
j��}||_
||_y)N�.)�system_site_packages�clear�symlinks�upgrade�with_pip�orig_prompt�os�path�basename�getcwd�prompt�upgrade_deps)�selfrr	r
rrrrs        �4/opt/alt/python312/lib64/python3.12/venv/__init__.py�__init__zEnvBuilder.__init__.s`��%9��!���
� ��
���� ��
�!����S�=��W�W�%�%�b�i�i�k�2�F����(���c���tjj|�}|j|�}|j}d|_|j|�|j
|�|jr|j|�|js"|j|�|j|�|rd|_|j|�|jr|j|�yy)z�
        Create a virtual environment in a directory.

        :param env_dir: The target directory to create an environment in.

        FTN)rr�abspath�ensure_directoriesr�create_configuration�setup_pythonr�
_setup_pipr�
setup_scripts�
post_setupr�upgrade_dependencies)r�env_dir�context�true_system_site_packagess    r�createzEnvBuilder.create<s����'�'�/�/�'�*���)�)�'�2��%)�$=�$=�!�$)��!��!�!�'�*����'�"��=�=��O�O�G�$��|�|����w�'��O�O�G�$�$�)-�D�%��%�%�g�.�����%�%�g�.�rc��tj|�D]�}tjj||�}tjj	|�stjj|�rtj|��wtjj|�s��tj|���y�N)
r�listdirr�join�islink�isfile�remove�isdir�shutil�rmtree)rr�fns   r�clear_directoryzEnvBuilder.clear_directoryXso���*�*�T�"�B������d�B�'�B��w�w�~�~�b�!�R�W�W�^�^�B�%7��	�	�"�
������r�"��
�
�b�!�#rc�@�||||d�}tj|d|��S)N)�base�platbase�installed_base�installed_platbase�venv)�scheme�vars)�	sysconfig�get_path)rr!�namer8s    r�
_venv_pathzEnvBuilder._venv_path`s,����%�")�	
���!�!�$�v�D�A�Arc��tjdk(r�tjj	|�tjj	|�k(ryddl}	|j
tj|��}	|j
tj|��}tjj	|�tjj	|�k(ryy||k(S#t$rY�vwxYw#t$rY�`wxYw)z�Check whether two paths appear the same.

        Whether they refer to the same file is irrelevant; we're testing for
        whether a human reader would look at the path string and easily tell
        that they're the same file.
        �win32TrNF)	�sys�platformrr�normcase�_winapi�GetLongPathName�fsdecode�OSError)�cls�path1�path2rBs    r�
_same_pathzEnvBuilder._same_pathis����<�<�7�"��w�w����&�"�'�'�*:�*:�5�*A�A���
��/�/����E�0B�C��
��/�/����E�0B�C���w�w����&�"�'�'�*:�*:�5�*A�A����E�>�!���
��
���
��
�s$�$C(�>$C7�(	C4�3C4�7	D�Dc�x�d�}tjtj|�vr td|�dtj�d���tjj|�r|jr|j|�tj�}||_
tjj|�d|_|j�|jn|j}d|z|_
||�tj}|std��tjjtjj!|��\}}||_||_||_|j)|d�}|j)|d	�}	|j)|d
�}
|	|_||	�|
|_||
�tj.dkDr{tj0dk(rhtj2d
k7rUtjj5|d�}tjj|�stj6d|�||_tjj;||�|_tjj5||�|_||�|j>|_ tj2dk(rmtjjC|j>�}|jE||j>�s(tFjId|j>|�||_ |S)z�
        Create the directories for the environment.

        Returns a context object which holds paths in the environment,
        for use by subsequent logic.
        c��tjj|�stj|�ytjj	|�stjj|�rt
d|z��y)NzUnable to create directory %r)rr�exists�makedirsr)r*�
ValueError)�ds r�create_if_neededz7EnvBuilder.ensure_directories.<locals>.create_if_needed�sR���7�7�>�>�!�$����A��������"�b�g�g�n�n�Q�&7� �!@�1�!D�E�E�'8rzRefusing to create a venv in z( because it contains the PATH separator r�z(%s) z�Unable to determine path to the running Python interpreter. Provide an explicit path or check that your PATH environment variable is correctly set.�scripts�include�purelibl�posix�darwin�lib64�libr>z�Actual environment location may have moved due to redirects, links or junctions.
  Requested location: "%s"
  Actual location:    "%s")%r�pathsep�fspathrNrrLr	r0�types�SimpleNamespacer!�split�env_namerr?�_base_executabler�
executable�
python_dir�
python_exer<�inc_path�lib_path�maxsizer;r@r(�symlink�bin_path�relpath�bin_name�env_exe�env_exec_cmd�realpathrI�logger�warning)
rr!rPr"rr`�dirname�exename�binpath�incpath�libpath�	link_path�real_env_exes
             rrzEnvBuilder.ensure_directories�s~��	F��:�:����7�+�+��<�W�I�F?�?A�z�z�l�!�M�N�
N�
�7�7�>�>�'�"�t�z�z�� � ��)��'�'�)��!����7�7�=�=��1�!�4��� $��� 7����W�=M�=M�� �6�)�����!��)�)�
���.�/�
/��7�7�=�=�������)D�E����'���$���$����/�/�'�9�5���/�/�'�9�5���/�/�'�9�5��"�����!�"�����!�
�[�[�5�
 �r�w�w�'�'9�
�\�\�X�
%������W�g�6�I��7�7�>�>�)�,��
�
�5�)�,�"����7�7�?�?�7�G�<����'�'�,�,�w��8�����!� '������<�<�7�"��7�7�+�+�G�O�O�<�L��?�?�<����A���� <� '����	>�
(4��$��rc��tjj|jd�x|_}t|dd��5}|j
d|jz�|jrd}nd}|j
d|z�|j
d	tjd
dz�|j�|j
d|j�d
��|j
dtjjtj�z�g}tjdk(}|r|jr|j!d�|s|js|j!d�|j"s|j!d�|jr|j!d�|j$r|j!d�|j&r|j!d�|j(r|j!d�|j*�|j!d|j*�d��|j!|j�dj|�}|j
dtj�d|�d
��d
d
d
�y
#1swYy
xYw)aA
        Create a configuration file indicating where the environment's Python
        was copied from, and whether the system site-packages should be made
        available in the environment.

        :param context: The information for the environment creation request
                        being processed.
        z
pyvenv.cfg�w�utf-8)�encodingz
home = %s
�true�falsez"include-system-site-packages = %s
zversion = %d.%d.%d
N�z	prompt = �
zexecutable = %s
�nt�
--symlinks�--copies�
--without-pip�--system-site-packages�--clear�	--upgrade�--upgrade-depsz
--prompt="�"� z
command = z	 -m venv )rrr(r!�cfg_path�open�writerarr?�version_inforrlr`r;r
�appendrr	rrr
)rr"r�f�incl�argsr~s       rrzEnvBuilder.create_configuration�s���#%�'�'�,�,�w����"M�M���4�
�$��g�
.�!�
�G�G�M�G�$6�$6�6�7��(�(�����
�G�G�9�D�@�A�
�G�G�*�S�-=�-=�b�q�-A�A�B��{�{�&����)�D�K�K�?�"�5�6�
�G�G�'�"�'�'�*:�*:�3�>�>�*J�J�K��D����D��B��d�m�m����L�)��d�m�m����J�'��=�=����O�,��(�(����4�5��z�z����I�&��|�|����K�(�� � ����,�-����+����j��)9�)9�(:�!�<�=��K�K����(��8�8�D�>�D�
�G�G�j���� 0�	�$��r�B�C�A/�
.�
.�s
�H4I=�=Jr~c�|�|j}|sl	tjj|�sL|r4tjtjj|�|�ntj||�|rtj||�yy#t$rtjd||�d}Y�>wxYw)�Y
            Try symlinking a file, and if that fails, fall back to copying.
            �Unable to symlink %r to %rTN)r
rrr)rfr�	Exceptionrmrnr-�copyfile)r�src�dst�relative_symlinks_ok�
force_copys     r�symlink_or_copyzEnvBuilder.symlink_or_copy�s���"�]�]�*�J��	&��7�7�>�>�#�.�/��J�J�r�w�w�'7�'7��'<�c�B��J�J�s�C�0������S�)���!�&��N�N�#?��c�J�!%�J�&�s�A+B�"B;�:B;c��tjj|�xr tjj|�}|jro|smtjj|�sN	|r4tjtjj|�|�ytj||�ytjjtjj|��\}}tjjtjjt�dd||z�}tj �stjj#|�sk|j%d�r
d|z}|dd}|dk(rd}n|d	k(rd
}tjjtjj|�||z�}n|}tjj|�s|stjd|�yt'j(||�y#t$rtjd||�Y���wxYw)r�Nr�rRr~�_d����python�venvlauncher�pythonw�
venvwlauncherzUnable to copy %r)rr�lexistsrLr
r)rfrr�rmrn�splitextr(ro�__file__r9�is_python_buildr*�endswithr-r�)rr�r�r��bad_srcr�ext�srcfns        rr�zEnvBuilder.symlink_or_copy	s����g�g�o�o�c�*�F�2�7�7�>�>�#�3F�/F�G��}�}�W�R�W�W�^�^�C�5H�K�+��
�
�2�7�7�#3�#3�C�#8�#�>���
�
�3��,���G�G�,�,�R�W�W�-=�-=�c�-B�C�M�H�c��G�G�L�L�������!:�!*�!%�!)�C��1�E��(�(�*�"�'�'�.�.��2G��$�$�T�*���*�C�'���}�H��x�'�-�H���*�.�H��g�g�l�l�2�7�7�?�?�3�#7��C��H�����7�7�>�>�#�&���N�N�#6��<���O�O�C��%��9!�K��N�N�#?��c�J�K�s�05H1�&H1�1 I�Ic��|j}|j}|j}|j}tj
dk7r�||j|�tjj|�st	j|d�dddtjd��fD]�}tjj||�}tjj|�r�C||j|d��tjj|�r�xt	j|d���y|jr�t	j|�D�cgc]E}tjj!tjj#|�d�d	vr|��G}}t%j&�r||D�cgc]2}tjj!|�j)d
�r|��4}}n>hd�}tjj+|j�}	|j-|	�|D]i}tjj||�}
tjj/|
�s�C||
tjj||���kt%j&��rt	j0|j�D]�\}}}
d|
vs�tjj+|�}tjj|j2d
|�}tjj|�st	j4|�tjj|d�}
tjj|d�}t7j8|
|�yyycc}wcc}w)z�
        Set up a Python executable in the environment.

        :param context: The information for the environment creation request
                        being processed.
        r~i�r��python3zpython3.rQT)r�)�.exez.dll)r��	vcruntime>�
python.exe�pythonw.exe�python_d.exe�
pythonw_d.exezinit.tcl�LibN)rgrjr�rarr;r`rr)�chmodr?r�r(rLr
r'rAr�r9r��
startswithr�addr��walkr!rMr-r�)rr"rqr�copierro�suffixr��suffixes�base_exer��root�dirs�files�tcldirr�s                rrzEnvBuilder.setup_python4s����"�"�������%�%���$�$��
�7�7�d�?��7�%�%�t�,��7�7�>�>�$�'�����u�%�#�Y�(�3�;K�;K�A�;N�:O�0P�Q���w�w�|�|�G�V�4���w�w�~�~�d�+��7�?�?�D�t�L��7�7�>�>�$�/�����u�-�R��}�}� "�z�z�'�2��2�!��G�G�$�$�R�W�W�%5�%5�a�%8��%;�<�@P�P��2����,�,�.�#+� �#+�a����(�(��+�6�6�7N�O��8�� �
Z���7�7�+�+�G�O�O�<�����X�&�"���g�g�l�l�7�F�3���7�7�?�?�3�'��3������W�f� =�>�#�
�(�(�*�)+����1C�1C�)D�%�D�$��!�U�*�!#���!1�!1�$�!7��!#�����g�o�o�u�f�!M��!�w�w�~�~�f�5��K�K��/� �g�g�l�l�4��<�� �g�g�l�l�6�:�>������S�1��*E�+��'��
 s
�A
N<�=7Oc�6�|jg|�}tjj�x|d<}|j|d<|jdd�|jdd�|j|d<|j|d<t
j|fi|��y)z8Executes the newly created Python using safe-ish options�env�VIRTUAL_ENV�
PYTHONHOMEN�
PYTHONPATH�cwdr`)rkr�environ�copyr!�pop�
subprocess�check_output)rr"�py_args�kwargsr�r�s      r�_call_new_pythonzEnvBuilder._call_new_pythonqs����$�$�/�w�/�� �j�j�o�o�/�/��u�
��$�_�_��M������d�#�����d�#�����u�
�&�3�3��|������/��/rc�N�|j|ddddtj��y)z1Installs or upgrades pip in a virtual environment�-m�	ensurepipr�z
--default-pip)�stderrN)r�r��STDOUT�rr"s  rrzEnvBuilder._setup_pip�s)�����g�t�[�+�-�j�6G�6G�	�	Irc���tjjtjjt��}tjj|d�}|j
||�y)a�
        Set up scripts into the created environment from a directory.

        This method installs the default scripts into the environment
        being created. You can prevent the default installation by overriding
        this method if you really need to, or if you need to specify
        a different location for the scripts to install. By default, the
        'scripts' directory in the venv package is used as the source of
        scripts to install.
        rRN)rrrror�r(�install_scripts)rr"rs   rrzEnvBuilder.setup_scripts�sG���w�w���r�w�w���x�8�9���w�w�|�|�D�)�,�����W�d�+rc��y)a
        Hook for post-setup modification of the venv. Subclasses may install
        additional packages or scripts here, add activation shell scripts, etc.

        :param context: The information for the environment creation request
                        being processed.
        N�r�s  rrzEnvBuilder.post_setup�s��	
rc��|jd|j�}|jd|j�}|jd|j�}|jd|j�}|jd|j
�}|S)ai
        Replace variable placeholders in script text with context-specific
        variables.

        Return the text passed in , but with variables replaced.

        :param text: The text in which to replace placeholder variables.
        :param context: The information for the environment creation request
                        being processed.
        �__VENV_DIR__�
__VENV_NAME__�__VENV_PROMPT__�__VENV_BIN_NAME__�__VENV_PYTHON__)�replacer!r^rrirj)r�textr"s   r�replace_variableszEnvBuilder.replace_variables�st���|�|�N�G�O�O�<���|�|�O�W�-=�-=�>���|�|�-�w�~�~�>���|�|�/��1A�1A�B���|�|�-�w���?���rc��|j}t|�}tj|�D�]�\}}}||k(r1|ddD](}|dtjfvs�|j|��*�>|D�]�}	tjdk(r#|	j
d�r|	jd�r�:tjj||	�}
||djtj�dd}|s|}n tjj|g|���}tjj|�stj|�tjj||	�}
t|
d�5}	|	j�}ddd�|
jd�s5	j!d�}|j#||�}|j%d�}���gt|
d
�5}	|	j-|�ddd�t/j0|
|
�������y#1swY��xYw#t&$r#}d}t(j+d	|
|�Yd}~�zd}~wwxYw#1swY�axYw)as
        Install scripts into the created environment from a directory.

        :param context: The information for the environment creation request
                        being processed.
        :param path:    Absolute pathname of a directory containing script.
                        Scripts in the 'common' subdirectory of this directory,
                        and those in the directory named for the platform
                        being run on, are installed in the created environment.
                        Placeholder variables are replaced with environment-
                        specific values.
        N�commonr~r�)r�z.pdb��rbrxz+unable to copy script %r, may be binary: %s�wb)rg�lenrr�r;r+r�r�rr(r]�seprLrMr��read�decoder��encode�UnicodeErrorrmrnr�r-�copymode)rr"rrq�plenr�r�r�rOr��srcfiler��dstdir�dstfile�data�es                rr�zEnvBuilder.install_scripts�s����"�"���4�y��!#������D�$���t�|��a��A���2�7�7� 3�3����A��!�����G�G�t�O����X�(>��J�J�'7�8���'�'�,�,�t�Q�/���d�e��*�*�2�6�6�2�1�2�6���$�F��W�W�\�\�'�;�F�;�F��w�w�~�~�f�-��K�K��'��'�'�,�,�v�q�1���'�4�(�A��6�6�8�D�)��'�'�(8�9�H�#�{�{�7�3��#�5�5�d�G�D��#�{�{�7�3��
�#��g�t�,������
�-��O�O�G�W�5�7�
"/�&)�(��(�H�#�����(;�<C�Q�H�H��H��
-�,�s0�1H�4H#� I�H �#	I�,I
�
I�Ic��tjdt�d|j���|j|ddddgt���y)Nz
Upgrading z
 packages in r�r�installr�)rm�debug�CORE_VENV_DEPSrgr�r�s  rr zEnvBuilder.upgrade_dependencies�sJ�������(�
�g�6F�6F�5G�H�	
�	����g�t�U�I�{�	/�-�	/r)FFFFFNF)F)�__name__�
__module__�__qualname__�__doc__rr$r0r<�classmethodrIrrrr;r�rr�rrrr�r�r r�rrrrs����2:?�GK�#�)�/�8"�B��"��"�4C�J*D�X
�w�w�$��	*�&)	&�V;�z
0�I�

,�
��$06�d/rrc�H�t||||||��}|j|�y)z,Create a virtual environment in a directory.)rr	r
rrrN)rr$)r!rr	r
rrr�builders        rr$r$�s,���.B�$�x�(� &�\�C�G��N�N�7�rc
��ddl}|jtdd��}|jdddd�	�|jd
ddd
d��tj
dk(rd}nd}|j
�}|jd|ddd��|jd|ddd��|jddddd��|jddddd��|jddddd �!�|jd"d#�$�|jd%ddd&d'd(jt��d)���|j|�}|jr|jrtd*��t|j|j|j|j|j |j"|j$�+�}|j&D]}|j)|��y),NrzFCreates virtual Python environments in one or more target directories.z|Once an environment has been created, you may wish to activate it, e.g. by sourcing an activate script in its bin directory.)�prog�description�epilogr��ENV_DIR�+z)A directory to create the environment in.)�metavar�nargs�helpr�F�
store_true�system_sitezDGive the virtual environment access to the system site-packages dir.)�default�action�destrr~Trr
z[Try to use symlinks rather than copies, when symlinks are not the default for the platform.r��store_falsez\Try to use copies rather than symlinks, even when symlinks are the default for the platform.r�r	zcDelete the contents of the environment directory if it already exists, before environment creation.r�rzlUpgrade the environment directory to use this version of Python, assuming Python has been upgraded in-place.r�rz]Skips installing or upgrading pip in the virtual environment (pip is bootstrapped by default))r	rrrz--promptz;Provides an alternative prompt prefix for this environment.)rr�rzUpgrade core dependencies (z, z) to the latest version in PyPIz1you cannot supply --upgrade and --clear together.)rr	r
rrrr)�argparse�ArgumentParserr��add_argumentrr;�add_mutually_exclusive_groupr(r��
parse_argsrr	rNrrr
rrrr�r$)r�r�parser�use_symlinks�group�optionsr�rOs        r�mainr�s#���
�
$�
$�(�2@�-D�%�	E�F�����	��H��J�
���0�%�+�-�9��:�
�w�w�$�������/�/�1�E�	���|�\�*��,��-�

���z�|�+;�+�*�,��-�
���	�5��$�,C��D�
����U�<�&�.K��L�
����j� $�]�+��,�
���
�1��2����(�%��+�:�4�9�9�^�;T�:U�V=�=��>�����%�G����7�=�=��L�M�M��g�.A�.A�&�}�}�")�"2�"2�!(���")�"2�"2� '���&-�&:�&:�
<�G��\�\�����q��r�__main__rQz	Error: %s)�file)FFFFNFr&)r��loggingrr-r�r?r9r[r��	getLoggerr�rmrr$r�rcr�r��printr��exitr�rr�<module>rs�����	�
��
�����	��	�	�8�	$��S/�S/�l7<�EJ��C�L�z��	
�B�0���
��
�C�H�H�R�L���
�0�
�k�A�o�C�J�J�/�/��0�s�	A,�,B�1B
�
B

?>