ó `8(Zc@sddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z ddlZddlmZejdejƒZd„Zejjd„Zd ejjfd „ƒYZd „Zed krÿeƒndS( iÿÿÿÿN(tArgumentParser(tiglob(trmtree(tarchive_wheelfilesX(^|/)(?P[^/]+?)-(?P.+?) (-(?P.+?))?(-(?P.+?))?.egg-info(/|$)c Cs@d }|r:tj|ƒ}|s:td|fƒ‚q:n|jdƒ\}}}|sntd|fƒ‚n|d }|jdƒ\}}}|rÀ|jdƒrÀ|}|jddƒ}nd}|jdƒ\}}} |sútd|fƒ‚n|r!|jd ƒ}|jd ƒ}nt d |d |d | d |ƒS(stExtract metadata from filenames. Extracts the 4 metadataitems needed (name, version, pyversion, arch) from the installer filename and the name of the egg-info directory embedded in the zipfile (if any). The egginfo filename has the format:: name-ver(-pyver)(-arch).egg-info The installer filename has the format:: name-ver.arch(-pyver).exe Some things to note: 1. The installer filename is not definitive. An installer can be renamed and work perfectly well as an installer. So more reliable data should be used whenever possible. 2. The egg-info data should be preferred for the name and version, because these come straight from the distutils metadata, and are mandatory. 3. The pyver from the egg-info data should be ignored, as it is constructed from the version of Python used to build the installer, which is irrelevant - the installer filename is correct here (even to the point that when it's not there, any version is implied). 4. The architecture must be taken from the installer filename, as it is not included in the egg-info data. 5. Architecture-neutral installers still have an architecture because the installer format itself (being executable) is architecture-specific. We should therefore ignore the architecture if the content is pure-python. s!Egg info filename %s is not validt-s"Installer filename %s is not validiüÿÿÿtpyt.tspy2.py3tnametvertarchtpyverN( tNonet egg_info_retsearcht ValueErrort partitiont rpartitiont startswithtreplacetgrouptdict( t wininfo_namet egginfo_nametegginfotw_nametseptresttrest2tw_pyvertw_vertw_arch((s2/tmp/pip-build-0nEYGB/wheel/wheel/wininst2wheel.pyt parse_infos*! cCs’tj|ƒ}d}x*|jƒD]}d|kr"|}Pq"q"Wttjj|ƒ|ƒ}t}x0|j ƒD]"}|j j dƒrpt }PqpqpW|r¬idd6}n idd6}d|} d| } g} d}x|j ƒD]ó}|j j dd ƒ\} } | jƒ} |j| dƒ}|dkrH| | jƒd}n|j }|| }||_ |j|=||j|<|r‘| j|ƒn|sæ|jdƒr¯|}qÙd |krÙ|jdƒ\}}}qÙqæqæWtjd d ƒ}|j|| ƒd }|d}|dpdjddƒjddƒ}|rFd}n|dkrg|jddƒ}ndj| |||fƒ}|r¦tjjtjjƒƒ}nttjjƒƒ}||_||_ t|_!|dpãd|_"|s t|_#|||f|_$ntjj|d| ƒ}|j%tjj||ƒ|ƒ|j&|ddƒ|j'||ƒt(tjj||ƒ|ƒt)|ƒdS(Ns .egg-infotPLATLIBRtpurelibtplatlibs%(name)s-%(ver)ss%s.data/t/is .egg-info/tsuffixt_b2wtnoneR R tanyRt_RRtcps %s.dist-infot generatort wininst2wheel(*tzipfiletZipFileR tnamelistR tostpathtbasenametTruetinfolisttfilenameRtFalsetsplittlowertgett NameToInfotappendtendswithRttempfiletmkdtempt extractallRtjointwheelt bdist_wheelt distutilstdistt Distributiont_bdist_wheel_tagt root_is_puret python_tagtplat_name_suppliedt plat_nametfull_tag_suppliedtfull_tagtegg2disttwrite_wheelfilet write_recordRR(R1tdest_dirtbdwRR5tinfotroot_is_purelibtzipinfotpathst dist_infotdatadirtmemberstkeyR2tbasepathtoldnametnewnameRR)tdirtabiR R t wheel_nametbwt dist_info_dir((s2/tmp/pip-build-0nEYGB/wheel/wheel/wininst2wheel.pytbdist_wininst2wheelZs†             " (       RFcBseZeZdZd„ZRS(cCs6|jr|jdk r|jStt|ƒjƒSdS(N(RKRLR tsuperRFtget_tag(tself((s2/tmp/pip-build-0nEYGB/wheel/wheel/wininst2wheel.pyRdÁsN(t__name__t __module__R6RKR RLRd(((s2/tmp/pip-build-0nEYGB/wheel/wheel/wininst2wheel.pyRF¸scCsætƒ}|jdddddƒ|jdddtjjdd ƒ|jd d d d ƒ|jƒ}xy|jD]n}xet|ƒD]W}|jr®t j j dj |ƒƒnt ||jƒ|jrƒt j j dƒqƒqƒWqpWdS(Nt installerstnargst*thelpsInstallers to converts --dest-dirs-dtdefaults/Directory to store wheels (default %(default)s)s --verboses-vtactiont store_trues{0}... sOK (Rt add_argumentR0R1tcurdirt parse_argsRhRtverbosetsyststdouttwritetformatRbRP(tparsertargstpatt installer((s2/tmp/pip-build-0nEYGB/wheel/wheel/wininst2wheel.pytmainÈs    t__main__(tdistutils.distRCtos.pathR0treRsR=R-targparseRtglobRtshutilRtwheel.bdist_wheelRAt wheel.archiveRtcompiletVERBOSER R R1RpRbRBRFR{Rf(((s2/tmp/pip-build-0nEYGB/wheel/wheel/wininst2wheel.pyts$        G^