K iMpdZddlmZddlZddlZddlZddlZddlZddlZddl m Z m Z m Z ddl mZddlmZddlmZdd lmZdd lmZe rdd lmZnd Zd ej2vZej6j9ej:Zej6j9ej>Z ej6j9ejBZ"ej6j9ejFZ$dejJvr)ej6jMejJdZ'n\ejPr?ej6jSej6jMejPZ'nejTZ'dZ+e,eddZ-dZ.ej^dk(redZ0e0e'Z'e0e-Z-dZ1e1Z2dZ3 e2s ejhZ3dZ6d2d3dZ7edZ8dZ9dZ:dZ;dZ d4 d5dZ?ejd ZAd6d!ZBd7d"ZCd7d#ZDd8d$ZEejd%ZGejd&ZHejd'ZId8d(ZJd)ZKdaLe d9d*ZMe d:d+ZMd;d,ZMe ed-dd1ZOy#e5$rYwxYw)?aProvide access to Python's configuration information. The specific configuration variables available depend heavily on the platform and configuration. The values may be retrieved using get_config_var(name), and the list of variables is available via get_config_vars().keys(). Additional convenience functions are also available. Written by: Fred L. Drake, Jr. Email: ) annotationsN) TYPE_CHECKINGLiteraloverload) pass_none) CCompiler)py39)DistutilsPlatformError)is_mingw) deprecatedcdS)Nc|SN)fns e/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/setuptools/_distutils/sysconfig.pyzdeprecated.."s"r)messages rr r !sr__pypy___PYTHON_PROJECT_BASEcttj|jdtfddDS)z] Return True if the target directory appears to point to an un-installed Python. Modulesc3\K|]#}j|j%ywr)joinpathis_file).0rmoduless r z(_is_python_source_dir..As%Q"w#++-Qs),)Setupz Setup.local)pathlibPathrany)drs @r_is_python_source_dirr&;s/ ll1o&&y1G Q8PQ QQr_homectjj|jtjj|S)z, Return True if a is a parent of b. )ospathnormcase startswith)dir_adir_bs r _is_parentr/Gs3 77  E " - -bgg.>.>u.E FFrntcJttf}fd|D}t|S)Nc3vK|]0}ttjj|dr|2yw)PCbuildN)r/r)r*join)rprefixr%s rr z_fix_pcbuild..Ts2 !RWW\\&)<=  s69)PREFIX BASE_PREFIXnext)r%prefixesmatcheds` r _fix_pcbuildr;Ps-;& "  GQrcJtrttSttSr) _sys_homer& project_baserrr _python_buildr?_s$Y//  ..rcptjjdtjjS)zReturn a string containing the major and minor Python version, leaving off the patchlevel. Sample return values could be '1.5' or '2.2'. .)sys version_infomajorminorrrrget_python_versionrGus/ $$ %Qs'7'7'='=&> ??rc|rtnt}||n|}trdntj} t d|}||||S#t $rtdtjdwxYw)aReturn the directory containing installed Python header files. If 'plat_specific' is false (the default), this is the path to the non-platform-specific header files, i.e. Python.h and so on; otherwise, this is the path to platform-specific header files (namely pyconfig.h). If 'prefix' is supplied, use it instead of sys.base_prefix or sys.base_exec_prefix -- i.e., ignore 'plat_specific'. posix_get_python_inc_zCI don't know where Python installs its C header files on platform '')BASE_EXEC_PREFIXr7r r)nameglobalsKeyErrorr ) plat_specificr5default_prefixresolved_prefixos_namegetters rget_python_incrU}s*7%KN & 2fO!gG -gY78 /6= 99  $ GG9A '   s A 'A3cHtjj|r|SdS)z5 Replace path with None if it doesn't exist. N)r)r*exists)r*s r_extantrXs 77>>$'41T1rc`t|xs"tt||xs t|Sr)_get_python_inc_posix_pythonrX_get_python_inc_from_config_get_python_inc_posix_prefixr5 spec_prefixrPs r_get_python_inc_posixr_s1$]3 0 .}kJ K 0 ' /rctsy|rtxstStjj t dd}tjj|S)z Assume the executable is in the build directory. The pyconfig.h file should be in the same directory. Since the build directory may not be the source directory, use "srcdir" from the makefile to find the "Include" directory. NsrcdirInclude) python_buildr=r>r)r*r4get_config_varnormpath)rPincdirs rrZrZsF (L( WW\\.2I >F 77  F ##rc*|td|zdzSy)aj If no prefix was explicitly specified, provide the include directory from the config vars. Useful when cross-compiling, since the config vars may come from the host platform Python installation, while the current Python executable is from the build platform installation. >>> monkeypatch = getfixture('monkeypatch') >>> gpifc = _get_python_inc_from_config >>> monkeypatch.setitem(gpifc.__globals__, 'get_config_var', str.lower) >>> gpifc(False, '/usr/bin/') >>> gpifc(False, '') >>> gpifc(False, None) 'includepy' >>> gpifc(True, None) 'confincludepy' NCONF INCLUDEPY)rd)rPr^s rr[r[s$&f}4{BCCrctrdnd}|tztz}tjj |d|S)Npypypythoninclude)IS_PYPYrG build_flagsr)r*r4)r5implementation python_dirs rr\r\s5&VHN"4"66DJ 77<< : 66rc(trmtjj|dtjjztjj t jzStjj|dS)Nrm)rcr)r*r4pathsepdirname sysconfigget_config_h_filenamer]s r_get_python_inc_ntrwsd GGLL +ggoo ggooi==?@ A 77<< **rcJ|r|Stjj|dS)N site-packages)r)r*r4) standard_lib libpython early_prefixr5s r _posix_libr}s ww||I77rc0|}|'|r|xrtxst}n|xrtxst}tj dk(s t r\|s|rttdd}nd}trdnd}tjj|||tz}t||||Stj dk(rC|r tjj|dStjj|ddStd tj d ) aSReturn the directory containing the Python library (standard or site additions). If 'plat_specific' is true, return the directory containing platform-specific modules, i.e. any module from a non-pure-Python module distribution; otherwise, return the platform-shared library directory. If 'standard_lib' is true, return the directory containing standard Python library modules; otherwise, return the directory for site-specific modules. If 'prefix' is supplied, use it instead of sys.base_prefix or sys.base_exec_prefix -- i.e., ignore 'plat_specific'. rI platlibdirlibrkrlr0Libryz>*h7jjnn]K@ jjnn  J  h- d3 &1h,::>>*h7 e4 e$FE*h.h. e4 ZZ^^D" %8bjjnnYAAcF")h&   x/ #cMH4% !  rzz !h&:&:&>&>x&N  $ $BJJx,@ $ A(4%[1;+rc*tjS)z2Return full pathname of installed pyconfig.h file.)rurvrrrrvrv~  * * ,,rc*tjS)zAReturn full pathname of installed Makefile from the Python build.)ruget_makefile_filenamerrrrrrrc0tj||S)zParse a config.h-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. )vars)ruparse_config_h)fpgs rrrs  # #BQ //rz"([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)z\$\(([A-Za-z][A-Za-z0-9_]*)\)z\${([A-Za-z][A-Za-z0-9_]*)}cFddlm}||dddd}|i}i}i} |j}|njtj |}|rR|j dd\}} | j } | jd d } d | vr| ||<n t| } | ||<}d } |r^t|D]K} || } tj| xstj| }|r|j d}d}||vrt||}no||vrd }nh|tj vrtj |}nB|| vr7| j#dr | dd| vrd }n#d|z|vrd }nt|d|z}nd x||<}|s| |j%d}| d|j'z|z} d |vr| || < t| } | || <|| =| j#ds.| dd| vs7| dd} | |vsB| || <I|| =N|r^|j)|j+D])\}} t-| ts| j ||<+|j/||S#t$r| jd d ||<YwxYw#t$r| j || <YwxYw)zParse a Makefile-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. r)TextFileTsurrogateescape)strip_comments skip_blanks join_lineserrorsNrz$$r@$)rLDFLAGSCPPFLAGSFPY_)distutils.text_filerreadline _variable_rxmatchgroupstripreplaceint ValueErrorlist _findvar1_rxsearch _findvar2_rxstrr)rr,endstartcloseitems isinstanceupdate)rrrrdonenotdonelinemnvtmpvrenamed_variablesrMvaluefounditemafterks rparse_makefilers-    B y  DG {{} <    t $ 771a=DAq A99T2&Dd{  AA  DG) 4: M. "DDME##E*Hl.A.A%.HAGGAJ9tAwO2O!g- % #4 ?3%''DGd!!%%'),E!+AGGI.5=Ee|(- /$'JE*/DJ#DM??51d12hBS6S#'8D#4/-2T DM]. " bHHJ  1 a ggiDG HHTN HO"3iic2DG3` *7).DJ7s$ I2 JI>=I>J J c tj|xstj|}|r@|j\}}|d||j |j dz||dz}n |Sr)aExpand Makefile-style variables -- "${foo}" or "$(foo)" -- in 'string' according to 'vars' (a dictionary mapping variable names to values). Variables not present in 'vars' are silently expanded to the empty string. The variable values in 'vars' should not contain further variable expansions; if 'vars' is the output of 'parse_makefile()', you're fine. Returns a variable-expanded version of 's'. rrN)rrrspanrr)srrbegrs rexpand_makefile_varsr sr     " Arcyrrrs rrdrd@s36rct|dk(rddl}|jdtdtj |S)zReturn the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name) SOrNz SO is deprecated, use EXT_SUFFIXr)warningswarnDeprecationWarningrr)rMr s rrdrdBs4  t| 8:LaP    &&rc\tjj|d}|r|d|S|S)z Add any flags from the environment for the given type. type is the prefix to FLAGS in the environment key (e.g. "C" for "CFLAGS"). FLAGSr)r)rr)rtypeflagss rrrNs4 JJNNdV5> *E!&eWAeW 1E1r)FN)rPboolr5 str | Nonereturnr)FFN)rPrrzrr5rrr)rr rNone)rrr)rzdict[str, str | int])rrrrrzlist[str | int])rrrz&list[str | int] | dict[str, str | int])rMz Literal['SO']rint | str | None)rMrrr)rrrrrr)P__doc__ __future__r functoolsr)r"rerCrutypingrrrjaraco.functoolsr ccompilerr compatr rr utilr typing_extensionsr builtin_module_namesrnr*rer5r6 exec_prefixr base_prefixr7base_exec_prefixrLrabspathr> executablertgetcwdr&rr=r/rMr;r?rcroabiflagsAttributeErrorrGrUrXr_rZr[r\rwr}r lru_cacherrrvrrcompilerrrrrrrrdrrrrr-s #  33& *, 00 0   #** %ggs/ ggs/ 77##C$8$89 RZZ'77??2::.D#EFL ~~wwrwws~~'FG !ryy{ R C$ ' G77d?   -LY'I/    ll @:2 2 2 $ D.7 +8SW, , /3, EO, , ^ "T5n- - 0rzz?@ rzz:; rzz89 m ` 2  2 2 D DO$  xA A 6 6 ' 2 2A   sJ--J54J5