`8(Zc@sdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z ddlmZddlmZddlmZddlZdd lmZmZmZmZdd lmZmZdd lmZdd lm Z m!Z!dd l"m#Z#ddl$mZm"Z"ddl$m%Z&ej'Z'ej(Z(dZ)dZ*dZ+de fdYZ,dS(sI Create a wheel (.whl) distribution. A wheel is a built archive format. iN(t Generator(tCommand(tget_python_version(tlog(trmtreei(t get_abbr_implt get_impl_vert get_abi_tagt get_platform(tnativet open_for_csv(tarchive_wheelfile(t read_pkg_infotwrite_pkg_info(tpkginfo_to_dict(t pep425tagstmetadata(t __version__scp3\dcCst|jddS(Nt-t_(t safe_nametreplace(tname((s0/tmp/pip-build-0nEYGB/wheel/wheel/bdist_wheel.pyt safer_name'scCst|jddS(NRR(t safe_versionR(tversion((s0/tmp/pip-build-0nEYGB/wheel/wheel/bdist_wheel.pyt safer_version+st bdist_wheelcBs eZdZd1dddefddd d fd2d4d5d6d7d8dd3dedfd9d:g ZddddgZd!Zd"Z e d#Z d$Z d%Z d&Zd'ed(d)Zd*Zd+Zd,Zd-Zd.Zd/Zd0ZRS(;screate a wheel distributions bdist-dir=tbs1temporary directory for creating the distributions plat-name=tps;platform name to embed in generated filenames (default: %s)s keep-temptks/keep the pseudo-installation tree around after s!creating the distribution archives dist-dir=tds-directory to put final built distributions ins skip-builds2skip rebuilding everything (for testing/debugging)trelatives6build the archive using relative paths(default: false)sowner=tus@Owner name used when creating a tar file [default: current user]sgroup=tgsAGroup name used when creating a tar file [default: current group]t universals'make a universal wheel (default: false)s python-tag=s7Python implementation compatibility tag (default: py%s)is build-number=sqBuild number for this particular version. As specified in PEP-0427, this must start with a digit. [default: None]spy-limited-api=s?Python tag (cp32|cp33|cpNN) for abi3 wheel tag (default: false)cCsd|_d|_d|_d|_d|_t|_d|_d|_ d|_ d|_ d|_ t|_ d|_d|_t|_dtd|_d|_t|_t|_dS(Ntziptpyi(tNonet bdist_dirtdata_dirt plat_nametplat_tagtformattFalset keep_temptdist_dirt distinfo_dirt egginfo_dirt root_is_puret skip_buildR townertgroupR#Rt python_tagt build_numbertpy_limited_apitplat_name_supplied(tself((s0/tmp/pip-build-0nEYGB/wheel/wheel/bdist_wheel.pytinitialize_optionsYs&                 cCsZ|jdkr<|jdj}tjj|d|_n|jd|_|j dk |_ d}|j dt |||j jp|j j |_|jrtjt|j rtdtn|j jd}d|kr$|dd j}|jdkr$t|_q$n|jdk rV|jd j rVtd ndS(Ntbdisttwheels.dataR.R)R2spy-limited-api must match '%s'R#it1ttruetyess1Build tag (build-number) must start with a digit.(sdist_dirs plat_names skip_build(R=struesyes(R'R&tget_finalized_commandt bdist_basetostpathtjointwheel_dist_nameR(R)R8tset_undefined_optionsR$t distributionthas_ext_modulesthas_c_librariesR1R7tretmatchtPY_LIMITED_API_PATTERNt ValueErrortget_option_dicttstriptlowertTrueR#R6tisdigit(R9RAt need_optionsR<tval((s0/tmp/pip-build-0nEYGB/wheel/wheel/bdist_wheel.pytfinalize_optionsns&  #cCsSt|jjt|jjf}|jrF||jf7}ndj|S(s4Return distribution full name with - replaced with _R(RRGtget_nameRt get_versionR6RD(R9t components((s0/tmp/pip-build-0nEYGB/wheel/wheel/bdist_wheel.pyREs  cCs|jr|j}nH|jr'd}n6|jp6t}|dkr]tjdkr]d}n|jddjdd}|jr|jrd }n |j}|d |f}nt }t }||}|j r||j d r|j }d }nt tj}|||f}tjd |jr7|nd}|j sv||dksvtd||dfn||kstdj||S(Ntanys linux-x86_64t linux_x86_64it linux_i686RRt.spy2.py3tnonetcp3tabi3tsupplied_platformis%s != %ss)would build wheel with unsupported tag {}(s linux-x86_64s linux_x86_64(R8R)R1RtsystmaxsizeRR#R5RRR7t startswithtstrRRPRt get_supportedR&tAssertionErrorR+(R9R)timplttagt impl_nametimpl_vertabi_tagtsupported_tags((s0/tmp/pip-build-0nEYGB/wheel/wheel/bdist_wheel.pytget_tags6                -!cCs2|j\}}}d|j|||f}|S(s%Return archive name without extensions %s-%s-%s-%s(RmRE(R9timpl_tagRkR*tarchive_basename((s0/tmp/pip-build-0nEYGB/wheel/wheel/bdist_wheel.pytget_archive_basenames c Cs|jd}d|_|js1|jdn|jddt}|j|_t|_|j|_t|_ |jd}t|_ x4dD],}t |d |t j j|j|qWd }t jdkr t j jt j j|jd}||_|_nt ||jr dnd|tjd|j|jd|j}t j j|j|}|js|j}n$t j j|j|j|j}|jddt j j|jd|j|_|j|j |j|j!|j|j"|j|jt j j#|js=t j$|jnt%||} dt j&kr{t'j(t j&dd| gnt)|j*dgj+dt,| f|j-s|j.rtjd|jqt/|jndS(Nt build_scriptstpythontbuildtinstalltreinit_subcommandstinstall_scriptstheaderstscriptstdatatpurelibtplatlibtinstall_ttnts..tinstall_purelibtinstall_platlibsinstalling to %stinstall_egg_infottargetR0s %s.dist-infot WHEEL_TOOLtsignt dist_filesRs removing %s(sheaderssscriptssdataspurelibsplatlib(stargets egginfo_dir(0treinitialize_commandt executableR2t run_commandRQR'trootR,tcompiletwarn_dirtno_eptsetattrRBRCRDR(Rtnormpathtinstall_libbaset install_libR1tloggertinfoRpR.R t_ensure_relativet install_baseRFRER/tegg2distR0twrite_wheelfilet write_recordtexiststmakedirsR tenviront subprocesstcalltgetattrRGtappendRR-tdry_runR( R9RqRtRvtkeytbasedir_observedRotpseudoinstall_roott archive_roott wheel_name((s0/tmp/pip-build-0nEYGB/wheel/wheel/bdist_wheel.pytrunsf          $           s bdist_wheel (t)c Cs>ddlm}|}d|d<||ds sdependency_links.txttrtMETADATAs metadata.jsonRGt descriptionsDESCRIPTION.rsttwbsutf-8t extensionsspython.detailstdocument_namess LICENSE.txttlicenseRt sort_keys(RBRCRtglobRDtdirnametbasenameRMtisfileRtmkdirRtcopytreeRtreadROR RRRGtpoptwritetencodeRtcopyR/tjsontdumpRQ(R9t egginfo_patht distinfo_pathRRtpattpossibleterrtaltRRtdependency_links_pathtdependency_links_filetdependency_linksRtmetadata_json_pathtpymetatdescription_filenametdescription_texttdescription_pathtdescription_fileRtlicense_filenamet metadata_json((s0/tmp/pip-build-0nEYGB/wheel/wheel/bdist_wheel.pyRqs\   !          "c s_ddlm}tjj|d}tjj|fd}fd}t|d}tj|}x|D]} tjj| } || rd} d} n[t | d} | j }WdQXt j |j }d t||} t|} tjj| jtjjd }|j|| | fqWWdQXdS( Ni(turlsafe_b64encodetRECORDc3s\xUtjD]D\}}}|jx(t|D]}tjj||Vq6WqWdS(N(RBtwalktsorttsortedRCRD(tdirtdirstfilesR(R'(s0/tmp/pip-build-0nEYGB/wheel/wheel/bdist_wheel.pyRs cs |kS(s!Wheel hashes every possible file.((RC(trecord_relpath(s0/tmp/pip-build-0nEYGB/wheel/wheel/bdist_wheel.pytskipssw+R}trbssha256=t/(tutilRRBRCRDtrelpathR tcsvtwriterRRthashlibtsha256tdigestR tlenRRtwriterow(R9R'R/Rt record_pathRRt record_fileR RCR thashtsizeRRyR((R'Rs0/tmp/pip-build-0nEYGB/wheel/wheel/bdist_wheel.pyRs(    (s bdist-dir=Rs1temporary directory for creating the distribution(s dist-dir=Rs-directory to put final built distributions inN(s skip-buildNs2skip rebuilding everything (for testing/debugging)(srelativeNs6build the archive using relative paths(default: false)(sowner=R!s@Owner name used when creating a tar file [default: current user](sgroup=R"sAGroup name used when creating a tar file [default: current group](s universalNs'make a universal wheel (default: false)(s build-number=NsqBuild number for this particular version. As specified in PEP-0427, this must start with a digit. [default: None](spy-limited-api=Ns?Python tag (cp32|cp33|cpNN) for abi3 wheel tag (default: false)(t__name__t __module__RRR&Rt user_optionstboolean_optionsR:RUtpropertyRERmRpRt wheel_versionRRRRRRRR(((s0/tmp/pip-build-0nEYGB/wheel/wheel/bdist_wheel.pyR/sV     & S    "  R(-t__doc__R RRBRRRRRaRJtemail.generatorRtdistutils.coreRtdistutils.sysconfigRt distutilsRRRt pkg_resourcesRRRRRR R R tarchiveR tpkginfoR R RRR}RRRRRLRRR(((s0/tmp/pip-build-0nEYGB/wheel/wheel/bdist_wheel.pyts8          "