U
    P^H                     @   s4  d Z ddlmZ ddlZddlZddlZddlZddlZddlZ	ddl
Z
ddl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 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!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-m.Z.m/Z/ ddl0m1Z1 ddl2m3Z3m4Z4m5Z5m6Z6 ddl7m8Z8 ddl9m:Z: ddl;m<Z< ddl=m>Z> ddl?m@Z@ e:rddlAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZM ddlNmOZO ddlPmQZQ ddlRmSZS ddlTmUZU ddlVmWZW eGeXdf ZYeLeQgeZf Z[d Z\e]e^Z_d!d" Z`dXd$d%ZadYd&d'Zbd(d) Zcd*d+ Zdd,d- Zee
fd.e
jgZhd/d0 Zid1d2 Zjd3d4 Zkd5d6 Zld7d8 ZmG d9d: d:enZod;d< ZpG d=d> d>eZqdZdAdBZrdCdD ZsdEdF ZtdGdH ZuG dIdJ dJevZwe
fdKe
jxfdLdMZydNdO ZzdPdQ Z{dRdS Z|dTdU Z}G dVdW dWevZ~dS )[zH
Support for installing and building the "wheel" binary package format.
    )absolute_importN)urlsafe_b64encode)Parser)pkg_resources)ScriptMaker)get_export_entry)canonicalize_name)StringIO)
pep425tags)InstallationErrorInvalidWheelFilenameUnsupportedWheel)distutils_schemeget_major_minor_version)Link)
indent_log)has_delete_marker_file)captured_stdout
ensure_dirread_chunks)make_setuptools_shim_args)LOG_DIVIDERcall_subprocessformat_command_argsrunner_with_spinner_message)TempDirectory)MYPY_CHECK_RUNNING)open_spinner)unpack_file)path_to_url)DictListOptionalSequenceMappingTupleIOTextAnyIterableCallableSet)Requirement)InstallRequirement)RequirementPreparer)
WheelCache)	Pep425Tag.)   r   c                 C   s   t j| |t jjdS )N/)ospathrelpathreplacesep)srcp r:   4/tmp/pip-install-220asx0h/pip/pip/_internal/wheel.pynormpathO   s    r<      c              	   C   sR   t  }d}t| d.}t||dD ]}|t|7 }|| q$W 5 Q R X ||fS )z5Return (hash, length) for path using hashlib.sha256()r   rb)size)hashlibsha256openr   lenupdate)r4   	blocksizehlengthfblockr:   r:   r;   	hash_fileS   s    rJ   c                 C   s6   t | |\}}dt| dd }|t|fS )z?Return (encoded_digest, length) for path using hashlib.sha256()zsha256=latin1=)rJ   r   digestdecoderstripstr)r4   rE   rF   rG   rM   r:   r:   r;   rehash_   s    rQ   c                 C   s6   t jd dk ri }d}nddi}d}t| || f|S )Nr      bnewline )sysversion_inforB   )namemodenlbinr:   r:   r;   open_for_csvj   s    r\   c                 C   s   |  d}||d< d|S )zBReplace the Python tag in a wheel file name with a new value.
    -)splitjoin)	wheelnamenew_tagpartsr:   r:   r;   replace_python_tagu   s    
rd   c              	   C   s   t j| rt| dR}| }|ds8W 5 Q R  dS tjt	 }d| t j
d }| }W 5 Q R X t| d}|| || W 5 Q R X dS dS )	zLReplace #!python with #!/path/to/python
    Return True if file was changed.r>   s   #!pythonFs   #!asciiwbTN)r3   r4   isfilerB   readline
startswithrV   
executableencodegetfilesystemencodinglinesepreadwrite)r4   script	firstlineexenamerestr:   r:   r;   
fix_script~   s    

