3
ÀÞL]A  ã               @   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)ÚResolver)ÚRequirementPreparer)ÚRequirementSet)ÚRequirementTracker)Ú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� |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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_binaryZno_build_isolationÚ
use_pep517Z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-build-69lrc5qx/pip/pip/_internal/commands/wheel.pyr   .   s\    zWheelCommand.__init__c          /   C   s°  t j|ƒ |jr tjj|jƒ|_tjj|jƒ|_| j|ƒ��j}| j||ƒ}|j	pT|j }t
|j|jƒ}tƒ ��.}t|j|dd���}t|jd�}	zây¾| j|	||||| j|ƒ t|j|jd |j|j|j|d�}
t|
|||ddd|j|jd|j|jd�}|j|	ƒ t||
||j�pg |j�pg |j	d	�}|j |	j!j"ƒ |d
�}t#|ƒdk�rNt$dƒ‚W n t%k
�rn   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 )Nr   )Ú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Úisolatedr$   )r   r   r-   )rC   r   z"Failed to build one or more wheels)(r   Úcheck_install_build_globalr+   r    ÚpathÚabspathr<   Ú_build_sessionÚ_build_package_finderr-   r   Ú	cache_dirÚformat_controlr   r   r
   r.   Úpopulate_requirement_setÚnamer	   r   r,   r?   r   rH   r)   Úisolated_moder$   Úresolver   r   r   Úbuildr'   ÚvaluesÚlenr   r   Úcleanup_filesÚcleanup)r3   r   r4   rC   rB   Úbuild_deleterD   r@   Ú	directoryÚrequirement_setrA   ÚresolverÚwbZbuild_failuresr8   r8   r9   Úrunl   sn    









zWheelCommand.run)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__rS   ÚusageÚsummaryr   r`   Ú__classcell__r8   r8   )r7   r9   r      s   >r   )Ú
__future__r   Úloggingr    Zpip._internal.cacher   Zpip._internal.clir   Zpip._internal.cli.base_commandr   Zpip._internal.exceptionsr   r   Zpip._internal.legacy_resolver   Z pip._internal.operations.preparer	   Zpip._internal.reqr
   Zpip._internal.req.req_trackerr   Zpip._internal.utils.temp_dirr   Zpip._internal.wheelr   Ú	getLoggerra   Úloggerr   r8   r8   r8   r9   Ú<module>   s   
