3
zYði1  ã               @   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j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� |jtjƒ ƒ |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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   Ú	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-ue6tjl93/pip/pip/commands/wheel.pyr   .   sV    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   r9   r7   r7   r8   Úcheck_required_packagesh   s    
z$WheelCommand.check_required_packagesc              C   s¼  | j ƒ  tj|ƒ tj|ƒ |jr.tjdtƒ |jr@tjdtƒ |j	rRtjdtƒ |j
g|j }|jr|tjddj|ƒƒ g }|jr’tjj|jƒ|_tjj|jƒ|_| j|ƒ��}| j||ƒ}|jpÆ|j }t|j|jƒ}t|j|d��Â}t||jd |jd|j|j|||j |j!d�}	| j"|	||||| j#|ƒ |	j$�s6d S zZy6t%|	||j&�pJg |j'�pTg d	�}
|
j(ƒ �slt)d
ƒ‚W n t*k
�rŒ   d|_‚ Y nX W d |j�s¢|	j+ƒ  X W d Q R X W d 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   rA   r)   Úisolated_moder   r-   Úpopulate_requirement_setÚnameÚhas_requirementsr   r   r   Úbuildr   r   Úcleanup_files)r2   r   r3   Ú
index_urlsrD   ÚfinderÚbuild_deleterE   r+   Úrequirement_setÚwbr7   r7   r8   Úrun|   sv    






zWheelCommand.run)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r\   ÚusageÚsummaryr   r<   re   Ú__classcell__r7   r7   )r6   r8   r      s   :r   )Ú
__future__r   Úloggingr   rJ   Úpip.basecommandr   Úpip.exceptionsr   r   Úpip.reqr   Ú	pip.utilsr   Úpip.utils.buildr   Zpip.utils.deprecationr	   Ú	pip.wheelr
   r   Úpipr   Ú	getLoggerrf   rQ   r   r7   r7   r7   r8   Ú<module>   s   