rt   zX^(?P<namever>(?P<name>.+?)(-(?P<ver>.+?))?)
                                \.dist-info$c              
   C   s   |  dd}t|D ]p}t|}|r|d|krttj||d6}|D ]*}|	 
 }|dkrP W 5 Q R   dS qPW 5 Q R X qdS )zP
    Return True if the extracted wheel in wheeldir should go into purelib.
    r]   _rX   WHEELzroot-is-purelib: trueTF)r6   r3   listdirdist_info_rematchgrouprB   r4   r`   lowerrO   )rX   wheeldirname_foldeditemry   wheelliner:   r:   r;   root_is_purelib   s    
 r   c              	      s   t j| si i fS t| 8}t }|D ]}||  |d q(|d W 5 Q R X tj	
|}|di }|di }dd  t fdd| D }t fd	d| D }||fS )
N
r   console_scriptsgui_scriptsc                 S   s   t | dddS )zRget the string representation of EntryPoint, remove space and split
        on '=' rU   rL   )rP   r6   r_   )sr:   r:   r;   	_split_ep   s    z"get_entrypoints.<locals>._split_epc                 3   s   | ]} |V  qd S Nr:   .0vr   r:   r;   	<genexpr>   s     z"get_entrypoints.<locals>.<genexpr>c                 3   s   | ]} |V  qd S r   r:   r   r   r:   r;   r      s     )r3   r4   existsrB   r	   ro   stripseekr   
EntryPoint	parse_mapgetdictvalues)filenamefpdatar   entry_pointsconsoleguir:   r   r;   get_entrypoints   s    
r   c                    sJ  | sdS t t}| D ]*}tj|}tj|}|| | qdd tj	dd
tjD   tjtjtj  fdd| D }|sdS g }| D ]b\}}t|}t|dkrd	|d
 }	n$dd|dd d |d  }	|d|	| qd}
t|dkr0||
d n||
d d|S )zDetermine if any scripts are not on PATH and format a warning.

    Returns a warning message if one or more scripts are not on PATH,
    otherwise None.
    Nc                 S   s    g | ]}t j|t jqS r:   )r3   r4   normcaserO   r7   )r   ir:   r:   r;   
<listcomp>   s    z5message_about_scripts_not_on_PATH.<locals>.<listcomp>PATHrU   c                    s&   i | ]\}}t j| kr||qS r:   )r3   r4   r   )r   
parent_dirscriptsnot_warn_dirsr:   r;   
<dictcomp>   s    z5message_about_scripts_not_on_PATH.<locals>.<dictcomp>r1   zscript {} isr   zscripts {} are, z and z.The {} installed in '{}' which is not on PATH.zeConsider adding {} to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.zthis directoryzthese directoriesr   )collectionsdefaultdictsetr3   r4   dirnamebasenameaddenvironr   r_   pathsepappendr   rV   rj   itemssortedrC   formatr`   )r   grouped_by_dirdestfiler   script_namewarn_for	msg_linesZdir_scriptssorted_scripts
start_textlast_line_fmtr:   r   r;   !message_about_scripts_not_on_PATH   sH    

 r   c                 C   s   t | dd dS )a;  
    Return the given rows of a RECORD file in sorted order.

    Each row is a 3-tuple (path, hash, size) and corresponds to a record of
    a RECORD file (see PEP 376 and PEP 427 for details).  For the rows
    passed to this function, the size can be an integer as an int or string,
    or the empty string.
    c                 S   s   t dd | D S )Nc                 s   s   | ]}t |V  qd S r   )rP   )r   xr:   r:   r;   r     s     z3sorted_outrows.<locals>.<lambda>.<locals>.<genexpr>)tuple)rowr:   r:   r;   <lambda>      z sorted_outrows.<locals>.<lambda>)key)r   )outrowsr:   r:   r;   sorted_outrows  s    r   c                 C   s   g }| D ]v}t |dkr(td| t|}|d }|||}||d< ||krpt|\}	}
