3

Q'íc>ã@s¬dZddlmZddlZddlZddlZddlZddlZddlm	Z	m
Z
mZddlm
Z
ddlm	ZddlmZddlmZejd	ejƒjZd
Zdd„ZGd
d„deƒZdS)zWheels support.é)Úget_platformN)ÚDistributionÚPathMetadataÚ
parse_version)ÚPY3)r)Ú
pep425tags)Úwrite_requirementsz‚^(?P<project_name>.+?)-(?P<version>\d.*?)
    ((-(?P<build>\d.*?))?-(?P<py_version>.+?)-(?P<abi>.+?)-(?P<platform>.+?)
    )\.whl$zštry:
    __import__('pkg_resources').declare_namespace(__name__)
except ImportError:
    __path__ = __import__('pkgutil').extend_path(__path__, __name__)
cCsðx¸tj|ƒD]ª\}}}tjj||ƒ}x6|D].}tjj||ƒ}tjj|||ƒ}tj||ƒq*WxXttt|ƒƒƒD]D\}	}
tjj||
ƒ}tjj|||
ƒ}tjj	|ƒsntj||ƒ||	=qnWqWx0tj|ddD]\}}}|sÞt
‚tj|ƒqÊWdS)zDMove everything under `src_dir` to `dst_dir`, and delete the former.T)ÚtopdownN)ÚosÚwalkÚpathÚrelpathÚjoinÚrenamesÚreversedÚlistÚ	enumerateÚexistsÚAssertionErrorÚrmdir)Úsrc_dirZdst_dirÚdirpathÚdirnamesÚ	filenamesÚsubdirÚfÚsrcÚdstÚnÚd©r ú6/tmp/pip-build-l_bcah40/setuptools/setuptools/wheel.pyÚunpacks

r"c@s4eZdZdd„Zdd„Zdd„Zdd„Zd	d
„ZdS)ÚWheelcCsTttjj|ƒƒ}|dkr$td|ƒ‚||_x$|jƒjƒD]\}}t|||ƒq8WdS)Nzinvalid wheel name: %r)	Ú
WHEEL_NAMEr
rÚbasenameÚ
ValueErrorÚfilenameÚ	groupdictÚitemsÚsetattr)Úselfr'ÚmatchÚkÚvr r r!Ú__init__7szWheel.__init__cCs&tj|jjdƒ|jjdƒ|jjdƒƒS)z>List tags (py_version, abi, platform) supported by this wheel.Ú.)Ú	itertoolsÚproductÚ
py_versionÚsplitÚabiÚplatform)r+r r r!Útags?s
z
Wheel.tagscs$tjƒ‰t‡fdd„|jƒDƒdƒS)z5Is the wheel is compatible with the current platform?c3s|]}|ˆkrdVqdS)TNr )Ú.0Út)Úsupported_tagsr r!ú	<genexpr>Hsz&Wheel.is_compatible.<locals>.<genexpr>F)rÚ
get_supportedÚnextr7)r+r )r:r!Ú
is_compatibleEszWheel.is_compatiblecCs*t|j|j|jdkrdntƒdjƒdS)NÚany)Úproject_nameÚversionr6z.egg)rr@rAr6rÚegg_name)r+r r r!rBJszWheel.egg_namecstj|jƒô‰d|j|jf}d|‰d|‰‡‡fdd„}|dƒ}|dƒ}t|jdƒƒ}td	ƒ|kovtd
ƒknsˆtd|ƒ‚tj	|ƒˆj
|ƒtjj|ˆƒ‰t
j|ˆt|ˆƒd‰d
d„‰tttˆˆjƒƒƒƒ‰‡‡‡fdd„ˆjDƒ}tjj|dƒ}tjˆ|ƒtjtjj|dƒtjj|dƒƒttˆ|dd}	t|	jdƒdtjj|dƒƒtjj|ˆƒ‰tjjˆdƒ}
tjj|
ƒrtjj|ddƒ}tj	|ƒxVtj|
ƒD]H}|jdƒrÔtjtjj|
|ƒƒn tjtjj|
|ƒtjj||ƒƒq®Wtj|
ƒx0ttjj‡fdd„d$DƒƒD]}
t |
|ƒq"WtjjˆƒrNtjˆƒtjj|d ƒ}tjj|ƒrþt!|ƒ}|j"ƒj#ƒ}WdQRXxr|D]j}tjj|f|j#d!ƒžŽ}tjj|d"ƒ}tjj|ƒrtjj|ƒrt!|d#ƒ}|j$t%ƒWdQRXqWWdQRXdS)%z"Install wheel as an egg directory.z%s-%sz%s.dist-infoz%s.datac	sHˆjdˆ|fƒ,}tr&|jƒjdƒn|jƒ}tjjƒj|ƒSQRXdS)Nz%s/%szutf-8)ÚopenrÚreadÚdecodeÚemailÚparserÚParserÚparsestr)ÚnameÚfpÚvalue)Ú	dist_infoÚzfr r!Úget_metadataVsz*Wheel.install_as_egg.<locals>.get_metadataÚWHEELÚMETADATAz
Wheel-Versionz1.0z2.0dev0z$unsupported wheel format version: %s)ÚmetadatacSsd|_t|ƒS)N)ÚmarkerÚstr)Úreqr r r!Úraw_reqlsz%Wheel.install_as_egg.<locals>.raw_reqc	s6i|].}tt‡fdd„tˆˆj|fƒƒDƒƒƒ|“qS)c3s|]}|ˆkr|VqdS)Nr )r8rU)Úinstall_requiresr r!r;rsz2Wheel.install_as_egg.<locals>.<dictcomp>.<genexpr>)rÚsortedÚmapÚrequires)r8Úextra)ÚdistrWrVr r!ú
<dictcomp>psz(Wheel.install_as_egg.<locals>.<dictcomp>zEGG-INFOzPKG-INFO)rWÚextras_require)ÚattrsÚegg_infoNzrequires.txtÚscriptsz.pycc3s|]}tjjˆ|ƒVqdS)N)r
rr)r8r)Ú	dist_datar r!r;“sz'Wheel.install_as_egg.<locals>.<genexpr>ÚdataÚheadersÚpurelibÚplatlibznamespace_packages.txtr0z__init__.pyÚw)rcrdrerf)&ÚzipfileÚZipFiler'r@rArÚgetr&r
ÚmkdirÚ
extractallrrrÚ
from_locationrrrXrYrZÚextrasÚrenameÚSetuptoolsDistributionÚdictrÚget_command_objrÚlistdirÚendswithÚunlinkrÚfilterr"rCrDr4ÚwriteÚNAMESPACE_PACKAGE_INIT)r+Zdestination_eggdirZ
dist_basenamerOZwheel_metadataZ
dist_metadataÚ
wheel_versionr^r`Z
setup_distZdist_data_scriptsZegg_info_scriptsÚentryrZnamespace_packagesrKÚmodZmod_dirZmod_initr )r\rbrMrWrVrNr!Úinstall_as_eggPsr 










zWheel.install_as_eggN)Ú__name__Ú
__module__Ú__qualname__r/r7r>rBr|r r r r!r#5s
r#)Ú__doc__Údistutils.utilrrFr1r
ÚrerhÚ
pkg_resourcesrrrZsetuptools.extern.sixrÚ
setuptoolsrprZsetuptools.command.egg_inforÚcompileÚVERBOSEr,r$rxr"Úobjectr#r r r r!Ú<module>s"