a ‚oe#ã@slddlZddlZzeWney.eZYn0dd„Zdd„Zdd„Zdd „Zd d „Z d d „Z dd„Z dS)éNcCsddlm}||ƒ‚dS)Nr)ÚDistutilsSetupError)Úcffi._shimmed_dist_utilsr)Úmsgr©rú4C:\Program Files\Certbot\pkgs\cffi\setuptools_ext.pyÚerror s rcCsTt|ƒ�}| ¡}Wdƒn1s&0Y|d7}t||dƒ}t|||ƒdS)NÚ Úexec)ÚopenÚreadÚcompiler )ÚfilenameÚglobÚfÚsrcÚcoderrrÚexecfiles  & rc Csœddlm}t|tƒs*tdt|ƒjfƒt|ƒ}z| d¡\}}Wn t ydtd|fƒYn0t j   |¡s´d}|  dd¡d }t j   |¡r¤d |d|f}td ||fƒd |d œ}t||ƒz ||}Wn"työtd||fƒYn0t||ƒ�s |ƒ}t||ƒ�s,td|t|ƒjfƒt|dƒ�sFtd|fƒ|j\} } } } |j�rn|  ¡} | | ¡| du�r†t||| ƒnt||| | | | ƒdS)Nr)ÚFFIzEargument to 'cffi_modules=...' must be a str or a list of str, not %rú:z3%r must be of the form 'path/build.py:ffi_variable'ÚÚ.ú/ú.pyz (rewrite cffi_modules to [%r])z#%r does not name an existing file%sZ__cffi__)Ú__name__Ú__file__z!%r: object %r not found in modulez"%r is not an FFI instance (got %r)Ú_assigned_sourcez*%r: the set_source() method was not called)Zcffi.apirÚ isinstanceÚ basestringrÚtyperÚstrÚsplitÚ ValueErrorÚosÚpathÚexistsÚreplacerÚKeyErrorÚhasattrrZ_windows_unicodeÚcopyZ_apply_windows_unicodeÚ_add_py_moduleÚ _add_c_module) ÚdistÚmod_specrZbuild_file_nameZ ffi_var_nameÚextZ rewrittenZmod_varsÚffiÚ module_nameÚsourceÚsource_extensionÚkwdsrrrÚadd_cffi_modulesV   ÿ ÿ    ÿ    ÿ  ÿ   r3cCstddlm}d|vrpttdƒsp|jrpddl}z(t|j d¡dƒ}|dkrRd|d<Wnt ynd|d<Yn0|S) a7 Add py_limited_api to kwds if setuptools >= 26 is in use. Do not alter the setting if it already exists. Setuptools takes care of ignoring the flag on Python 2 and PyPy. CPython itself should ignore the flag in a debugging version (by not listing .abi3.so in the extensions it supports), but it doesn't so far, creating troubles. That's why we check for "not hasattr(sys, 'gettotalrefcount')" (the 2.7 compatible equivalent of 'd' not in sys.abiflags). (http://bugs.python.org/issue28401) On Windows, with CPython <= 3.4, it's better not to use py_limited_api because virtualenv *still* doesn't copy PYTHON3.DLL on these versions. Recently (2020) we started shipping only >= 3.5 wheels, though. So we'll give it another try and set py_limited_api on Windows >= 3.5. r©Ú recompilerZpy_limited_apiZgettotalrefcountNréT) Úcffir5r'ÚsysZUSE_LIMITED_APIÚ setuptoolsÚintÚ __version__Ú partitionr!)Ú Extensionr2r5r9Zsetuptools_major_versionrrrÚ_set_py_limited_apiIs ÿ  r>c sÎddlm}ddlm}m‰m‰ddlm‰dg}| |  dg¡¡t ||ƒ}|fˆ|dœ|¤Ž‰d ‡‡‡‡‡‡‡‡ fdd „ ‰|j durŽg|_ |j   ˆ¡|j  d |¡‰G‡‡‡fd d „d ˆƒ} | |j d <dS)Nr©Ú build_ext)r=ÚlogÚmkpathr4ú $PLACEHOLDERÚsources)ÚnamerDcs\tj |ˆˆ¡}ˆ d|¡ˆ|ƒ|dur:|ˆˆƒˆ ˆˆˆ|¡}|sXˆ d¡|S©Nzgenerating cffi module %rzalready up-to-date)r"r#ÚjoinÚinfoZ make_c_source)ZtmpdirÚpre_runZc_fileÚupdated)r-r.rArBr/r5r0r1rrÚmake_modus  z_add_c_module..make_modr@cseZdZ‡‡‡fdd„ZdS)z)_add_c_module..build_ext_make_modcs:ˆjddkr,t|ddƒ}ˆ|j|ƒˆjd<ˆ |¡dS)NrrCrI)rDÚgetattrZ build_tempÚrun)ÚselfrI©Ú base_classr-rKrrrMŠs z-_add_c_module..build_ext_make_mod.runN©rÚ __module__Ú __qualname__rMrrOrrÚbuild_ext_make_mod‰srT)N)Úsetuptools.command.build_extr@rr=rArBr7r5ÚextendÚpopr>Z ext_modulesÚappendÚcmdclassÚget) r+r.r/r0r1r2r@r=Z allsourcesrTr) rPr-r.rArKrBr/r5r0r1rr*js     r*csÈddlm}ddlm}ddlm‰m‰ddlm‰‡‡‡‡‡fdd„‰|j   d|¡‰G‡‡‡fd d „d ˆƒ}||j d<|j durˆg|_ |j   ˆ¡|j   d |¡‰G‡‡‡fd d „d ˆƒ}||j d <dS)Nr)Úbuild_pyr?)rArBr4cs>ˆ d|¡ˆtj |¡ƒˆ ˆˆ|¡}|s:ˆ d¡dSrF)rHr"r#ÚdirnameZmake_py_source)Zpy_filerJ)r.rArBr/r5rrÚ generate_modœs z$_add_py_module..generate_modr[cs*eZdZ‡‡‡fdd„Z‡‡fdd„ZdS)z)_add_py_module..build_py_make_modcsBˆ |¡ˆ d¡}|dd7<ˆtjj|jg|¢RŽƒdS)Nréÿÿÿÿr)rMr r"r#rGZ build_lib)rNÚ module_path©rPr]r/rrrM¥s  z-_add_py_module..build_py_make_mod.runcs>|j}z*|r ‡fdd„|Dƒ|_ˆ |¡W||_S||_0dS)Ncsg|]}|ˆkr|‘qSrr)Ú.0Úm)r/rrÚ °sÿzN_add_py_module..build_py_make_mod.get_source_files..)Ú py_modulesÚget_source_files)rNZsaved_py_modules)rPr/rrreªs þz:_add_py_module..build_py_make_mod.get_source_filesN)rrRrSrMrerr`rrÚbuild_py_make_mod¤srfr@cseZdZ‡‡‡fdd„ZdS)z*_add_py_module..build_ext_make_modcsbˆ |¡|jr^ˆ d¡}d |dd…¡}| d¡}| |¡}|dd}ˆtj ||¡ƒdS)Nrr^r[r)rMZinplacer rGZget_finalized_commandZget_package_dirr"r#)rNr_Úpackager[Z package_dirÚ file_name©Ú base_class_2r]r/rrrMÆs     z._add_py_module..build_ext_make_mod.runNrQrrirrrTÅsrT) Zsetuptools.command.build_pyr[rUr@rrArBr7r5rYrZrdrX)r+r.r/r[r@rfrTr)rPrjr.r]rArBr/r5rr)–s      r)cCs4|dks J‚t|tƒr|g}|D]}t||ƒq dS)NÚ cffi_modules)rrr3)r+ÚattrÚvalueZ cffi_modulerrrrkÒs   rk) r"r8rÚ NameErrorrrrr3r>r*r)rkrrrrÚs   -!,<