B
    '\_                 @   s\   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 eeZdd ZeZdS )    )absolute_importN)Utf8NamedTemporaryFile)pip_subprocess)	getLoggerc             O   s   yt t |j}W n tk
r.   d}Y nX d}zHtddd|dd}|d| |  dd	|j	g}t
|| |d
 W d|dk	rt |j	rdtjkrt|j	 ntd|j	 X dS )a  
    Installs the pip dependencies in specs using a temporary pip requirements file.

    Args
    ----
    prefix: string
      The path to the python and pip executables.

    specs: iterable of strings
      Each element should be a valid pip dependency.
      See: https://pip.pypa.io/en/stable/user_guide/#requirements-files
           https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format
    Nwz	condaenv.z.requirements.txtF)modeprefixsuffixdirdelete
installz-r)cwdZCONDA_TEST_SAVE_TEMPSz:CONDA_TEST_SAVE_TEMPS :: retaining pip requirements.txt {})opdirnameabspathfileAttributeErrorr   writejoinclosenamer   isfileosenvironremovelogZwarningformat)r   Zspecsargs_kwargsZpip_workdirZrequirementsZpip_cmd r!   7lib/python3.7/site-packages/conda_env/installers/pip.py_pip_install_via_requirements   s(    

r#   )Z
__future__r   r   os.pathpathr   Zconda._vendor.auxlib.compatr   Zconda_env.pip_utilr   Zloggingr   __name__r   r#   r   r!   r!   r!   r"   <module>   s   +