ó
Ð²Ebc           @   s·   d  d l  Z  d  d l Z d  d l m Z d  d l m Z d  d l m Z m	 Z	 m
 Z
 d  d l m Z e r‰ d  d l m Z m Z m Z n  e  j e ƒ Z d „  Z d „  Z d	 „  Z d S(
   iÿÿÿÿN(   t   open_spinner(   t    make_setuptools_bdist_wheel_args(   t   LOG_DIVIDERt   call_subprocesst   format_command_args(   t   MYPY_CHECK_RUNNING(   t   Listt   Optionalt   Textc         C   s†   t  |  ƒ } d j | ƒ } | s. | d 7} nT t j ƒ  t j k rP | d 7} n2 | j d ƒ sl | d 7} n  | d j | t ƒ 7} | S(   s'   Format command information for logging.s   Command arguments: {}
s   Command output: Nones'   Command output: [use --verbose to show]s   
s   Command output:
{}{}(   R   t   formatt   loggert   getEffectiveLevelt   loggingt   DEBUGt   endswithR   (   t   command_argst   command_outputt   command_desct   text(    (    sH   /tmp/pip-build-UPPWic/pip/pip/_internal/operations/build/wheel_legacy.pyt   format_command_result   s    c         C   s£   t  |  ƒ }  |  sE d j | ƒ } | t | | ƒ 7} t j | ƒ d St |  ƒ d k rŒ d j | |  ƒ } | t | | ƒ 7} t j | ƒ n  t j j	 | |  d ƒ S(   s>   Return the path to the wheel in the temporary build directory.s1   Legacy build of wheel for {!r} created no files.
i   sZ   Legacy build of wheel for {!r} created more than one file.
Filenames (choosing first): {}
i    N(
   t   sortedR	   R   R
   t   warningt   Nonet   lent   ost   patht   join(   t   namest   temp_dirt   nameR   R   t   msg(    (    sH   /tmp/pip-build-UPPWic/pip/pip/_internal/operations/build/wheel_legacy.pyt   get_legacy_build_wheel_path(   s    
	c         C   sÞ   t  | d | d | d | ƒ} d j |  ƒ } t | ƒ Ÿ } t j d | ƒ y t | d | d | ƒ}	 Wn/ t k
 r™ | j d ƒ t j d	 |  ƒ d SXt
 j | ƒ }
 t d
 |
 d | d |  d | d |	 ƒ } | SWd QXd S(   sŒ   Build one unpacked package using the "legacy" build process.

    Returns path to wheel if successfully built. Otherwise, returns None.
    t   global_optionst   build_optionst   destination_dirs    Building wheel for {} (setup.py)s   Destination directory: %st   cwdt   spinnert   errors   Failed building wheel for %sR   R   R   R   R   N(   R   R	   R    R
   t   debugR   t	   Exceptiont   finishR%   R   R   t   listdirR   (   R   t   setup_py_patht
   source_dirR    R!   t   tempdt
   wheel_argst   spin_messageR$   t   outputR   t
   wheel_path(    (    sH   /tmp/pip-build-UPPWic/pip/pip/_internal/operations/build/wheel_legacy.pyt   build_wheel_legacyF   s2    		(   R   t   os.pathR   t   pip._internal.cli.spinnersR    t$   pip._internal.utils.setuptools_buildR   t   pip._internal.utils.subprocessR   R   R   t   pip._internal.utils.typingR   t   typingR   R   R   t	   getLoggert   __name__R
   R   R   R1   (    (    (    sH   /tmp/pip-build-UPPWic/pip/pip/_internal/operations/build/wheel_legacy.pyt   <module>   s   		