U ËÒEcã"ã@snddlZddlZzeWnek r0eZYnXdd„Zdd„Zdd„Zdd „Zd d „Z d d „Z dd„Z dS)éNcCsddlm}||ƒ‚dS)Nr)ÚDistutilsSetupError)Údistutils.errorsr)Úmsgr©rú= 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_apiÚgettotalrefcountNréT) Úcffir5r'ÚsysZUSE_LIMITED_APIÚ setuptoolsÚintÚ __version__Ú partitionr!)Ú Extensionr2r5r:Zsetuptools_major_versionrrrÚ_set_py_limited_apiIs ÿ r?c sÞddlm}ddlm}ddlm‰ddlm‰ddlm ‰dg}|  |  dg¡¡t ||ƒ}|fˆ|d œ|—މd‡‡‡‡‡‡‡‡ fd d „ ‰|j dkržg|_ |j  ˆ¡|j d |¡‰G‡‡‡fd d„dˆƒ} | |jd <dS)Nr)r>©Ú build_ext©Úmkpath©Úlogr4ú $PLACEHOLDERÚsources)ÚnamerGcs\tj |ˆˆ¡}ˆ d|¡ˆ|ƒ|dk r:|ˆˆƒˆ ˆˆˆ|¡}|sXˆ d¡|S©Nzgenerating cffi module %rzalready up-to-date)r"r#ÚjoinÚinfoZ make_c_source)ÚtmpdirÚpre_runZc_fileÚupdated)r-r.rErCr/r5r0r1rrÚmake_modws  z_add_c_module..make_modrAcseZdZ‡‡‡fdd„ZdS)z)_add_c_module..build_ext_make_modcs:ˆjddkr,t|ddƒ}ˆ|j|ƒˆjd<ˆ |¡dS)NrrFrM)rGÚgetattrÚ build_tempÚrun)ÚselfrM©Ú base_classr-rOrrrRŒs z-_add_c_module..build_ext_make_mod.runN©rÚ __module__Ú __qualname__rRrrTrrÚbuild_ext_make_mod‹srY)N)Údistutils.corer>Úsetuptools.command.build_extrAÚdistutils.dir_utilrCÚ distutilsrEr8r5ÚextendÚpopr?Ú ext_modulesÚappendÚcmdclassÚget) r+r.r/r0r1r2r>rAZ allsourcesrYr) rUr-r.rErOrCr/r5r0r1rr*js         r*csÐddlm‰ddlm}ddlm}ddlm‰ddlm ‰‡‡‡‡‡fdd„‰|j   d |¡‰G‡‡‡fd d „d ˆƒ}||j d <|j dkrg|_ |j   ˆ¡|j   d |¡‰G‡‡‡fd d„dˆƒ}||j d <dS)NrrB)Úbuild_pyr@rDr4cs>ˆ d|¡ˆtj |¡ƒˆ ˆˆ|¡}|s:ˆ d¡dSrI)rKr"r#ÚdirnameZmake_py_source)Zpy_filerN)r.rErCr/r5rrÚ generate_modŸs z$_add_py_module..generate_modrdcs*eZdZ‡‡‡fdd„Z‡‡fdd„ZdS)z)_add_py_module..build_py_make_modcs@ˆ |¡ˆ d¡}|dd7<ˆtjj|jf|žŽƒdS)Nréÿÿÿÿr)rRr r"r#rJÚ build_lib)rSÚ module_path©rUrfr/rrrR¨s  z-_add_py_module..build_py_make_mod.runcs:|j}z&|r ‡fdd„|Dƒ|_ˆ |¡W¢S||_XdS)Ncsg|]}|ˆkr|‘qSrr)Ú.0Úm)r/rrÚ ³sÿzN_add_py_module..build_py_make_mod.get_source_files..)Ú py_modulesÚget_source_files)rSZsaved_py_modules)rUr/rrro­s z:_add_py_module..build_py_make_mod.get_source_filesN)rrWrXrRrorrjrrÚbuild_py_make_mod§srprAcseZdZ‡‡‡fdd„ZdS)z*_add_py_module..build_ext_make_modcsbˆ |¡|jr^ˆ d¡}d |dd…¡}| d¡}| |¡}|dd}ˆtj ||¡ƒdS)Nrrgrdr)rRZinplacer rJÚget_finalized_commandZget_package_dirr"r#)rSriÚpackagerdÚ package_dirÚ file_name©Ú base_class_2rfr/rrrRÉs     z._add_py_module..build_ext_make_mod.runNrVrrurrrYÈsrY)r\rCZsetuptools.command.build_pyrdr[rAr]rEr8r5rbrcrnra)r+r.r/rdrArprYr)rUrvr.rfrErCr/r5rr)˜s        r)cCs4|dks t‚t|tƒr|g}|D]}t||ƒq dS)NÚ cffi_modules)ÚAssertionErrorrrr3)r+ÚattrÚvalueZ cffi_modulerrrrwÕs   rw) r"r9rÚ NameErrorrrrr3r?r*r)rwrrrrÚs  -!.=