ó â\e[c@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 CsAd }|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 ƒ}ni|d 6|d 6| d 6|d 6S(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 startswithtreplacetgroup( t wininfo_namet egginfo_nametegginfotw_nametseptresttrest2tw_pyvertw_vertw_arch((s4/tmp/pip-install-0xiv62/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 tnamelistRtostpathtbasenametTruetinfolisttfilenameRtFalsetsplittlowertgett NameToInfotappendtendswithRttempfiletmkdtempt extractallRtjointwheelt bdist_wheelt distutilstdistt Distributiont_bdist_wheel_tagt root_is_puret python_tagtplat_name_suppliedt plat_nametfull_tag_suppliedtfull_tagtegg2disttwrite_wheelfilet write_recordRR(R0tdest_dirtbdwRR4tinfotroot_is_purelibtzipinfotpathst dist_infotdatadirtmemberstkeyR1tbasepathtoldnametnewnameRR(tdirtabiR R t wheel_nametbwt dist_info_dir((s4/tmp/pip-install-0xiv62/wheel/wheel/wininst2wheel.pytbdist_wininst2wheelZs†             " (       REcBseZeZdZd„ZRS(cCs6|jr|jdk r|jStt|ƒjƒSdS(N(RJRKR tsuperREtget_tag(tself((s4/tmp/pip-install-0xiv62/wheel/wheel/wininst2wheel.pyRcÁsN(t__name__t __module__R5RJR RKRc(((s4/tmp/pip-install-0xiv62/wheel/wheel/wininst2wheel.pyRE¸scCsÝtƒ}|jdddddƒ|jdddtjjdd ƒ|jd d d d ƒ|jƒ}xp|jD]e}x\t|ƒD]N}|jr°dj |ƒGHt j j ƒnt ||jƒ|jrƒdGHqƒqƒWqpWdS(Nt installerstnargst*thelpsInstallers to converts --dest-dirs-dtdefaults/Directory to store wheels (default %(default)s)s --verboses-vtactiont store_trues{}... tOK(Rt add_argumentR/R0tcurdirt parse_argsRgRtverbosetformattsyststdouttflushRaRO(tparsertargstpatt installer((s4/tmp/pip-install-0xiv62/wheel/wheel/wininst2wheel.pytmainÈs    t__main__(tdistutils.distRBtos.pathR/treRtR<R,targparseRtglobRtshutilRtwheel.bdist_wheelR@t wheel.archiveRtcompiletVERBOSER RR0RpRaRARER{Re(((s4/tmp/pip-install-0xiv62/wheel/wheel/wininst2wheel.pyts$        G^