3
[l                 @   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 d dlmZ ejeZG dd de	ZdS )    )absolute_importN)
WheelCache)
cmdoptions)RequirementCommand)CommandErrorPreviousBuildDirError)RequirementPreparer)RequirementSet)RequirementTracker)Resolver)TempDirectory)WheelBuilderc                   s4   e Zd Zd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.

    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                s^  t t| j|| | j}|jddddtjdd |jtj  |jtj	  |jtj
  |jddd	d
dd |jtj  |jtj  |jtj  |jtj  |jtj  |jtj  |jtj  |jtj  |jtj  |jddd
d	dd |jddddd |jtj  |jtj  tjtj| j}| jjd| | j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_binaryZprefer_binaryno_build_isolation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-65viz3iy/pip/pip/_internal/commands/wheel.pyr   .   sX    zWheelCommand.__init__c          .   C   s  t j| |jg|j }|jr4tjddj| g }|jrJt	j
j|j|_t	j
j|j|_| j|^}| j||}|jp~|j }t|j|j}t "}t|j|dd}	t|jd}
zy| j|
||||| j| t|	j
|jd |j|j|j|d}t||||ddd|j|jd	|j d
}|j!|
 t"||||j#p6g |j$p@g |jd}|j%|
j&j' |d}|slt(dW n t)k
r   d	|_ Y nX W d |js|
j*  |j+  X W d Q R X W d Q R X W d Q R X d S )NzIgnoring indexes: %s,r   )deletekind)r.   )r+   src_dirdownload_dirwheel_download_dirr,   build_isolationreq_trackerFzto-satisfy-onlyT)preparerfindersessionwheel_cacheuse_user_siteupgrade_strategyforce_reinstallignore_dependenciesr)   ignore_installedisolated)r   r   r-   )rD   z"Failed to build one or more wheels),r   check_install_build_global	index_urlextra_index_urlsno_indexloggerdebugjoinr+   r    pathabspathr=   _build_session_build_package_finderr-   r   	cache_dirformat_controlr
   r   r	   r.   populate_requirement_setnamer   r   r,   r@   r   rI   r)   isolated_moderesolver   r   r   buildr'   valuesr   r   cleanup_filescleanup)r3   r   r4   
index_urlsrD   rC   build_deleterE   rA   	directoryrequirement_setrB   resolverwbwheels_built_successfullyr8   r8   r9   runj   st    









zWheelCommand.run)
__name__
__module____qualname____doc__rZ   usagesummaryr   rh   __classcell__r8   r8   )r7   r9   r      s   <r   )
__future__r   loggingr    pip._internal.cacher   Zpip._internal.clir   Zpip._internal.cli.base_commandr   pip._internal.exceptionsr   r    pip._internal.operations.preparer   Zpip._internal.reqr	   Zpip._internal.req.req_trackerr
   pip._internal.resolver   pip._internal.utils.temp_dirr   pip._internal.wheelr   	getLoggerri   rP   r   r8   r8   r8   r9   <module>   s   
