U
    KQh1                     @   s   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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mZ d d
lmZ eeZG dd deZdS )    )absolute_importN)RequirementCommand)CommandErrorPreviousBuildDirError)RequirementSet)import_or_raise)BuildDirectory)RemovedInPip10Warning)
WheelCacheWheelBuilder)
cmdoptionsc                       s<   e Zd ZdZdZdZdZ fddZ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.

    wheelz
      %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> ...z$Build wheels from your requirements.c                    sP  t t| j|| | j}|jddddtjdd |t  |t	  |t
  |t  |jddd	d
dd |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   	use_wheelno_use_wheel	no_binaryonly_binaryconstraintseditablerequirementssrcignore_requires_pythonno_deps	build_dirno_cleanrequire_hashesmake_option_groupindex_groupparserinsert_option_group)selfargskwr   
index_opts	__class__ 1/tmp/pip-build-tlro1kwj/pip/pip/commands/wheel.pyr   .   sb     zWheelCommand.__init__c                 C   s.   t dtd t dtd}t|ds*tdd S )Nzwheel.bdist_wheelzM'pip wheel' requires the 'wheel' package. To fix this, run: pip install wheelpkg_resourceszp'pip wheel' requires setuptools >= 0.8 for dist-info support. To fix this, run: pip install --upgrade setuptoolsDistInfoDistribution)r   r   hasattr)r2   r:   r8   r8   r9   check_required_packagesh   s    
z$WheelCommand.check_required_packagesc                 C   s  |    t| t| |jr.tdt |jr@tdt |j	rRtdt |j
g|j }|jr|tdd| g }|jrtj|j|_tj|j|_| |}| ||}|jp|j }t|j|j}t|j|d}t||jd |jd|j|j|||j |j!d}	| "|	||||| j#| |	j$sJW 5 Q R  W 5 Q R  d S zZz6t&|	||j'p^g |j(phg d	}
|
) st*d
W n t+k
r   d|_ Y nX W 5 |js|	%  X W 5 Q R X W 5 Q R X d S )Nz--allow-external has been deprecated and will be removed in the future. Due to changes in the repository protocol, it no longer has any effect.z--allow-all-external has been deprecated and will be removed in the future. Due to changes in the repository protocol, it no longer has any effect.z--allow-unverified has been deprecated and will be removed in the future. Due to changes in the repository protocol, it no longer has any effect.zIgnoring indexes: %s,)deleteT)r+   src_dirdownload_dirignore_dependenciesignore_installedr)   isolatedsessionwheel_cachewheel_download_dirr-   )r   r   z"Failed to build one or more wheels),r=   r   resolve_wheel_no_use_binarycheck_install_build_globalallow_externalwarningswarnr	   allow_all_externalallow_unverified	index_urlextra_index_urlsno_indexloggerdebugjoinr+   r   pathabspathr@   _build_session_build_package_finderr,   r
   	cache_dirformat_controlr   r   rB   r)   isolated_moder   r-   populate_requirement_setnamehas_requirementscleanup_filesr   r   r   buildr   r   )r2   r   r3   
index_urlsrE   finderbuild_deleterF   r+   requirement_setwbr8   r8   r9   run|   s    

     


zWheelCommand.run)__name__
__module____qualname____doc__r]   usagesummaryr   r=   rf   __classcell__r8   r8   r6   r9   r      s   :r   )
__future__r   loggingr   rK   pip.basecommandr   pip.exceptionsr   r   pip.reqr   	pip.utilsr   pip.utils.buildr   Zpip.utils.deprecationr	   	pip.wheelr
   r   pipr   	getLoggerrg   rR   r   r8   r8   r8   r9   <module>   s   
