a
    ñ»jø  ã                   @   sÂ   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 d d	lmZ d d
lmZmZ d dlmZ d dlmZ e  e¡ZG dd„ de
ƒZdS )é    N)ÚValues)Ú
WheelCache)Ú
cmdoptions)ÚRequirementCommandÚwith_cleanup)ÚSUCCESS)ÚCommandError)Úget_build_tracker)ÚInstallRequirement)Ú
ensure_dirÚnormalize_path)ÚTempDirectory)Úbuildc                   @   s<   e Zd ZdZdZddœdd„Zeeee	 e
dœdd	„ƒZd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/

    'pip wheel' uses the build system interface as described here:
    https://pip.pypa.io/en/stable/reference/build-system/

    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> ...N)Úreturnc                 C   s`  | j jddddtjdd� | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t 	¡ ¡ | j  t 
¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j jddd	d
dd� | j  t ¡ ¡ | j  t ¡ ¡ t tj| j¡}t tj| j¡}| j d|¡ | j d|¡ | j d| j ¡ d S )Nz-wz--wheel-dirÚ	wheel_dirÚdirzLBuild wheels into <dir>, where the default is the current working directory.)ÚdestÚmetavarÚdefaultÚhelpz--no-verifyÚ	no_verifyÚ
store_trueFz%Don't verify if built wheel is valid.)r   Úactionr   r   r   )Úcmd_optsÚ
add_optionÚosÚcurdirr   Úno_build_isolationÚ
use_pep517Zcheck_build_depsÚconstraintsZbuild_constraintsÚeditableÚrequirementsZrequirements_from_scriptsÚsrcÚignore_requires_pythonÚno_depsÚprogress_barÚconfig_settingsÚrequire_hashesÚmake_option_groupÚindex_groupÚparserZpackage_selection_groupÚinsert_option_group)ÚselfÚ
index_optsZselection_opts© r/   úBE:\soccer\ml_env\Lib\site-packages\pip/_internal/commands/wheel.pyÚadd_options*   sP    ùûþþzWheelCommand.add_options)ÚoptionsÚargsr   c                 C   s¸  t  |¡ t  |¡ |  |¡}|  ||¡}t|jƒ|_t|jƒ |  t	ƒ ¡}t
|j ddd�}|  ||||¡}t|jƒ}| j||||||jd| jd�}	| j|	||||jd�}
|  |¡ |
j|dd�}|	 |j ¡ ¡ g }|j ¡ D ] }|jrø|	 |¡ qâ| |¡ qât|||j d�\}}|D ]~}|j�r4|jj�s8J ‚|j�sDJ ‚zt  |j|j¡ W n@ t!�y˜ } z&t" #d	|j$|¡ | |¡ W Y d }~n
d }~0 0 �qt%|ƒd
k�r´t&dƒ‚t'S )NÚwheelT)ÚdeleteÚkindÚglobally_managedF)Útemp_build_dirr2   Úbuild_trackerÚsessionÚfinderÚdownload_dirÚuse_user_siteÚ	verbosity)Úpreparerr;   r2   Úwheel_cacher$   )Úcheck_supported_wheels)r@   Úverifyz Building wheel for %s failed: %sr   z"Failed to build one or more wheels)(r   Zcheck_build_constraintsZcheck_release_control_exclusiveÚget_default_sessionÚ_build_package_finderr   r   r   Úenter_contextr	   r   Úno_cleanÚget_requirementsr   Ú	cache_dirÚmake_requirement_preparerr>   Úmake_resolverr$   Útrace_basic_infoÚresolveÚ prepare_linked_requirements_morer"   ÚvaluesÚis_wheelÚsave_linked_requirementÚappendr   r   ÚlinkÚlocal_file_pathÚshutilÚcopyÚOSErrorÚloggerÚwarningÚnameÚlenr   r   )r-   r2   r3   r:   r;   r9   Ú	directoryÚreqsr@   r?   ÚresolverÚrequirement_setÚreqs_to_buildÚreqÚbuild_successesÚbuild_failuresÚer/   r/   r0   Úrun]   sv    



ý
øû
ý
ý$zWheelCommand.run)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úusager1   r   r   ÚlistÚstrÚintrd   r/   r/   r/   r0   r      s
   3r   )Úloggingr   rT   Úoptparser   Úpip._internal.cacher   Zpip._internal.clir   Úpip._internal.cli.req_commandr   r   Úpip._internal.cli.status_codesr   Úpip._internal.exceptionsr   Z,pip._internal.operations.build.build_trackerr	   Zpip._internal.req.req_installr
   Úpip._internal.utils.miscr   r   Úpip._internal.utils.temp_dirr   Úpip._internal.wheel_builderr   Ú	getLoggerre   rW   r   r/   r/   r/   r0   Ú<module>   s   
