o
    $¼"b¨  ã                   @   sÆ   d dl mZmZ d dl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mZmZmZ eejƒG d
d„ deeƒƒZeejƒG dd„ deeƒƒZG dd„ deƒZG dd„ deeƒZdS )é    )Úabsolute_importÚunicode_literalsN)Úadd_metaclass)ÚPathRefToDest)ÚPathé   )ÚPython2é   )ÚCPythonÚCPythonPosixÚCPythonWindowsÚis_mac_os_frameworkc                       s`   e Zd ZdZe‡ fdd„ƒZedd„ ƒZedd„ ƒZedd	„ ƒZ	ed
d„ ƒZ
‡ fdd„Z‡  ZS )ÚCPython2z/Create a CPython version 2  virtual environmentc                 #   sL   � t t| ƒ |¡D ]}|V  q	|  |¡}| ¡ r$t|jdd„ d�V  d S d S )Nc                 S   s   | j S ©N)Úinclude)ÚselfÚ_© r   ú[/usr/lib/python3/dist-packages/virtualenv/create/via_global_ref/builtin/cpython/cpython2.pyÚ<lambda>   s    z"CPython2.sources.<locals>.<lambda>©Údest)Úsuperr   ÚsourcesÚhost_include_markerÚexistsr   Úparent)ÚclsÚinterpreterÚsrcr   ©Ú	__class__r   r   r      s   €
ÿzCPython2.sourcesc                 C   s   dS ©NFr   ©r   r   r   r   Úneeds_stdlib_py_module   s   zCPython2.needs_stdlib_py_modulec                 C   s   t |jƒd S )NzPython.h)r   Úsystem_include©r   r   r   r   r   r       s   zCPython2.host_include_markerc                 C   s   | j | j d¡ jS )NÚheaders)r   r   Úinstall_pathr   )r   r   r   r   r   $   s   zCPython2.includec                 C   s   dgS )NÚosr   r#   r   r   r   Úmodules)   s   ÿzCPython2.modulesc                    sD   t t| ƒ ¡ }|  | j¡}| ¡ r| | jj¡ |S t	 
d|¡ |S )Nz2no include folders as can't find include marker %s)r   r   Úensure_directoriesr   r   r   Úaddr   r   ÚloggingÚdebug)r   Údirsr   r    r   r   r+   /   s   ÿzCPython2.ensure_directories)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úclassmethodr   r$   r   Úpropertyr   r*   r+   Ú__classcell__r   r   r    r   r      s    



r   c                       ó$   e Zd ZdZe‡ fdd„ƒZ‡  ZS )ÚCPython2PosixBasez9common to macOs framework builds and other posix CPython2c                 #   sv   � t t| ƒ |¡D ]}|V  q	t|jd ƒ}| ¡ r7t|ƒ |j¡r9| 	t|jƒ¡‰ t
|‡ fdd„d�V  d S d S d S )NÚmakefile_filenamec                    s
   | j ˆ  S r   r   ©r   Ús©Úunder_prefixr   r   r   F   s   
 z+CPython2PosixBase.sources.<locals>.<lambda>r   )r   r8   r   r   Ú	sysconfigr   ÚstrÚ
startswithÚprefixÚrelative_tor   )r   r   r   Ú	make_filer    r<   r   r   =   s   €þzCPython2PosixBase.sources©r0   r1   r2   r3   r4   r   r6   r   r   r    r   r8   9   s    r8   c                       s4   e Zd ZdZe‡ fdd„ƒZe‡ fdd„ƒZ‡  ZS )ÚCPython2Posixz5CPython 2 on POSIX (excluding macOs framework builds)c                    s   t |ƒdu ott| ƒ |¡S r"   )r   r   rE   Úcan_describer&   r    r   r   rF   L   s   zCPython2Posix.can_describec                 #   sH   � t t| ƒ |¡D ]}|V  q	|  |  |¡d¡\}}}t||d�V  d S )Nzlib-dynloadr   )r   rE   r   Úfrom_stdlibÚmappingsr   )r   r   r   Úexec_marker_fileÚto_pathr   r    r   r   r   P   s
   €zCPython2Posix.sources)r0   r1   r2   r3   r4   rF   r   r6   r   r   r    r   rE   I   s    rE   c                       r7   )ÚCPython2WindowszCPython 2 on Windowsc                 #   sv   � t t| ƒ |¡D ]}|V  q	t|jƒjd }| ¡ r#t|| jd�V  t|j	ƒd }| ¡ r9t|dd„ d�V  d S d S )Nzpython27.dllr   Úlibsc                 S   s   | j |j S r   )r   Únamer:   r   r   r   r   f   s    z)CPython2Windows.sources.<locals>.<lambda>)
r   rK   r   r   Úsystem_executabler   r   r   Úto_binÚsystem_prefix)r   r   r   Úpy27_dllrL   r    r   r   r   \   s   €ÿzCPython2Windows.sourcesrD   r   r   r    r   rK   Y   s    rK   )Ú
__future__r   r   Úabcr-   Úsixr   Ú,virtualenv.create.via_global_ref.builtin.refr   Úvirtualenv.util.pathr   Úpython2.python2r   Úcommonr
   r   r   r   ÚABCMetar   r8   rE   rK   r   r   r   r   Ú<module>   s    )