Viewing File: /opt/alt/python38/lib64/python3.8/site-packages/cffi/__pycache__/setuptools_ext.cpython-38.pyc

U

ل=^"@snddlZddlZzeWnek
r0eZYnXddZddZddZdd	Zd
dZ	dd
Z
ddZdS)NcCsddlm}||dS)Nr)DistutilsSetupError)Zdistutils.errorsr)msgrr/setuptools_ext.pyerror
src	Cs@t|}|}W5QRX|d7}t||d}t|||dS)N
exec)openreadcompiler)filenameZglobfsrccoderrrexecfiles

rc
Csddlm}t|ts*tdt|jft|}z|d\}}Wn"t	k
rftd|fYnXt
j|sd}|
ddd	}t
j|rd
|d|f}td||fd|d
}t||z||}Wn$tk
rtd||fYnXt||s|}t||s0td|t|jft|dsJtd|f|j\}	}
}}|jrr|}|||
dkrt|||	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
basestringrtyperstrsplit
ValueErrorospathexistsreplacerKeyErrorhasattrrZ_windows_unicodecopyZ_apply_windows_unicode_add_py_module
_add_c_module)
distZmod_specrZbuild_file_nameZffi_var_nameextZ	rewrittenZmod_varsffimodule_namesourcesource_extensionkwdsrrradd_cffi_modulesV






r0cCsnd|krjttdsjtjdkrjddl}z(t|jdd}|dkrJd|d<Wntk
rhd|d<YnX|S)	a
    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.
    For now we'll skip py_limited_api on all Windows versions to avoid an
    inconsistent mess.
    Zpy_limited_apiZgettotalrefcountZwin32rNrT)r%sysplatform
setuptoolsint__version__	partitionr)	Extensionr/r4Zsetuptools_major_versionrrr_set_py_limited_apiIsr9c
	sddlm}ddlm}ddlmddlmddlm	dg}|
|dgt||}|f|d	|d	fd
d	|j
dkrg|_
|j
|jd|Gfd
dd}	|	|jd<dS)Nr)r8	build_extmkpathlog
recompiler$PLACEHOLDERsources)namerCcs\tj|}d|||dk	r:||}|sXd|SNzgenerating cffi module %rzalready up-to-date)r r!joininfoZ
make_c_source)Ztmpdirpre_runZc_fileupdated)r*r+r?r=r,rAr-r.rrmake_modus

z_add_c_module.<locals>.make_modr;cseZdZfddZdS)z)_add_c_module.<locals>.build_ext_make_modcs:jddkr,t|dd}|j|jd<|dS)NrrBrH)rCgetattrZ
build_temprun)selfrH
base_classr*rJrrrLsz-_add_c_module.<locals>.build_ext_make_mod.runNr
__module____qualname__rLrrNrrbuild_ext_make_modsrS)N)Zdistutils.corer8setuptools.command.build_extr;distutils.dir_utilr=	distutilsr?cffirAextendpopr9Zext_modulesappendcmdclassget)
r)r+r,r-r.r/r8r;Z
allsourcesrSr)
rOr*r+r?rJr=r,rAr-r.rr(hs 

r(csddlmddlm}ddlm}ddlmddlm	fdd|j
d	|Gfd
dd}||j
d	<|jdkrg|_|j
|j
d|Gfd
dd}||j
d<dS)Nrr<)build_pyr:r>r@cs>d|tj||}|s:ddSrE)rGr r!dirnameZmake_py_source)Zpy_filerI)r+r?r=r,rArrgenerate_mods
z$_add_py_module.<locals>.generate_modr]cs*eZdZfddZfddZdS)z)_add_py_module.<locals>.build_py_make_modcs@|d}|dd7<tjj|jf|dS)Nrr)rLrr r!rFZ	build_lib)rMmodule_pathrOr_r,rrrLs

z-_add_py_module.<locals>.build_py_make_mod.runcs:|j}z&|r fdd|D|_|WS||_XdS)Ncsg|]}|kr|qSrr).0m)r,rr
<listcomp>szN_add_py_module.<locals>.build_py_make_mod.get_source_files.<locals>.<listcomp>)
py_modulesget_source_files)rMZsaved_py_modules)rOr,rrrgsz:_add_py_module.<locals>.build_py_make_mod.get_source_filesN)rrQrRrLrgrrbrrbuild_py_make_modsrhr;cseZdZfddZdS)z*_add_py_module.<locals>.build_ext_make_modcsb||jr^d}d|dd}|d}||}|dd}tj||dS)Nrr`r]r)rLZinplacerrFZget_finalized_commandZget_package_dirr r!)rMrapackager]Zpackage_dir	file_namebase_class_2r_r,rrrLs



z._add_py_module.<locals>.build_ext_make_mod.runNrPrrkrrrSsrS)rUr=Zsetuptools.command.build_pyr]rTr;rVr?rWrAr[r\rfrZ)r)r+r,r]r;rhrSr)rOrlr+r_r?r=r,rArr's


r'cCs4|dkstt|tr|g}|D]}t||q dS)Ncffi_modules)AssertionErrorrrr0)r)attrvalueZcffi_modulerrrrms

rm)r r2r	NameErrorrrrr0r9r(r'rmrrrr<module>s

-.=
Back to Directory File Manager