
0c@_                 @   s5  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 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)Listc               @   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   s/  |  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 |  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--global-optionglobal_optionszZExtra global options to be supplied to the setup.py call before the 'bdist_wheel' command.z--pre
store_trueFzYInclude 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 r4   ;/tmp/pip-build-jynh7p1z/pip/pip/_internal/commands/wheel.pyadd_options2   sV    						zWheelCommand.add_optionsc             C   se  t  j |  |  j |  } |  j | |  } | j p= | j } t | j | j  } t	 | j
  | _
 t | j
  |  j t    } t | j d | 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 } d d   | j j   D } t | d | 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
 r>} z( t" j# d | j$ |  | j% |  WYd  d  } ~ XqXqWt& |  d k rat' d   t( S)NdeletekindwheelZglobally_managedTZtemp_build_dirr   req_trackersessionfinderwheel_download_diruse_user_siteFpreparerwheel_cacher*   r%   Zcheck_supported_wheelsc             S   s"   g  |  ] } t  |  r |  q Sr4   )r   ).0rr4   r4   r5   
<listcomp>   s   	 z$WheelCommand.run.<locals>.<listcomp>r   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_finderno_cleanr,   r   	cache_dirformat_controlr   r   r
   enter_contextr	   r   Zget_requirementsZmake_requirement_preparerZmake_resolverr*   r%   Ztrace_basic_inforesolver(   valuesr   r   r   linkis_wheelAssertionErrorZlocal_file_pathshutilcopyOSErrorloggerwarningnamer   lenr   r   )r2   r   argsr;   r<   build_deleter@   r:   	directoryreqsr?   resolverrequirement_setZreqs_to_buildZbuild_successesZbuild_failuresreqer4   r4   r5   runm   sh    							$	zWheelCommand.runN)__name__
__module____qualname____doc__usager6   r   r^   r4   r4   r4   r5   r      s   ;r   )$
__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   	getLoggerr_   rR   r   r4   r4   r4   r5   <module>   s$   