Edc@sdZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddlm Z ddlmZddlmZddlmZdd lmZdd lmZmZddlZd d lmZd d lmZd dlmZd dlm Z d dl!m"Z"d dl#m$Z%ej&dkrnddl'm(Z)nddl'm)Z)ej*Z*ej+Z+dZ,dZ-dZ.e/e/dZ0dZ1dZ2dZ3dZ4de fdYZ5dS( sI Create a wheel (.whl) distribution. A wheel is a built archive format. iN(t OrderedDict(tCommand(tlog(tBytesIO(tiglob(trmtree(tget_config_var(t ZIP_DEFLATEDt ZIP_STOREDi(twrite_pkg_info(tcalculate_macosx_platform_tag(tpkginfo_to_metadata(ttags(t WheelFile(t __version__i(t Generator(tBytesGeneratorscp3\dcCsdjtjdS(Nspy{}i(tformattsyst version_info(((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pyt python_tag+scCsdtjj}|jdr<|dk r<t||}n|dkr`tjdkr`d}n|S(s0Return our platform name 'win32', 'linux_x86_64'tmacosxt linux_x86_64it linux_i686N(t distutilstutilt get_platformt startswithtNoneR Rtmaxsize(t archive_roottresult((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pyR/s  cCsKt|}|dkrA|r=tjdj|tdn|S||kS(sfUse a fallback value for determining SOABI flags if the needed config var is unset or unavailable.s?Config variable '{0}' is unset, Python ABI tag may be incorrectiN(RRtwarningstwarnRtRuntimeWarning(tvartfallbacktexpectedR!tval((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pytget_flag;s   cCstd}tj}| r4|dkr4ttdr4d}d}d}tdttdd|dkryd }ntd |dkd|dkotjdkrtjdkrd }ntdtjdkddd|dkotjdkrtjdkrd}nd|tj|||f}n|rc|j drcd|j dd}n|r|j drdj |j dd }|j ddj dd}n-|r|j ddj dd}nd }|S(!sXReturn the ABI tag based on SOABI (if available) or emulate SOABI (CPython 2, PyPy).tSOABItcptppt maxunicodettPy_DEBUGtgettotalrefcountR!tdt WITH_PYMALLOCiitmtPy_UNICODE_SIZEiR%itus %s%s%s%s%sscpython-t-ispypy-it.t_(scpspp(ii(ii(ii(iiN(RR tinterpreter_namethasattrRR'RR+tinterpreter_versionRtsplittjointreplaceR(tsoabitimplR/R1R3tabi((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pyt get_abi_tagGsB  "      "!!cCst|jddS(NR4R6(t safe_nameR<(tname((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pyt safer_nameoscCst|jddS(NR4R6(t safe_versionR<(tversion((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pyt safer_versionsscCs0t|dGHtj|tj||dS(Ni(tstrtostchmodtstattS_IWRITE(tfunctpathtexcinfo((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pytremove_readonlywst bdist_wheelcBseZdZedefdefgZd0ddded1fd d d d fd2d3d4d5d6d7dd1dj dj efdd1d e fd8d9g Z d dddgZ d%Zd&Zed'Zd(Zd)Zd*ed+d,Zd-Zed.Zd/ZRS(:screate a wheel distributiontstoredtdeflateds 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=R/s-directory to put final built distributions ins skip-builds2skip rebuilding everything (for testing/debugging)trelatives7build the archive using relative paths (default: false)sowner=R3s@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 compression=s6zipfile compression (one of: {}) (default: 'deflated')s, s python-tag=s7Python implementation compatibility tag (default: '%s')s 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|_ t|_ d|_ d|_t|_d|_t|_d|_t|_t|_dS(NtzipRR(Rt bdist_dirtdata_dirt plat_nametplat_tagRtFalset keep_temptdist_dirt egginfo_dirt root_is_puret skip_buildRVtownertgroupRXt compressionRt build_numbertpy_limited_apitplat_name_supplied(tself((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pytinitialize_optionss&                  cCs|jdkr<|jdj}tjj|d|_n|jd|_|j dk |_ y|j |j |_ Wn)t k rtdj|j nXd}|jdt|||jjp|jj |_|jrtjt|j rtdtn|jjd}d |krttjd |d d j}|jdkrtt|_ qtn|j!dk r|j!d j" rtdndS(Ntbdisttwheels.datasUnsupported compression: {}R`R\Rcspy-limited-api must match '%s'RXs=The [wheel] section is deprecated. Use [bdist_wheel] instead.it1ttruetyess1Build tag (build-number) must start with a digit.(sdist_dirs plat_names skip_build(Rnstruesyes(#RZRtget_finalized_commandt bdist_baseRHRMR;twheel_dist_nameR[R\Ritsupported_compressionsRftKeyErrort ValueErrorRtset_undefined_optionsRYt distributionthas_ext_modulesthas_c_librariesRbRhtretmatchtPY_LIMITED_API_PATTERNtget_option_dicttloggerR!tstriptlowertTrueRXRgtisdigit(RjRrt need_optionsRmR&((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pytfinalize_optionss0    #cCsSt|jjt|jjf}|jrF||jf7}ndj|S(s4Return distribution full name with - replaced with _R4(RCRxtget_nameRFt get_versionRgR;(Rjt components((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pyRss  c Cs|jr|j}nm|jr'd}n[|jrO|jjd rO|j}nt|j}|dkrtjdkrd}n|jj ddj d d}|jr|j rd }n |j }|d |f}nt j }t j}||}|jr,||jd r,|j}d }nttj}|||f}gt jD]}|j|j|f^q]}||kstdj||S(NtanyRs linux-x86_64RiRR4R6R5spy2.py3tnonetcp3tabi3s)would build wheel with unsupported tag {}(s linux-x86_64s linux_x86_64(RiR\RbRRRZRRRR<RXRR R7R9RhRGR@tsys_tagst interpreterR?tAssertionErrorR( RjR\R>ttagt impl_nametimpl_vertabi_tagtttsupported_tags((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pytget_tags6      $         +!cCs2|jd}d|_t|_|jd}t|_|jsR|jdn|jddt}|j|_ t|_ |j|_t|_ |jd}t|_ x4d!D],}t |d |tjj|j|qWd}tjdkr,tjjtjj|jd}||_|_nt ||jrAdnd|tjd|j|jd|j\}}} dj|j||| } |js|j} n$tjj|j|j|j} |jdd"djt |j!j"t#|j!j$} tjj|j| } |j%|j&| |j'| tjj(|j)sttj*|j)ntjj|j)| d}t+|d|j,}|j-| WdQXt.|j!dgj/ddjt0j1d |f|j2s.tjd|j|j3s.t4|jd t5q.ndS(#Nt build_scriptstpythont build_exttbuildtinstalltreinit_subcommandstinstall_scriptstheaderstscriptstdatatpurelibtplatlibtinstall_R,tnts..tinstall_purelibtinstall_platlibsinstalling to %ss {}-{}-{}-{}tinstall_egg_infottargetRas{}-{}.dist-infos.whltwt dist_filesRPs{}.{}is removing %stonerror(sheaderssscriptssdataspurelibsplatlib(stargets egginfo_dir(6treinitialize_commandt executableRtforceR^tinplaceRct run_commandRZtroottcompiletwarn_dirtno_eptsetattrRHRMR;R[RBtnormpathtinstall_libbaset install_libRbRtinfoRRRsRVt_ensure_relativet install_baseRwRCRxRRFRtegg2distRatwrite_wheelfiletexistsR`tmakedirsR Rft write_filestgetattrtappendRRR_tdry_runRRO(RjRRRRtkeytbasedir_observedtimpl_tagRR]tarchive_basenameRtdistinfo_dirnamet distinfo_dirt wheel_pathtwf((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pytrun"sn            $        s bdist_wheel (t)c Csddlm}tjdkrAt|t rA|jd}n|}d|d<||dR?tplattwheelfile_pathtbuffertf((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pyRvs(   ( cCsCtjj|\}}|dd!tjkr?||d}n|S(Nii(RHRMt splitdrivetsep(RjRMtdrive((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pyRscCs.|jjd}t}td|jdddjD}d|kr{tjdt|j |ddnd|krd|krd}nx|D]}xzt |D]l}|j d rt j d |qn||krtjj|rt jd|||j |qqWqW|S(NtmetadatacSsh|] }|qS(((t.0toption((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pys s t license_filesR,it license_filesEThe "license_file" option is deprecated. Use "license_files" instead.s LICEN[CS]E*sCOPYING*sNOTICE*sAUTHORS*t~s4ignoring license file "%s" as it looks like a backups/adding license file "%s" (matched pattern "%s")(R,R,(s LICEN[CS]E*sCOPYING*sNOTICE*sAUTHORS*(RxR~tsettsortedtgetR:R R!tDeprecationWarningtaddRtendswithRtdebugRHRMtisfileR(RjRtfilestpatternstpatternRM((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pyt license_pathss& )    cCsd}||tjj|sddl}tjjtjj|d}|j|}d|f}|rtjj|d}|d|f7}nt|ntjj|r|} t ||} tj |ntjj|d} t || } t j ||d d tjj|d } t | d } | jj} WdQX| ss|| nttjj|d | xB|jD]7}tjj|}t j|tjj||qW||dS(s:Convert an .egg-info directory into a .dist-info directorycSsmtjj|rGtjj| rGtjj|rGtj|n"tjj|ritj|ndS(s-Appropriately delete directory, file or link.N(RHRMRtislinktisdirtshutilRtunlink(RT((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pytadioss7iNs *.egg-infos)Egg metadata expected at %s but not foundis- (%s found - possible misnamed archive file?)sPKG-INFOtignorecSsddddhS(NsPKG-INFOs requires.txts SOURCES.txts not-zip-safe((txty((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pyts sdependency_links.txttrtMETADATA(RHRMRtglobR;tdirnametbasenameRvRR tmkdirRtcopytreeRtreadRR Rtcopy(Rjt egginfo_patht distinfo_pathRRtpattpossibleterrtaltt pkginfo_pathtpkg_infotdependency_links_pathtdependency_links_filetdependency_linkst license_pathtfilename((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pyRs:   !   #(s bdist-dir=RSs1temporary directory for creating the distributionN(s dist-dir=R/s-directory to put final built distributions in(s skip-buildNs2skip rebuilding everything (for testing/debugging)(srelativeNs7build the archive using relative paths (default: false)(sowner=R3s@Owner name used when creating a tar file [default: current user](sgroup=RWsAGroup 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__t descriptionRRRRtRRRR;Rt user_optionstboolean_optionsRkRtpropertyRsRRt wheel_versionRRRR(((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pyRP}sX      $ 0 T (i(6t__doc__RRHRRJRR{R t collectionsRtdistutils.coreRRRtioRRRRt sysconfigRtzipfileRRt pkg_resourcestpkginfoR tmacosx_libfileR RR tvendored.packagingR t wheelfileR R,RRRtemail.generatorRRRARDR}RRRR'R@RCRFRORP(((s5/usr/lib/python2.7/site-packages/wheel/bdist_wheel.pytsH             (