B
    Kkdÿ  ã               @   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 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                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-gxxfd9b7/pip/pip/_internal/commands/wheel.pyr   .   s\    zWheelCommand.__init__c             C   sÚ  t  |¡ |jg|j }|jr4t dd |¡¡ g }|jrJt	j
 |j¡|_t	j
 |j¡|_|  |¡j}|  ||¡}|jp~|j }t|j|jƒ}tƒ .}t|j|dd}	t|jd}
zây¾|  |
||||| j|¡ t|	j
|jd |j|j|j|d}t||||ddd|j|jd	|j |j!d
}| "|
¡ t#||||j$p:g |j%pDg |jd}|j&|
j' (¡ |d}t)|ƒdkrxt*dƒ‚W n t+k
r˜   d	|_‚ Y nX W d |js¶|
 ,¡  | -¡  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)r1   )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Úisolatedr&   )r   r   r0   )rG   r   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_finderr0   r   Ú	cache_dirÚformat_controlr
   r   r	   r1   Úpopulate_requirement_setÚnamer   r   r/   rC   r   rL   r,   Úisolated_moder&   Úresolver   r   r   Úbuildr*   ÚvaluesÚlenr   r   Úcleanup_filesÚcleanup)r6   r   r7   Ú
index_urlsrG   rF   Úbuild_deleterH   rD   Ú	directoryÚrequirement_setrE   ÚresolverÚwbÚbuild_failuresr;   r;   r<   Úrunl   sv    









zWheelCommand.run)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r]   ÚusageÚsummaryr   rl   Ú__classcell__r;   r;   )r:   r<   r      s   >r   )Ú
__future__r   Úloggingr    Úpip._internal.cacher   Zpip._internal.clir   Úpip._internal.cli.base_commandr   Úpip._internal.exceptionsr   r   Ú pip._internal.operations.preparer   Zpip._internal.reqr	   Úpip._internal.req.req_trackerr
   Úpip._internal.resolver   Úpip._internal.utils.temp_dirr   Úpip._internal.wheelr   Ú	getLoggerrm   rS   r   r;   r;   r;   r<   Ú<module>   s   
