
(h                 @   sE  d  d l  m 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	 m
 Z
 m Z d  d l m Z d  d l m Z d  d l m Z d  d	 l m Z m Z d  d
 l m Z d  d l m Z d  d l m Z m Z e rd  d l m Z d  d l m Z d  d l  m! Z! e j" e#  Z$ Gd d   d e
  Z% d S)    )absolute_importN)
WheelCache)
cmdoptions)RequirementCommandwith_cleanup)SUCCESS)CommandError)get_requirement_tracker)
ensure_dirnormalize_path)TempDirectory)MYPY_CHECK_RUNNING)buildshould_build_for_wheel_command)Values)List)InstallRequirementc               @   s:   e  Z d  Z d Z d Z d d   Z e d d    Z d S)WheelCommanda  
    Build Wheel archives for your requirements and dependencies.

    Wheel is a built-package format, and offers the advantage of not
    recompiling your software during every install. For more details, see the
    wheel docs: https://wheel.readthedocs.io/en/latest/

    Requirements: setuptools>=0.8, and wheel.

    'pip wheel' uses the bdist_wheel setuptools extension from the wheel
    package to build individual wheels.

    z
      %prog [options] <requirement specifier> ...
      %prog [options] -r <requirements file> ...
      %prog [options] [-e] <vcs project url> ...
      %prog [options] [-e] <local project path> ...
      %prog [options] <archive url/path> ...c             C   sW  |  j  j d d d d d d d t j d d	 |  j  j t j    |  j  j t j    |  j  j t j    |  j  j d
 d d d d d d d d |  j  j t j    |  j  j t j	    |  j  j t j
    |  j  j t j    |  j  j t j    |  j  j t j    |  j  j t j    |  j  j t j    |  j  j t j    |  j  j t j    |  j  j t j    |  j  j d d d d d d d d d |  j  j d d d d d d d d d |  j  j d d d d d d d |  j  j t j    t j t j |  j  } |  j j d |  |  j j d |  j   d  S)Nz-wz--wheel-dirdest	wheel_dirmetavardirdefaulthelpzLBuild wheels into <dir>, where the default is the current working directory.z--build-optionbuild_optionsoptionsactionappendz9Extra arguments to be supplied to 'setup.py bdist_wheel'.z--no-verify	no_verify
store_trueFz%Don't verify if built wheel is valid.z--global-optionglobal_optionszZExtra global options to be supplied to the setup.py call before the 'bdist_wheel' command.z--prezYInclude pre-release and development versions. By default, pip only finds stable versions.r   )cmd_opts
add_optionoscurdirr   	no_binaryonly_binaryZprefer_binaryZno_build_isolation
use_pep517Zno_use_pep517constraintseditablerequirementssrcignore_requires_pythonno_deps	build_dirZprogress_barrequire_hashesmake_option_groupindex_groupparserinsert_option_group)self
index_opts r6   ;/tmp/pip-build-kmztzv_d/pip/pip/_internal/commands/wheel.pyadd_options3   sb    							zWheelCommand.add_optionsc             C   s  t  j |  |  j |  } |  j | |  } t | j | j  } t | j  | _ t	 | j  |  j
 t    } t d | j d d d d  } |  j | | | |  } |  j d | d | d | d	 | d
 | d | j d d  }	 |  j d |	 d
 | d | d | d | j d | j  }
 |  j |  |
 j | d d } g  } xI | j j   D]8 } | j rq|	 j |  qRt |  rR| j |  qRWt | d | d | j d | j pg  d | j pg  \ } } x | D] } | j r| j j st   | j! st   y t" j# | j! | j  Wqt$ k
 ri} z( t% j& d | j' |  | j |  WYd  d  } ~ XqXqWt( |  d k rt) d   t* S)NdeletekindwheelZglobally_managedTZtemp_build_dirr   req_trackersessionfinderdownload_diruse_user_siteFpreparerwheel_cacher,   r'   Zcheck_supported_wheelsverifyr   r    z Building wheel for %s failed: %sr   z"Failed to build one or more wheels)+r   check_install_build_globalZget_default_session_build_package_finderr   	cache_dirformat_controlr   r   r
   enter_contextr	   r   no_cleanZget_requirementsZmake_requirement_preparerZmake_resolverr,   r'   Ztrace_basic_inforesolver*   valuesis_wheelZsave_linked_requirementr   r   r   r   r   r    linkAssertionErrorZlocal_file_pathshutilcopyOSErrorloggerwarningnamelenr   r   )r4   r   argsr=   r>   rB   r<   	directoryreqsrA   resolverrequirement_setZreqs_to_buildreqZbuild_successesZbuild_failureser6   r6   r7   runv   sp    
							
$	zWheelCommand.runN)__name__
__module____qualname____doc__usager8   r   r]   r6   r6   r6   r7   r      s   Cr   )&
__future__r   loggingr#   rO   Zpip._internal.cacher   Zpip._internal.clir   Zpip._internal.cli.req_commandr   r   Zpip._internal.cli.status_codesr   Zpip._internal.exceptionsr   Zpip._internal.req.req_trackerr	   Zpip._internal.utils.miscr
   r   Zpip._internal.utils.temp_dirr   Zpip._internal.utils.typingr   Zpip._internal.wheel_builderr   r   optparser   Ztypingr   Zpip._internal.req.req_installr   	getLoggerr^   rR   r   r6   r6   r6   r7   <module>   s&   