JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3RbrJFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3RbrB  f3@sldZddlZddlZddlmZddlmZddlmZddl m Z ddd Z Gd d d eZ dd d Z dS)adistutils.command.config Implements the Distutils 'config' command, a (mostly) empty command class that exists mainly to be sub-classed by specific module distributions and applications. The idea is that while every "config" command is different, at least they're all named the same, and users always see "config" in the list of standard commands. Also, this is a good place to put common configure-like tasks: "try to compile this C code", or "figure out where this header file lives". N)Command)DistutilsExecError)customize_compiler)logz.cz.cxx)czc++c @seZdZdZdddddddd d g Zd d Zd dZddZddZddZ ddZ ddZ ddZ ddZ d0dd Zd1d!d"Zd2d#d$Zd3d%d&Zd4d'd(Zd5d*d+Zdddgfd,d-Zd6d.d/ZdS)7configzprepare to build)z compiler=Nzspecify the compiler type)zcc=Nzspecify the compiler executable)z include-dirs=Iz.list of directories to search for header files)zdefine=DzC preprocessor macros to define)zundef=Uz!C preprocessor macros to undefine)z libraries=lz!external C libraries to link with)z library-dirs=Lz.directories to search for external C libraries)noisyNz1show every action (compile, link, run, ...) taken)z dump-sourceNz=dump generated source files before attempting to compile themcCs4d|_d|_d|_d|_d|_d|_d|_g|_dS)N)compilerZcc include_dirs libraries library_dirsr dump_source temp_files)selfr=/opt/alt/python37/lib64/python3.7/distutils/command/config.pyinitialize_options3szconfig.initialize_optionscCs|jdkr|jjpg|_nt|jtr6|jtj|_|jdkrHg|_nt|jtr^|jg|_|jdkrpg|_nt|jtr|jtj|_dS)N) rZ distribution isinstancestrsplitospathseprr)rrrrfinalize_optionsBs       zconfig.finalize_optionscCsdS)Nr)rrrrrunRsz config.runcCszddlm}m}t|j|sv||j|jdd|_t|j|jrN|j|j|j rb|j |j |j rv|j |j dS)z^Check that 'self.compiler' really is a CCompiler object; if not, make it one. r) CCompiler new_compilerr)rdry_runZforceN) distutils.ccompilerr r!rrr"rrZset_include_dirsrZ set_librariesrZset_library_dirs)rr r!rrr_check_compilerYs  zconfig._check_compilercCsldt|}t|d}|r@x|D]}|d|q W|d|||ddkr`|d||S)NZ _configtestwz#include <%s>  )LANG_EXTopenwriteclose)rbodyheaderslangfilenamefileheaderrrr_gen_temp_sourcefileks       zconfig._gen_temp_sourcefilecCs<||||}d}|j||g|jj|||d||fS)Nz _configtest.i)r)r2rextendrZ preprocess)rr,r-rr.srcoutrrr _preprocessxs zconfig._preprocesscCs\||||}|jr"t|d||j|g\}|j||g|jj|g|d||fS)Nzcompiling '%s':)r)r2r dump_filerZobject_filenamesrr3compile)rr,r-rr.r4objrrr_compileszconfig._compilec Csr|||||\}}tjtj|d} |jj|g| |||d|jjdk r\| |jj} |j | ||| fS)Nr)rrZ target_lang) r:rpathsplitextbasenamerZlink_executableZ exe_extensionrappend) rr,r-rrrr.r4r9progrrr_links    z config._linkc GsX|s|j}g|_tdd|x0|D](}yt|Wq(tk rNYq(Xq(WdS)Nz removing: %s )rrinfojoinrremoveOSError)r filenamesr/rrr_cleans z config._cleanNrcCsRddlm}|d}y|||||Wn|k rDd}YnX||S)aQConstruct a source file from 'body' (a string containing lines of C/C++ code) and 'headers' (a list of header files to include) and run it through the preprocessor. Return true if the preprocessor succeeded, false if there were any errors. ('body' probably isn't of much use, but what the heck.) r) CompileErrorTF)r#rHr$r6rG)rr,r-rr.rHokrrrtry_cpps  zconfig.try_cppc Csx||||||\}}t|tr0t|}t|}d} x&|} | dkrPP|| r>d} Pq>W| | | S)aConstruct a source file (just like 'try_cpp()'), run it through the preprocessor, and return true if any line of the output matches 'pattern'. 'pattern' should either be a compiled regex object or a string containing a regex. If both 'body' and 'headers' are None, preprocesses an empty file -- which can be useful to determine the symbols the preprocessor and compiler set by default. FT) r$r6rrrer8r)readlinesearchr+rG) rpatternr,r-rr.r4r5r0matchlinerrr search_cpps    zconfig.search_cppcCsdddlm}|y|||||d}Wn|k rDd}YnXt|rRdpTd||S)zwTry to compile a source file built from 'body' and 'headers'. Return true on success, false otherwise. r)rHTFzsuccess!zfailure.)r#rHr$r:rrBrG)rr,r-rr.rHrIrrr try_compiles  zconfig.try_compilec Cspddlm}m}|y|||||||d} Wn||fk rPd} YnXt| r^dp`d|| S)zTry to compile and link a source file, built from 'body' and 'headers', to executable form. Return true on success, false otherwise. r)rH LinkErrorTFzsuccess!zfailure.)r#rHrTr$r@rrBrG) rr,r-rrrr.rHrTrIrrrtry_links   zconfig.try_linkc Csddlm}m}|y.|||||||\} } } || gd} Wn||tfk rdd} YnXt| rrdptd| | S)zTry to compile, link to an executable, and run a program built from 'body' and 'headers'. Return true on success, false otherwise. r)rHrTTFzsuccess!zfailure.) r#rHrTr$r@ZspawnrrrBrG) rr,r-rrrr.rHrTr4r9ZexerIrrrtry_runs   zconfig.try_runrc Cst|g}|r|d||d|r<|d|n|d||dd|d}||||||S)aDetermine if function 'func' is available by constructing a source file that refers to 'func', and compiles and links it. If everything succeeds, returns true; otherwise returns false. The constructed source file starts out by including the header files listed in 'headers'. If 'decl' is true, it then declares 'func' (as "int func()"); you probably shouldn't supply 'headers' and set 'decl' true in the same call, or you might get errors about a conflicting declarations for 'func'. Finally, the constructed 'main()' function either references 'func' or (if 'call' is true) calls it. 'libraries' and 'library_dirs' are used when linking. z int %s ();z int main () {z %s();z %s;}r&)r$r>rCrU) rfuncr-rrrZdeclZcallr,rrr check_funcs   zconfig.check_funccCs ||d|||g||S)aDetermine if 'library' is available to be linked against, without actually checking that any particular symbols are provided by it. 'headers' will be used in constructing the source file to be compiled, but the only effect of this is to check if all the header files listed are available. Any libraries listed in 'other_libraries' will be included in the link, in case 'library' has symbols that depend on other libraries. zint main (void) { })r$rU)rZlibraryrr-rZother_librariesrrr check_lib6s  zconfig.check_libcCs|jd|g|dS)zDetermine if the system header file named by 'header_file' exists and can be found by the preprocessor; return true if so, false otherwise. z /* No body */)r,r-r)rJ)rr1rrr.rrr check_headerDs zconfig.check_header)NNNr)NNNr)NNr)NNNNr)NNNNr)NNNNrr)NNr)__name__ __module__ __qualname__Z descriptionZ user_optionsrrrr$r2r6r:r@rGrJrRrSrUrVrYrZr[rrrrrsB         rcCsJ|dkrtd|n t|t|}zt|Wd|XdS)zjDumps a file content into log.info. If head is not None, will be dumped before the file content. Nz%s)rrBr)readr+)r/headr0rrrr7Ns r7)N)__doc__rrLZdistutils.corerZdistutils.errorsrZdistutils.sysconfigrZ distutilsrr(rr7rrrr s     ;