|	|d< |
|d< |t| q|D ]*}t|\}	}
|t	|||	t
|
f q|D ]}||| ddf q|S )z_
    :param installed: A map from archive RECORD path to installation RECORD
        path.
    rR   z,RECORD line has more than three elements: {}r   r1      rU   )rC   loggerwarningr   listpoprQ   r   r   r<   rP   )old_csv_rows	installedchanged	generatedlib_dirinstalled_rowsr   old_pathnew_pathrM   rG   rH   r:   r:   r;   get_csv_rows_for_installed  s*    r   c                   @   s   e Zd ZdS )MissingCallableSuffixN)__name__
__module____qualname__r:   r:   r:   r;   r   =  s   r   c                 C   s*   t | }|d k	r&|jd kr&tt|d S r   )r   suffixr   rP   )specificationentryr:   r:   r;   _raise_for_invalid_entrypointA  s    r   c                       s   e Zd Zd fdd	Z  ZS )PipScriptMakerNc                    s   t | tt| ||S r   )r   superr   make)selfr   options	__class__r:   r;   r   H  s    zPipScriptMaker.make)N)r   r   r   r   __classcell__r:   r:   r   r;   r   G  s   r   FTc           -   
      s\  |st | |||||	d}t| 	r,|d n|d g g 	tjjtjj }i t  g }|rt 4}t	   t
d tj|ddd W 5 Q R X W 5 Q R X t|  d. 	fdd		d/fdd	}||d std tjd d}t|\fdd}D ]j}d
}d
}ttj	|D ]F}d
}|dkr`t}|}tj	||}|| }|||d||d qFq&td
|d }d|_dh|_d|_g }dd
}|rDdtjkr|d|  tjdddkr|dtjd |f  |dt |f  dd D }|D ]}|= q6dd
}|rdtjkrp|d|  |dt |f  dd D }|D ]}|= q| d d! ! D  d"d ! D }g }z.|"|}| | | |"|d#di W n> t#k
r> } z|j$d } t%d$&| W 5 d
}~X Y nX |
rbt'|}!|!d
k	rbt(|! tjd d%}"tjd d&}#t)|#d'}$|$*d( W 5 Q R X t+,|#|" ||" tjd d)}%tjd d*}&t-|%d+\}'t-|&d,F}(t./|'})t0|) |d-}*t.1|(}+t2|*D ]},|+3|, q&W 5 Q R X W 5 Q R X t+,|&|% d
S )0zInstall a wheel)userhomerootisolatedprefixpurelibplatlibignoreT)forcequietFc                    s.   t | }t |}||< |r* | dS )z6Map archive RECORD paths to installation RECORD paths.N)r<   r   )srcfiler   modifiedoldpathnewpath)r   r   r   r|   r:   r;   record_installed  s
    

z*move_wheel_files.<locals>.record_installedNc                    s  t | t| D ]\}}}|t| d  tjj}tj||}	|rf|tjjdd 	drfq|D ]}
tj|||
}|r|dkr|	dr 
|
 qjqj|rj|
	drjt|
tjrjrtd| d d 
| qj|D ]}|r||rqtj||}tj|||}t |	 tj|rFt| t|| t|}ttdr|t||j|jf t|tjrt|}|jtjB tjB tjB }t|| d	}|r||}||| qqd S )
Nr1   r   z.datarU   z
.dist-infoz!Multiple .dist-info directories: r   utimeF)r   r3   walkrC   lstripr4   r7   r`   r_   endswithr   r   ri   rX   AssertionErrorr   unlinkshutilcopyfilestathasattrr   st_atimest_mtimeaccessX_OKst_modeS_IXUSRS_IXGRPS_IXOTHchmod)sourcedestis_basefixerfilterdirsubdirsfilesbasedirdestdirr   
destsubdirrH   r   r   stpermissionsr   )	data_dirsinfo_dirr   reqr:   r;   clobber  s^    




