3 NOÖjÈNã @sÞdZddlZddlZddlZddlZddlmZejjej ƒZ ejjej ƒZ ejjej ƒZejjejƒZdejkr†ejjejdƒZnejjejjejƒƒZejdkrÈejƒjd,ƒrÈejjejjeƒƒZd d „Zeed dƒZeoöejdkoöejƒjd-ƒ�rejjejjeƒƒZd d „ZeƒZdZye�s.ejZWne k �rFYnXdd„Z!d.dd„Z"d/dd„Z#dd„Z$dd„Z%dd„Z&d0dd„Z'ej(dƒZ)ej(dƒZ*ej(dƒZ+d1d d!„Z,d"d#„Z-da.d$d%„Z/d&d'„Z0d(d)„Z1d*d+„Z2dS)2a�Provide 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: éNé)ÚDistutilsPlatformErrorZ_PYTHON_PROJECT_BASEÚntú\pcbuild\win32ú\pcbuild\amd64cCs.x(dD] }tjjtjj|d|ƒƒrdSqWdS)Nú Setup.distú Setup.localÚModulesTF)rr)ÚosÚpathÚisfileÚjoin)ÚdÚfn©rú+/usr/lib64/python3.6/distutils/sysconfig.pyÚ_is_python_source_dir)s rÚ_homecCstr ttƒSttƒS)N)Ú _sys_homerÚ project_baserrrrÚ _python_build2srÚcCsdtjdd…S)z–Return a string containing the major and minor Python version, leaving off the patchlevel. Sample return values could be '1.5' or '2.2'. z%d.%dNé)ÚsysÚ version_inforrrrÚget_python_versionDsrcCs”|dkr|rtpt}tjdkrjtrL|r.tp,tStjjt dƒdƒ}tjj |ƒSdt ƒt }tjj|d|ƒStjdkr‚tjj|dƒSt dtjƒ‚dS) a¤Return 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'. NÚposixÚsrcdirZIncludeÚpythonÚincluderzFI don't know where Python installs its C header files on platform '%s')ÚBASE_EXEC_PREFIXÚ BASE_PREFIXr ÚnameÚ python_buildrrr r Úget_config_varÚnormpathrÚ build_flagsr)Ú plat_specificÚprefixZincdirZ python_dirrrrÚget_python_incLs     r)cCs°|dkr&|r|rtpt}n |r"tp$t}tjdkrp|s8|r>d}nd}tjj||dtƒƒ}|r`|Stjj|dƒSnrAZccZcxxÚoptZcflagsZccsharedZldsharedZ shlib_suffixÚarZar_flagsZnewccZcppr?Zcc_cmdrrrrBšs\                         rBcCsDtr,tjdkr"tjjtptdƒ}q6tp(t}n tdd�}tjj|dƒS)z2Return full pathname of installed pyconfig.h file.rÚPCr)r'z pyconfig-64.h)r#r r"r r rrr))Úinc_dirrrrÚget_config_h_filenameãs    rLcCs\trtjjtptdƒStddd�}djtƒt ƒ}t t j dƒrL|dt j j 7}tjj||dƒS)zAReturn full pathname of installed Makefile from the Python build.ÚMakefilerr)r'r.z config-{}{}Ú _multiarchz-%s)r#r r r rrr/Úformatrr&ÚhasattrrÚimplementationrN)Zlib_dirZ config_filerrrÚget_makefile_filenameðs  rRc Csž|dkr i}tjdƒ}tjdƒ}xx|jƒ}|s0P|j|ƒ}|rz|jddƒ\}}y t|ƒ}Wntk rnYnX|||<q"|j|ƒ}|r"d||jdƒ<q"W|S)zÌParse 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. Nz"#define ([A-Z][A-Za-z0-9_]+) (.*) z&/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/ rrr)ÚreÚcompileÚreadlineÚmatchÚgroupÚintÚ ValueError)ÚfpÚgÚ define_rxÚundef_rxÚlineÚmÚnÚvrrrÚparse_config_hûs(      rbz"([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_]*)}c CsÌddlm}||ddddd�}|dkr*i}i}i}x”|jƒ}|dkrFPtj|ƒ}|r4|jddƒ\}} | jƒ} | jdd ƒ} d | krŠ| ||<q4y t| ƒ} Wn$t k rº| jdd ƒ||<Yq4X| ||<q4Wd} �x¶|�r„�x¨t |ƒD�]š} || } t j | ƒ�pt j | ƒ}|�rx|jdƒ}d}||k�r2t||ƒ}nˆ||k�rBd}nx|tjk�rZtj|}n`|| k�r®| jdƒ�rˆ| dd…| k�rˆd }n$d||k�rœd}nt|d|ƒ}n d ||<}|�r~| |jƒd…}| d|jƒ…||} d |k�rü| || <nzy t| ƒ} Wn"t k �r*| jƒ|| <Yn X| || <|| =| jdƒ�r~| dd…| k�r~| dd…} | |k�r~| || <qâ|| =qâWqÐW|jƒx.|jƒD]"\}} t| tƒ�r˜| jƒ||<�q˜W|j|ƒ|S)zÌParse 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)ÚTextFilerÚsurrogateescape)Zstrip_commentsZ skip_blanksZ join_linesÚerrorsNrz$$rú$r5r;r=TFÚPY_é)r5r;r=)Zdistutils.text_filercrUÚ _variable_rxrVrWÚstripÚreplacerXrYÚlistÚ _findvar1_rxÚsearchÚ _findvar2_rxÚstrr rErFÚendÚstartÚcloseÚitemsÚ isinstanceÚupdate)rr[rcrZÚdoneÚnotdoner^r_r`raÚtmpvÚrenamed_variablesr"ÚvalueÚfoundÚitemÚafterÚkrrrÚparse_makefiles„                       r€cCsZxTtj|ƒptj|ƒ}|rP|jƒ\}}|d|…|j|jdƒƒ||d…}qPqW|S)a¨Expand 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)rmrnroÚspanÚgetrW)ÚsÚvarsr_ZbegrqrrrÚexpand_makefile_varsˆs *r…c CsVtjjddjtjtjttjddƒd�ƒ}t |t ƒt ƒdgdƒ}|j }ia t j|ƒdS) z7Initialize the module as appropriate for POSIX systems.Ú_PYTHON_SYSCONFIGDATA_NAMEz+_sysconfigdata_{abi}_{platform}_{multiarch}rNr)Úabir@Ú multiarchÚbuild_time_varsrN)r rEr‚rOrÚabiflagsr@ÚgetattrrQÚ __import__ÚglobalsÚlocalsr‰rCrv)r"Ú_tempr‰rrrÚ _init_posix£sr�cCs~i}tddd�|d<tddd�|d<tdd�|d<tjƒd|d<d |d <tƒjd d ƒ|d <tjjtjj t j ƒƒ|d<|a dS)z+Initialize the module as appropriate for NTrr)r'r.ÚLIBDESTÚ BINLIBDEST)r'Ú INCLUDEPYÚ EXT_SUFFIXz.exeÚEXEÚ.rÚVERSIONÚBINDIRN) r/r)Ú_impÚextension_suffixesrrkr r ÚdirnameÚabspathrÚ executablerC)r[rrrÚ_init_nt³sržcGs^tdk�r(tƒjdtjƒ}|r(|ƒniattd<ttd<tjdƒ}|dk rV|td<tjdtƒ}tjdkrœtrŽtj j t ƒƒ}tj j ||ƒ}ntj j t ƒƒ}tj j tj j|ƒƒtd<toÀtjdk�r t}tj jtdƒ oä|tjƒk�r tj j |tdƒ}tj j|ƒtd<tjd k�r(d dl}|jtƒ|�rVg}x|D]}|jtj|ƒƒ�q8W|StSdS) aßWith no arguments, return a dictionary of all configuration variables relevant for the current platform. Generally this includes everything needed to build extensions and install both pure modules and extensions. On Unix, this means every variable defined in Python's installed Makefile; on Windows it's a much smaller set. With arguments, return a list of values that result from looking up each argument in the configuration variable dictionary. NZ_init_r(Ú exec_prefixr”ÚSOrrr0r)rCr�r‚r r"r-r,rr#r r›rRr rœr%ÚisabsÚgetcwdrr@rAÚcustomize_config_varsÚappend)ÚargsÚfuncr rÚbaserAÚvalsr"rrrrDÆs@       rDcCs*|dkrddl}|jdtdƒtƒj|ƒS)z“Return the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name) r rNz SO is deprecated, use EXT_SUFFIXr)ÚwarningsÚwarnÚDeprecationWarningrDr‚)r"r©rrrr$sr$)rr)rr)rN)rrN)N)N)3Ú__doc__r™r rSrrerr r%r(r-rŸr,Ú base_prefixr!Úbase_exec_prefixr rErœrr›r�r"ÚlowerÚendswithrr‹rrr#r&rŠÚAttributeErrorrr)r/rBrLrRrbrTrirmror€r…rCr�ržrDr$rrrrÚ sZ      # +I      jJ