zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
U
L±d¾#ã@snddlZddlZzeWnek
r0eZYnXdd„Zdd„Zdd„Zdd    „Zd
d „Z    d d „Z
dd„Z dS)éNcCsddlm}||ƒ‚dS)Nr)ÚDistutilsSetupError)Údistutils.errorsr)Úmsgr©rúJd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\cffi/setuptools_ext.pyÚerror
s rc    Cs@t|ƒ}| ¡}W5QRX|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    k
rftd|fƒYnXt
j   |¡s¶d}|  dd¡d    }t
j   |¡r¦d
|d|f}td ||fƒd |d œ}t||ƒz ||}Wn$tk
rútd||fƒYnXt||ƒs|ƒ}t||ƒs0td|t|ƒjfƒt|dƒsJtd|fƒ|j\}    }
} } |jrr|  ¡} | | ¡|
dk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 
 
ÿÿ   
ÿ
 
 ÿ  ÿ 
 
r3cCsvddlm}d|krrttdƒsr|jrrddl}z(t|j d¡dƒ}|dkrRd|d<Wnt    k
rpd|d<YnX|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_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)ZtmpdirÚpre_runZc_fileÚupdated)r-r.rErCr/r5r0r1rrÚmake_modws
 
z_add_c_module.<locals>.make_modrAcseZdZ‡‡‡fdd„ZdS)z)_add_c_module.<locals>.build_ext_make_modcs:ˆjddkr,t|ddƒ}ˆ|j|ƒˆjd<ˆ |¡dS)NrrFrL)rGÚgetattrÚ
build_tempÚrun)ÚselfrL©Ú
base_classr-rNrrrQŒs z-_add_c_module.<locals>.build_ext_make_mod.runN©rÚ
__module__Ú __qualname__rQrrSrrÚbuild_ext_make_mod‹srX)N)Údistutils.corer>Úsetuptools.command.build_extrAÚdistutils.dir_utilrCÚ    distutilsrEr8r5ÚextendÚpopr?Ú ext_modulesÚappendÚcmdclassÚget)
r+r.r/r0r1r2r>rAZ
allsourcesrXr)
rTr-r.rErNrCr/r5r0r1rr*js      
 
 r*csÐddlm‰ddlm}ddlm}ddlm‰ddlm    ‰‡‡‡‡‡fdd„‰|j
  d    |¡‰G‡‡‡fd
d „d ˆƒ}||j
d    <|j dkrg|_ |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_filerM)r.rErCr/r5rrÚ generate_modŸs
z$_add_py_module.<locals>.generate_modrccs*eZdZ‡‡‡fdd„Z‡‡fdd„ZdS)z)_add_py_module.<locals>.build_py_make_modcs@ˆ |¡ˆ d¡}|dd7<ˆtjj|jf|žŽƒdS)Nréÿÿÿÿr)rQr r"r#rJÚ    build_lib)rRÚ module_path©rTrer/rrrQ¨s
 
z-_add_py_module.<locals>.build_py_make_mod.runcs:|j}z&|r ‡fdd„|Dƒ|_ˆ |¡W¢S||_XdS)Ncsg|]}|ˆkr|‘qSrr)Ú.0Úm)r/rrÚ
<listcomp>³sÿzN_add_py_module.<locals>.build_py_make_mod.get_source_files.<locals>.<listcomp>)Ú
py_modulesÚget_source_files)rRZsaved_py_modules)rTr/rrrn­s z:_add_py_module.<locals>.build_py_make_mod.get_source_filesN)rrVrWrQrnrrirrÚbuild_py_make_mod§srorAcseZdZ‡‡‡fdd„ZdS)z*_add_py_module.<locals>.build_ext_make_modcsbˆ |¡|jr^ˆ d¡}d |dd…¡}| d¡}| |¡}|dd}ˆtj ||¡ƒdS)Nrrfrcr)rQZinplacer rJÚget_finalized_commandZget_package_dirr"r#)rRrhÚpackagercÚ package_dirÚ    file_name©Ú base_class_2rer/rrrQÉs
 
 
 
 z._add_py_module.<locals>.build_ext_make_mod.runNrUrrtrrrXÈsrX)r[rCZsetuptools.command.build_pyrcrZrAr\rEr8r5rarbrmr`)r+r.r/rcrArorXr)rTrur.rerErCr/r5rr)˜s     
 
 
  r)cCs4|dks t‚t|tƒr|g}|D]}t||ƒq dS)NÚ cffi_modules)ÚAssertionErrorrrr3)r+ÚattrÚvalueZ cffi_modulerrrrvÕs
 
rv) r"r9rÚ    NameErrorrrrr3r?r*r)rvrrrrÚ<module>s
 -!.=