z!move_wheel_files.<locals>.clobberz!%s .dist-info directory not foundr   zentry_points.txtc                    sh   |   dr| d d }n<|   dr8| d d }n |   drT| d d }n| }| kpf|kS )Nz.exez
-script.pyiz.pya)r{   r   )rX   	matchname)r   r   r:   r;   is_entrypoint_wrapper  s    z/move_wheel_files.<locals>.is_entrypoint_wrapperr   )r  r	  rU   pipENSUREPIP_OPTIONSzpip = 
altinstallz
pip%s = %sc                 S   s   g | ]}t d |r|qS )zpip(\d(\.\d)?)?$rery   r   kr:   r:   r;   r   0  s      z$move_wheel_files.<locals>.<listcomp>easy_installzeasy_install = zeasy_install-%s = %sc                 S   s   g | ]}t d |r|qS )zeasy_install(-\d\.\d)?$r  r  r:   r:   r;   r   @  s     c                 s   s   | ]}d | V  qdS )%s = %sNr:   r   kvr:   r:   r;   r   G  s    z#move_wheel_files.<locals>.<genexpr>c                 S   s   g | ]}d | qS )r!  r:   r"  r:   r:   r;   r   K  s    r   zInvalid script entry point: {} for req: {} - A callable suffix is required. Cf https://packaging.python.org/en/latest/distributing.html#console-scripts for more information.	INSTALLERzINSTALLER.piprf   s   pip
RECORDz
RECORD.piprzw+)r   r   r   r   )F)NN)4r   r   rO   r3   r4   r7   r   r   warningscatch_warningsfilterwarnings
compileallcompile_dirr   debuggetvaluer   r`   r   rw   rt   r   r  variantsset_moder   r   r   r   rV   rW   r   extendr   make_multipler   argsr   r   r   r   rB   ro   r   mover\   csvreaderr   writerr   writerow)-rX   r  r|   r   r   r   	pycompileschemer   r   warn_script_locationr  r   stdoutr  ep_filer  datadirr  r	  subdirr  makerZscripts_to_generate
pip_scriptpip_epr  easy_install_scripteasy_install_epZgui_scripts_to_generategenerated_console_scriptser   msg	installertemp_installerinstaller_filerecordtemp_record	record_in
record_outr5  r   r6  r   r:   )
r   r   r  r   r  r   r   r   r  r|   r;   move_wheel_filesM  s        



$F
#
 




 



   
"rN  c                 C   sr   zVdd t d| D d }|d}t |}|d  }ttt|	d}|W S  t
k
rl   Y dS X dS )z
    Return the Wheel-Version of an extracted wheel, if possible.

    Otherwise, return None if we couldn't parse / extract it.
    c                 S   s   g | ]}|qS r:   r:   )r   dr:   r:   r;   r     s     z!wheel_version.<locals>.<listcomp>Nr   rv   zWheel-Version.)r   find_on_pathget_metadatar   parsestrr   r   mapintr_   	Exception)
source_dirdist
wheel_dataversionr:   r:   r;   wheel_version  s    
r[  c                 C   sb   | st d| | d td kr>t d|dtt| f n | tkr^tddtt|  dS )a  
    Raises errors or warns if called with an incompatible Wheel-Version.

    Pip should refuse to install a Wheel-Version that's a major series
    ahead of what it's compatible with (e.g 2.0 > 1.1); and warn when
    installing a version only minor version ahead (e.g 1.2 > 1.1).

    version: a 2-tuple representing a Wheel-Version (Major, Minor)
    name: name of wheel or package to raise exception about

    :raises UnsupportedWheel: when an incompatible Wheel-Version is given
    z(%s is in an unsupported or invalid wheelr   zB%s's Wheel-Version (%s) is not compatible with this version of piprP  z*Installing from a newer Wheel-Version (%s)N)r   VERSION_COMPATIBLEr`   rT  rP   r   r   )rZ  rX   r:   r:   r;   check_compatibility  s    r]  c                 C   s
   d | S )z
    Format three tags in the form "<python_tag>-<abi_tag>-<platform_tag>".

    :param file_tag: A 3-tuple of tags (python_tag, abi_tag, platform_tag).
    r]   )r`   )Zfile_tagr:   r:   r;   
format_tag  s    r^  c                   @   s>   e Zd ZdZedejZdd Zdd Z	dd Z
d	d
 ZdS )WheelzA wheel filez^(?P<namever>(?P<name>.+?)-(?P<ver>.*?))
        ((-(?P<build>\d[^-]*?))?-(?P<pyver>.+?)-(?P<abi>.+?)-(?P<plat>.+?)
        \.whl|\.dist-info)$c                    s    j |}|std| | _|ddd _|ddd _|d _|d	d _
|d		d _|d
	d _ fdd j
D  _dS )zX
        :raises InvalidWheelFilename: when the filename is invalid for a wheel
        z!%s is not a valid wheel filename.rX   ru   r]   verbuildpyverrP  abiplatc                    s.   h | ]&} j D ]} jD ]}|||fqqqS r:   )abisplats)r   r   yzr   r:   r;   	<setcomp>  s      z!Wheel.__init__.<locals>.<setcomp>N)wheel_file_rery   r   r   rz   r6   rX   rZ  	build_tagr_   
pyversionsre  rf  	file_tags)r   r   
wheel_infor:   ri  r;   __init__  s    
zWheel.__init__c                 C   s   t dd | jD S )zF
        Return the wheel's tags as a sorted list of strings.
        c                 s   s   | ]}t |V  qd S r   )r^  r   tagr:   r:   r;   r     s     z0Wheel.get_formatted_file_tags.<locals>.<genexpr>)r   rn  ri  r:   r:   r;   get_formatted_file_tags  s    zWheel.get_formatted_file_tagsc                    s   t  fdd| jD S )a  
        Return the lowest index that one of the wheel's file_tag combinations
        achieves in the given list of supported tags.

        For example, if there are 8 supported tags and one of the file tags
        is first in the list, then return 0.

        :param tags: the PEP 425 tags to check the wheel against, in order
            with most preferred first.

        :raises ValueError: If none of the wheel's file tags match one of
            the supported tags.
        c                 3   s    | ]}| kr  |V  qd S r   )indexrq  tagsr:   r;   r     s      z*Wheel.support_index_min.<locals>.<genexpr>)minrn  r   rv  r:   ru  r;   support_index_min  s    zWheel.support_index_minc                 C   s   | j | S )z
        Return whether the wheel is compatible with one of the given tags.

        :param tags: the PEP 425 tags to check the wheel against.
        )rn  
isdisjointrx  r:   r:   r;   	supported  s    zWheel.supportedN)r   r   r   __doc__r  compileVERBOSErk  rp  rs  ry  r{  r:   r:   r:   r;   r_    s   r_  z([a-z0-9_.]+)-([a-z0-9_.!+-]+)c                 C   s   t || S )zjDetermine whether the string looks like an egg_info.

    :param s: The string to parse. E.g. foo-2.1
    )boolsearch)r   _egg_info_rer:   r:   r;   _contains_egg_info  s    r  c                 C   s   | j r
dS | jr&|s"td| j dS |s.dS | js:| js>dS || sXtd| j dS | jrj| jjrjdS | j}|	 \}}|rt
|rdS dS )a[  
    Return whether to build an InstallRequirement object using the
    ephemeral cache.

    :param cache_available: whether a cache directory is available for the
        should_unpack=True case.

    :return: True or False to build the requirement with ephem_cache=True
        or False, respectively; or None not to build the requirement.
    Nz(Skipping %s, due to already being wheel.FzCSkipping wheel build for %s, due to binaries being disabled for it.T)
constraintis_wheelr   inforX   editablerW  linkZis_vcssplitextr  )r  should_unpackcache_availablecheck_binary_allowedr  baseextr:   r:   r;   should_use_ephemeral_cache  s4     r  c                 C   s^   t | }d|}|s |d7 }n:t tjkr8|d7 }n"|dsJ|d7 }|d|t7 }|S )z1
    Format command information for logging.
    zCommand arguments: {}
zCommand output: Nonez'Command output: [use --verbose to show]r   zCommand output:
{}{})r   r   r   getEffectiveLevelloggingDEBUGr   r   )command_argscommand_outputcommand_desctextr:   r:   r;   format_command_resultG  s    



r  c                 C   sx   t | } | s4d|j}|t||7 }t| dS t| dkrfd|j| }|t||7 }t| tj	|| d S )zH
    Return the path to the wheel in the temporary build directory.
    z1Legacy build of wheel for {!r} created no files.
Nr1   zZLegacy build of wheel for {!r} created more than one file.
Filenames (choosing first): {}
r   )
r   r   rX   r  r   r   rC   r3   r4   r`   )namestemp_dirr  r  r  rF  r:   r:   r;   get_legacy_build_wheel_path^  s$    
 
