U
    P^                     @   s   d dl mZ d dl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mZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ erd dlmZ d dlmZmZ eeZG dd de	ZdS )    )absolute_importN)
WheelCache)
cmdoptions)RequirementCommand)CommandErrorPreviousBuildDirError)RequirementSet)RequirementTracker)TempDirectory)MYPY_CHECK_RUNNING)WheelBuilder)Values)AnyListc                       s,   e Zd ZdZdZ fddZdd Z  Z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                    sz  t t| j|| | j}|jddddtjdd |t  |t	  |t
  |jddd	d
dd |t  |t  |t  |t  |t  |t  |t  |t  |t  |t  |t  |jddd
d	dd |jddddd |t  |t  ttj| j}| jd| | jd| d S )Nz-wz--wheel-dir	wheel_dirdirzLBuild wheels into <dir>, where the default is the current working directory.)destmetavardefaulthelpz--build-optionbuild_optionsoptionsappendz9Extra arguments to be supplied to 'setup.py bdist_wheel'.)r   r   actionr   z--global-optionglobal_optionszZExtra global options to be supplied to the setup.py call before the 'bdist_wheel' command.)r   r   r   r   z--pre
store_trueFzYInclude pre-release and development versions. By default, pip only finds stable versions.)r   r   r   r   )superr   __init__cmd_opts
add_optionoscurdirr   	no_binaryonly_binaryprefer_binaryno_build_isolation
use_pep517no_use_pep517constraintseditablerequirementssrcignore_requires_pythonno_deps	build_dirprogress_barno_cleanrequire_hashesmake_option_groupindex_groupparserinsert_option_group)selfargskwr   
index_opts	__class__ =/tmp/pip-install-220asx0h/pip/pip/_internal/commands/wheel.pyr   3   sh     zWheelCommand.__init__c                 C   sz  t | |jr tj|j|_tj|j|_| |}| ||}|j	pP|j }t
|j|j}t }t|j|dd}t|jd}	zz| |	||||| | j||||jd}
| j|
|||||j|jd}||	 t|
||jpg |jpg |j	d}||	j }t |dkr"t!dW n t"k
rB   d	|_	 Y nX W 5 |j	s`|	  |  X W 5 Q R X W 5 Q R X d S )
Nwheel)deletekind)r2   )Ztemp_build_dirr   req_trackerwheel_download_dir)preparerfindersessionr   wheel_cacher-   r'   )r   r   r1   r   z"Failed to build one or more wheelsT)#r   check_install_build_globalr/   r!   pathabspathsrc_dirZget_default_session_build_package_finderr1   r   	cache_dirformat_controlr	   r
   r   r2   cleanup_filescleanuppopulate_requirement_setZmake_requirement_preparerr   Zmake_resolverr-   r'   resolver   r   r   buildr+   valueslenr   r   )r7   r   r8   rF   rE   build_deleterG   rB   	directoryrequirement_setrD   resolverwbbuild_failuresr=   r=   r>   runq   s|    

      	
 zWheelCommand.run)__name__
__module____qualname____doc__usager   r\   __classcell__r=   r=   r;   r>   r      s   >r   ) 
__future__r   loggingr!   pip._internal.cacher   Zpip._internal.clir   Zpip._internal.cli.req_commandr   pip._internal.exceptionsr   r   Zpip._internal.reqr   pip._internal.req.req_trackerr	   pip._internal.utils.temp_dirr
   pip._internal.utils.typingr   pip._internal.wheelr   optparser   typingr   r   	getLoggerr]   loggerr   r=   r=   r=   r>   <module>   s    
