o
    [h                     @   s   d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZ d dlm	Z	 d dl
Z
d dlmZ ddlmZ dd Zd	d
 Zdd ZdS )    N)log)DistutilsError)Wheel   )SetuptoolsDeprecationWarningc                 C   s(   t | tr	|  S t | ttfsJ | S )z8Ensure find-links option end-up being a list of strings.)
isinstancestrsplittuplelist)
find_links r   {/home/ubuntu/experiments/live_experiments/Pythonexperiments/Otree/venv/lib/python3.10/site-packages/setuptools/installer.py_fixup_find_links   s   
r   c                 C   sH  t dt ztd W n tjy   | dtj Y nw t	|}| 
d}d|v r0tddtjvo9dtjv}d	tjv rBd
}nd|v rM|d d }nd
}d|v r_t|d d d
d
 ng }| jrj|| j tj|  }t }t|D ]}||v r||r|  S q{t }	tjdddddd|	g}
|r|
d |d
ur|
d|f |pg D ]	}|
d|f q|
|jpt| zt|
 W n tj y } ztt||d
}~ww t!t""tj#|	dd }tj#||$ }|%| t&|tj#|d}tj'j(||d} | W  d
   S 1 sw   Y  d
S )zLFetch an egg needed for building.

    Use pip/wheel to fetch/build a wheel.z\setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.wheelz,WARNING: The wheel package is not available.easy_installZallow_hostszQthe `allow-hosts` option is not supported when using pip to install requirements.Z	PIP_QUIETZPIP_VERBOSEZPIP_INDEX_URLN	index_urlr   r   z-mpipz--disable-pip-version-checkz	--no-depsz-wz--quietz--index-urlz--find-linksz*.whlr   zEGG-INFO)metadata))warningswarnr   pkg_resourcesget_distributionDistributionNotFoundZannouncer   WARNstrip_markerZget_option_dictr   osenvironr   Zdependency_linksextendpathrealpathZget_egg_cache_dirEnvironmentfind_distributionscan_addtempfileTemporaryDirectorysys
executableappendurlr   
subprocess
check_callCalledProcessErrorr   globjoinegg_nameZinstall_as_eggPathMetadataDistributionfrom_filename)distreqoptsquietr   r   Zeggs_direnvironmentZegg_distZtmpdircmdlinker   dist_locationZdist_metadatar   r   r   fetch_build_egg   sx   

 


&r<   c                 C   s   t jt| } d| _| S )z
    Return a new requirement without the environment marker to avoid
    calling pip with something like `babel; extra == "i18n"`, which
    would always be ignored.
    N)r   Requirementparser   marker)r4   r   r   r   r   _   s   r   )r-   r   r*   r&   r$   r   	distutilsr   Zdistutils.errorsr   r   Zsetuptools.wheelr   Z_deprecation_warningr   r   r<   r   r   r   r   r   <module>   s    H