o
    $¼"bð  ã                   @   s¼   d dl mZ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mZmZ eejƒG dd„ dee	ƒƒZG dd„ deeƒZG dd„ deeƒZdS )é    )Úabsolute_importÚunicode_literalsN)Údedent)Úadd_metaclass)ÚPython3Supports)ÚPathRefToDest)Úis_store_python)ÚPathé   )ÚCPythonÚCPythonPosixÚCPythonWindowsÚis_mac_os_frameworkc                   @   s   e Zd ZdZdS )ÚCPython3ú N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r   r   ú[/usr/lib/python3/dist-packages/virtualenv/create/via_global_ref/builtin/cpython/cpython3.pyr      s    r   c                       s8   e Zd Ze‡ fdd„ƒZ‡ fdd„Zedd„ ƒZ‡  ZS )ÚCPython3Posixc                    s   t |ƒdu ott| ƒ |¡S )NF)r   Úsuperr   Úcan_describe©ÚclsÚinterpreter©Ú	__class__r   r   r      s   zCPython3Posix.can_describec                    s*   t t| ƒ ¡ }|  | j¡r|tdƒ7 }|S )Na  
                # for https://github.com/python/cpython/pull/9516, see https://github.com/pypa/virtualenv/issues/1704
                import os
                if "__PYVENV_LAUNCHER__" in os.environ:
                    del os.environ["__PYVENV_LAUNCHER__"]
                )r   r   Úenv_patch_textÚpyvenv_launch_patch_activer   r   )ÚselfÚtextr   r   r   r      s   ÿzCPython3Posix.env_patch_textc                 C   s@   |j }|jdkod|  kodkn  pd|  kodkS   S )NÚdarwin)é   é   é   )r$   r%   )r$   r&   r$   )r$   r&   )Úversion_infoÚplatform)r   r   Úverr   r   r   r    '   s   :z(CPython3Posix.pyvenv_launch_patch_active)r   r   r   Úclassmethodr   r   r    Ú__classcell__r   r   r   r   r      s    r   c                       sp   e Zd ZdZe‡ fdd„ƒZe‡ fdd„ƒZedd„ ƒZedd	„ ƒZe‡ fd
d„ƒZ	edd„ ƒZ
dd„ Z‡  ZS )ÚCPython3Windowsr   c                    s   t |ƒrd S tt| ƒ |¡S ©N)r   r   r,   Ú
setup_metar   r   r   r   r.   0   s   zCPython3Windows.setup_metac                 #   sF   � t t| ƒ |¡D ]}|V  q	|  |¡s|  |¡D ]}|V  qd S d S r-   )r   r,   ÚsourcesÚhas_shimÚinclude_dll_and_pyd)r   r   Úsrcr   r   r   r/   6   s   €
þzCPython3Windows.sourcesc                 C   s   |j jdko|  |¡d uS )Nr%   )r'   ÚminorÚshimr   r   r   r   r0   >   s   zCPython3Windows.has_shimc                 C   s*   t |jƒd d d d }| ¡ r|S d S )NÚvenvÚscriptsÚntz
python.exe)r	   Úsystem_stdlibÚexists)r   r   r4   r   r   r   r4   B   s   zCPython3Windows.shimc                    s$   |   |¡r
|  |¡S tt| ƒ |¡S r-   )r0   r4   r   r,   Úhost_pythonr   r   r   r   r:   I   s   

zCPython3Windows.host_pythonc                 c   sV   � t |jƒd }t |jƒj}||fD ]}| ¡ D ]}|jdv r't|| jd�V  qqd S )NÚDLLs)z.pydz.dll)Údest)r	   Úsystem_prefixÚsystem_executableÚparentÚiterdirÚsuffixr   Úto_dll_and_pyd)r   r   Ú
dll_folderÚhost_exe_folderÚfolderÚfiler   r   r   r1   Q   s   €
€þÿz#CPython3Windows.include_dll_and_pydc                 C   s   | j |j S r-   )Úbin_dirÚname)r!   r2   r   r   r   rB   Z   s   zCPython3Windows.to_dll_and_pyd)r   r   r   r   r*   r.   r/   r0   r4   r:   r1   rB   r+   r   r   r   r   r,   -   s    


r,   )Ú
__future__r   r   ÚabcÚtextwrapr   Úsixr   Úvirtualenv.create.describer   Ú,virtualenv.create.via_global_ref.builtin.refr   Ú&virtualenv.create.via_global_ref.storer   Úvirtualenv.util.pathr	   Úcommonr   r   r   r   ÚABCMetar   r   r,   r   r   r   r   Ú<module>   s    