r  c                 C   s   dS )NTr:   )ru   r:   r:   r;   _always_true~  s    r  c                   @   s\   e Zd ZdZdddZdddZddd	Zd
d ZdddZdddZ	dd Z
dddZdS )WheelBuilderz#Build wheels from a RequirementSet.NFc                 C   sD   |d krt }|| _|| _|j| _|p&g | _|p0g | _|| _|| _d S r   )	r  preparerwheel_cachewheel_download_dir
_wheel_dirbuild_optionsglobal_optionsr  no_clean)r   r  r  r  r  r  r  r:   r:   r;   rp    s    


zWheelBuilder.__init__c              
   C   s.   |j  | j|||dW  5 Q R  S Q R X dS )ziBuild one wheel.

        :return: The filename of the built wheel, or None if the build failed.
        
python_tagN)	build_env_build_one_inside_env)r   r  
output_dirr  r:   r:   r;   
_build_one  s    zWheelBuilder._build_onec              
   C   s   t dd}|jr| j}n| j}|||j|d}|d k	rtj|}tj||}zNt|\}	}
t	
|| td|j||
|	  td| |W W  5 Q R  S  tk
r   Y nX | | W 5 Q R  d S Q R X d S )Nr   )kindr  z3Created wheel for %s: filename=%s size=%d sha256=%szStored in directory: %s)r   
use_pep517_build_one_pep517_build_one_legacyr4   r3   r   r`   rJ   r   r3  r   r  rX   	hexdigestrV  
_clean_one)r   r  r  r  r  builder
wheel_path
wheel_name	dest_pathZ
wheel_hashrG   r:   r:   r;   r    s.      
z"WheelBuilder._build_one_inside_envc                 C   s   t |j| jddS )NT)r  Zunbuffered_output)r   Zsetup_py_pathr  )r   r  r:   r:   r;   _base_setup_args  s
    zWheelBuilder._base_setup_argsc              	   C   s   |j dk	st| jr*td|jf  dS z~td| td|j}|j	}|
| |j||j d}W 5 Q R X |rt||}ttj||tj|| |}W n$ tk
r   td|j Y dS X tj||S )zBuild one InstallRequirement using the PEP 517 build process.

        Returns path to wheel if successfully built. Otherwise, returns None.
        NzGCannot build wheel for %s using PEP 517 when --build-options is presentDestination directory: %szBuilding wheel for {} (PEP 517))metadata_directoryFailed building wheel for %s)r  r   r  r   errorrX   r,  r   r   pep517_backendsubprocess_runnerbuild_wheelrd   r3   renamer4   r`   rV  )r   r  tempdr  runnerbackendr  new_namer:   r:   r;   r    s8    

