U
    E¸Öh  ã                   @   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 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mZ d d
lmZ d dlmZ d dlmZmZ erÈd dlmZ d dlmZm Z  e !e"¡Z#G dd„ de
ƒZ$dS )é    )Úabsolute_importN)Ú
WheelCache)Ú
cmdoptions)ÚRequirementCommand)ÚCommandErrorÚPreviousBuildDirError)ÚRequirementSet)Úget_requirement_tracker)Ú
ensure_dirÚnormalize_path)ÚTempDirectory)ÚMYPY_CHECK_RUNNING)ÚbuildÚshould_build_for_wheel_command)ÚValues)ÚAnyÚListc                       s,   e 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.

    zõ
      %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> ...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_optsZ
add_optionÚosÚcurdirr   Z	no_binaryZonly_binaryZprefer_binaryZno_build_isolationÚ
use_pep517Zno_use_pep517ZconstraintsZeditableÚrequirementsÚsrcÚignore_requires_pythonZno_depsÚ	build_dirZprogress_barÚno_cleanZrequire_hashesZmake_option_groupZindex_groupÚparserZinsert_option_group)ÚselfÚargsÚkwr"   Z
index_opts©Ú	__class__© úB./venv/lib/python3.8/site-packages/pip/_internal/commands/wheel.pyr!   5   sh     ûûûüþzWheelCommand.__init__c                 C   s   t  |¡ |  |¡}|  ||¡}|jp*|j }t|j|jƒ}t	|j
ƒ|_
t|j
ƒ tƒ œ}t|j|dd~}tƒ }	zTz.|  |	|||||¡ | j||||||j
dd}
| j|
||||j|jd}|  |¡ | |	¡ dd„ |	j ¡ D ƒ}t|||jpüg |jpg d\}}|D ]|}|jr*|jjs.t‚|j s:t‚zt! "|j |j
¡ W n> t#k
rŒ } zt$ %d	|j&|¡ | '|¡ W 5 d }~X Y nX qt(|ƒd
kr¨t)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wheel)ÚdeleteÚkindF)Ztemp_build_dirr   Úreq_trackerÚsessionÚfinderZwheel_download_dirZuse_user_site)Úpreparerr7   r   Úwheel_cacher(   r%   c                 S   s   g | ]}t |ƒr|‘qS r1   )r   )Ú.0Úrr1   r1   r2   Ú
<listcomp>£   s   ÿz$WheelCommand.run.<locals>.<listcomp>)r9   r   r   z Building wheel for %s failed: %sr   z"Failed to build one or more wheelsT)+r   Zcheck_install_build_globalZget_default_sessionZ_build_package_finderr*   r)   r   Ú	cache_dirZformat_controlr   r   r
   r	   r   r   Zcleanup_filesZcleanupZpopulate_requirement_setZmake_requirement_preparerZmake_resolverr(   r%   Ztrace_basic_infoZresolver&   Úvaluesr   r   r   ÚlinkZis_wheelÚAssertionErrorZlocal_file_pathÚshutilÚcopyÚOSErrorÚloggerZwarningÚnamer   Úlenr   r   )r,   r   r-   r6   r7   Zbuild_deleter9   r5   Z	directoryZrequirement_setr8   ZresolverZreqs_to_buildZbuild_successesZbuild_failuresZreqÚer1   r1   r2   Úruns   s’    


  ÿ    þù
ú	

ÿ
ü
 þ ÿzWheelCommand.run)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úusager!   rH   Ú__classcell__r1   r1   r/   r2   r      s   >r   )%Z
__future__r   Zloggingr#   rA   Zpip._internal.cacher   Zpip._internal.clir   Zpip._internal.cli.req_commandr   Zpip._internal.exceptionsr   r   Zpip._internal.reqr   Zpip._internal.req.req_trackerr	   Zpip._internal.utils.miscr
   r   Zpip._internal.utils.temp_dirr   Zpip._internal.utils.typingr   Zpip._internal.wheel_builderr   r   Zoptparser   Útypingr   r   Z	getLoggerrI   rD   r   r1   r1   r1   r2   Ú<module>   s$   
