3
v,h                 @   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
 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mZ e jeZ G dd deZ!dS )    N)Values)List)
WheelCache)
cmdoptions)RequirementCommandwith_cleanup)SUCCESS)CommandError)InstallRequirement)get_requirement_tracker)
ensure_dirnormalize_path)TempDirectory)buildshould_build_for_wheel_commandc               @   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/

    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> ...N)returnc             C   sv  | j jddddtjdd | j jtj  | j jtj  | j jtj  | j jtj  | j jtj	  | j jtj
  | j jtj  | j jtj  | j jtj  | j jtj  | j jtj  | j jtj  | j jtj  | j jddd	d
dd | j jtj  | j jtj  | j jdd	d
dd | j jtj  tjtj| j}| jjd| | j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   z--prezYInclude pre-release and development versions. By default, pip only finds stable versions.)r   r   r   r   )cmd_opts
add_optionoscurdirr   	no_binaryonly_binaryprefer_binaryno_build_isolation
use_pep517Zno_use_pep517constraintseditablerequirementssrcignore_requires_pythonno_depsprogress_barbuild_optionsglobal_optionsrequire_hashesmake_option_groupindex_groupparserinsert_option_group)self
index_opts r5   =/tmp/pip-install-dn9_u1zy/pip/pip/_internal/commands/wheel.pyadd_options+   sN    zWheelCommand.add_options)optionsargsr   c             C   s  t j| | j|}| j||}t|j|j}t|j|_t	|j | j
t }t|j ddd}| j||||}| j||||||jdd}	| j|	||||j|jd}
| j| |
j|dd}g }x6|jj D ](}|jr|	j| qt|r|j| qW t|||j |jpg |jpg d\}}x|D ]|}|jr@|jjsDt |j!sPt yt"j#|j!|j W n> t$k
r } z t%j&d	|j'| |j| W Y d d }~X nX q*W t(|d
krt)dt*S )NwheelT)deletekindZglobally_managedF)Ztemp_build_dirr8   req_trackersessionfinderdownload_diruse_user_site)preparerr?   r8   wheel_cacher)   r$   )check_supported_wheels)rC   verifyr,   r-   z Building wheel for %s failed: %sr   z"Failed to build one or more wheels)+r   check_install_build_globalZget_default_session_build_package_finderr   	cache_dirformat_controlr   r   r   enter_contextr   r   no_cleanZget_requirementsZmake_requirement_preparerZmake_resolverr)   r$   Ztrace_basic_inforesolver'   valuesis_wheelZsave_linked_requirementr   appendr   r   r,   r-   linkAssertionErrorZlocal_file_pathshutilcopyOSErrorloggerwarningnamelenr	   r   )r3   r8   r9   r>   r?   rC   r=   	directoryreqsrB   resolverrequirement_setZreqs_to_buildreqZbuild_successesZbuild_failureser5   r5   r6   rune   sn    






"zWheelCommand.run)__name__
__module____qualname____doc__usager7   r   r   r   strintr_   r5   r5   r5   r6   r      s
   :r   )"loggingr   rR   optparser   typingr   pip._internal.cacher   Zpip._internal.clir   Zpip._internal.cli.req_commandr   r   pip._internal.cli.status_codesr   pip._internal.exceptionsr	   Zpip._internal.req.req_installr
   pip._internal.req.req_trackerr   pip._internal.utils.miscr   r   pip._internal.utils.temp_dirr   Zpip._internal.wheel_builderr   r   	getLoggerr`   rU   r   r5   r5   r5   r6   <module>   s    