zWheelBuilder._build_one_pep517c              
   C   s   |  |}d|jf }t|}td| |dd|g | j }|dk	rT|d|g7 }zt||j|d}W n8 tk
r   |	d t
d	|j Y W 5 Q R  dS X t|}	t|	||||d
}
|
W  5 Q R  S Q R X dS )zBuild one InstallRequirement using the "legacy" build process.

        Returns path to wheel if successfully built. Otherwise, returns None.
        z Building wheel for %s (setup.py)r  bdist_wheelz-dNz--python-tag)cwdspinnerr  r  )r  r  r  r  r  )r  rX   r   r   r,  r  r   Zunpacked_source_directoryrV  finishr  r3   rw   r  )r   r  r  r  	base_argsspin_messager  
wheel_argsoutputr  r  r:   r:   r;   r    s8    




zWheelBuilder._build_one_legacyc                 C   sb   |  |}td|j |ddg }zt||jd W dS  tk
r\   td|j Y dS X d S )NzRunning setup.py clean for %scleanz--all)r  Tz Failed cleaning build dir for %sF)r  r   r  rX   r   rW  rV  r  )r   r  r  
clean_argsr:   r:   r;   r    s    
zWheelBuilder._clean_onec                 C   s  |r
| j r|s| j stg }t| jj}|D ]\}t|||| jd}|dkrLq,|rt|rd| j|j}qz| j	|j}n| j }|
||f q,|sg S tdddd |D  d}|rtj}t  g g  }	}
|D ]\}}zt| W nF tk
r. } z&td|j| |

| W Y qW 5 d}~X Y nX | j|||d}|r|	
| |r|jrrt|jsrtd	|  || jj|_tt||_|jjstt|jj |j q|

| qW 5 Q R X |	rtd
ddd |	D  |
rtdddd |
D  |
S )a  Build wheels.

        :param should_unpack: If True, after building the wheel, unpack it
            and replace the sdist with the unpacked version in preparation
            for installation.
        :return: True if all the wheels built correctly.
        )r  r  r  Nz*Building wheels for collected packages: %sr   c                 S   s   g | ]\}}|j qS r:   rX   )r   r  ru   r:   r:   r;   r   \  s     z&WheelBuilder.build.<locals>.<listcomp>z Building wheel for %s failed: %sr  zbad source dir - missing markerzSuccessfully built %sr   c                 S   s   g | ]
}|j qS r:   r  r   r  r:   r:   r;   r     s     zFailed to build %sc                 S   s   g | ]
}|j qS r:   r  r  r:   r:   r;   r     s     )!r  r   r  r  	cache_dirr  r  get_ephem_path_for_linkr  get_path_for_linkr   r   r  r`   r
   implementation_tagr   r   OSErrorr   rX   r  rW  r   remove_temporary_sourceZensure_build_locationr  	build_dirr   r   r  r   	file_path)r   requirementsr  buildsetr  r  ephem_cacher  r  build_successbuild_failurerE  
wheel_filer:   r:   r;   ra  #  s    

 
 
zWheelBuilder.build)NNNF)N)N)N)N)F)r   r   r   r|  rp  r  r  r  r  r  r  ra  r:   r:   r:   r;   r    s       




'
% r  )r=   )r=   )FNNTNFNT)r|  
__future__r   r   r*  r4  r@   r  os.pathr3   r  r   r   rV   r'  base64r   email.parserr   pip._vendorr   pip._vendor.distlib.scriptsr   Zpip._vendor.distlib.utilr   pip._vendor.packaging.utilsr   pip._vendor.sixr	   pip._internalr
   pip._internal.exceptionsr   r   r   pip._internal.locationsr   r   pip._internal.models.linkr   pip._internal.utils.loggingr   Z pip._internal.utils.marker_filesr   pip._internal.utils.miscr   r   r   $pip._internal.utils.setuptools_buildr   Zpip._internal.utils.subprocessr   r   r   r   pip._internal.utils.temp_dirr   pip._internal.utils.typingr   pip._internal.utils.uir   Zpip._internal.utils.unpackingr   Zpip._internal.utils.urlsr   typingr    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   Z"pip._vendor.packaging.requirementsr,   Zpip._internal.req.req_installr-    pip._internal.operations.preparer.   pip._internal.cacher/   pip._internal.pep425tagsr0   rP   ZInstalledCSVRowr  ZBinaryAllowedPredicater\  	getLoggerr   r   r<   rJ   rQ   r\   rd   rt   r}  r~  rx   r   r   r   r   r   rV  r   r   r   rN  r[  r]  r^  objectr_  Ir  r  r  r  r  r  r:   r:   r:   r;   <module>   s   8


	 =$
        
  4
J
	: 