a0bi<SrSSKrSSKrSSKrSSKrSSKrSSKJr SSKJ r SSK J r J r J r SSKJrJrJrJr SSKJr SS KJr S rS rS r"S S\ 5rg)a9distutils.unixccompiler Contains the UnixCCompiler class, a subclass of CCompiler that handles the "typical" Unix-style command-line C compiler: * macros defined with -Dname[=value] * macros undefined with -Uname * include search directories specified with -Idir * libraries specified with -lllib * library search directories specified with -Ldir * compile handled by 'cc' (or similar) executable with -c option: compiles .c to .o * link static library handled by 'ar' command (possibly with 'ranlib') * link shared library handled by 'cc -shared' N) sysconfig)newer) CCompilergen_preprocess_optionsgen_lib_options)DistutilsExecError CompileErrorLibError LinkError)log)compiler_fixupcSn[RRUS5S:XaSnSX;aUS- nSX;aMUSUXS4$)z For macOS, split command into 'env' portion (if any) and the rest of the linker command. >>> _split_env(['a', 'b', 'c']) ([], ['a', 'b', 'c']) >>> _split_env(['/usr/bin/env', 'A=3', 'gcc']) (['/usr/bin/env', 'A=3'], ['gcc']) renvr=Nospathbasenamecmdpivots ڜ/builddir/build/BUILDROOT/alt-python313-setuptools-69.0.2-3.el8.x86_64/opt/alt/python313/lib/python3.13/site-packages/setuptools/_distutils/unixccompiler.py _split_envr-s] E wwA5(SZ QJESZ v;F ##c^[RRUS5S:HnUSUXS4$)z AIX platforms prefix the compiler with the ld_so_aix script, so split that from the linker command. >>> _split_aix(['a', 'b', 'c']) ([], ['a', 'b', 'c']) >>> _split_aix(['/bin/foo/ld_so_aix', 'gcc']) (['/bin/foo/ld_so_aix'], ['gcc']) r ld_so_aixNrrs r _split_aixr?s6 GG  SV $ 3E v;F ##rc:[U5nUSUU:XaUOSnXS$)a The linker command usually begins with the compiler command (possibly multiple elements), followed by zero or more params for shared library building. If the LDSHARED env variable overrides the linker command, however, the commands may not match. Return the best guess of the linker parameters by stripping the linker command. If the compiler command does not match the linker command, assume the linker command is just the first element. >>> _linker_params('gcc foo bar'.split(), ['gcc']) ['foo', 'bar'] >>> _linker_params('gcc foo bar'.split(), ['other']) ['foo', 'bar'] >>> _linker_params('ccache gcc foo bar'.split(), 'ccache gcc'.split()) ['foo', 'bar'] >>> _linker_params(['gcc'], ['gcc']) [] Nr)len) linker_cmd compiler_cmdc_lenrs r_linker_paramsr$Ms..  E'<7EQE f rc 6\rSrSrSrSS/S/S/SS/S/SS/SS.r\RSS S :XaS /\S '/S QrS r Sr Sr Sr Sr S=r=rr\r\RS:XaSrS SjrSrS!SjrS"SjrSrSrSrSr\S5rS#SjrSrg)$ UnixCCompileriunixNccz-sharedarz-cr) preprocessorcompiler compiler_so compiler_cxx linker_so linker_exearchiverranlibdarwinr2)z.cz.Cz.ccz.cxxz.cppz.mz.oz.az.soz.dylibz.tbdzlib%s%scygwinz.exec,URSX45nUupn[X45n URU -n U(aU RSU/5 U(aXZSS&U(aU RU5 U R U5 UR =(d USL=(d [ X5n U (dgU(a.UR[RRU55 URU 5 g![an [U 5eSn A ff=f)N-or)_fix_compile_argsrr+extendappendforcermkpathrrdirnamespawnr r ) selfsource output_filemacros include_dirs extra_preargsextra_postargs fixed_argsignorepp_optspp_args preprocessmsgs rrJUnixCCompiler.preprocesss++D&G '1$ (>##g-  NND+. / 'BQK  NN> *v ZZT;$#6T%:T    KK 4 5 $ JJw ! $s# # $s'C99 D DDc[URXE-5nURXt-USU/-U-5 g![an[ U5eSnAff=f)Nr7)rr-r>r r ) r?objsrcextcc_argsrErHr-rKs r_compileUnixCCompiler._compilesW$T%5%5w7OP  $ JJ{,T3/??.P Q! $s# # $s7 A A  AcURX5upURX#S9nURX5(aUR[R R U55 URURU/-U-UR-5 UR(a!URURU/-5 gg[R"SU5 g![an[U5eSnAff=f)N) output_dirskipping %s (up-to-date))_fix_object_argslibrary_filename _need_linkr<rrr=r>r1objectsr2r r r debug)r?rZoutput_libnamerUr[ target_langoutput_filenamerKs rcreate_static_libUnixCCompiler.create_static_libs#33GH///V ??7 4 4 KK8 9 JJt}}'887BT\\Q R{{(JJt{{o->>? II0/ B*("3-'(s(C!! C;+ C66C;c,URX$5up$URXVU5nUupVn[XXu5n[U[[ S545(d [ S5eUb[RRXC5nURX#5(GaFX R-U-SU/-nU (aS/USS&U (aU USS&U (aURU 5 UR[RRU55 U[R :HnU(a UR"O UR$SSnU S:XatUR&(ac[)U5unn[+U5unn[)UR&5unn[)UR"5unn[-UU5nUU-U-U-n[/UU5nUR1UU-5 g[6R8"SU5 g![2an5eSnAff=f)Nz%'output_dir' must be a string or Noner7z-grzc++rV)rW _fix_lib_argsr isinstancestrtype TypeErrorrrjoinrYrZr9r<r=r EXECUTABLEr0r/r.rrr$rr>r r r r[)r? target_descrZr^rU libraries library_dirsruntime_library_dirsexport_symbolsr[rDrE build_tempr]rFlib_optsld_args building_exelinkerr linker_neaix linker_na_compiler_cxx_ne linker_exe_neparamsrKs rlinkUnixCCompiler.links #33GH'' AUV 8B5 !5"47KW*sDJ&788CD D  ! ggll:GO ??7 4 4 ,x74:QQG#f + ~. KK8 9 % +i.B.BB -9$//t~~qQ%'D,=,=%/%7NC%/ %:NC)3D4E4E)F&A'1$//'B$A}+I}EF 3Y86AF'8 6G+, II0/ B& %n$ %sCG99 H HHc SU-$)N-L)r?dirs rlibrary_dir_option UnixCCompiler.library_dir_option czrc[R"S5n[RR [ R "U5S5nSU;=(d SU;$)NCCrgcczg++)rget_config_varrrrshlexsplit)r?cc_varr,s r_is_gccUnixCCompiler._is_gccsI))$/77##EKK$7$:; 5EX$55rcv[RSSS:Xa.SSKJnJn U"5nU(aU"U5SS/:aSU-$SU-$[RSS S :XaS U-$[RSSS :XaUR 5(aS OSSU-/$[ R"S5S:XaSU-$SU-$)Nr3r4r)get_macosx_target_ver split_version z -Wl,-rpath,r}freebsdz -Wl,-rpath=zhp-uxz-Wl,+sz+sGNULDyesz-Wl,--enable-new-dtags,-Rz-Wl,-R)sysplatformdistutils.utilrrrrr)r?rrrmacosx_target_vers rruntime_library_dir_option(UnixCCompiler.runtime_library_dir_options << x ' K 5 7  ]3D%E"a%P$s**cz! \\"1  * 3& & \\"1  ( LLNNs    # #G , 5/4 4c> !rc SU-$)Nz-lr~)r?libs rlibrary_optionUnixCCompiler.library_optionDrrc[R"S5n[R"SU5n[R S:H=(aO U=(aF UR S5=(d. UR S5=(a UR S5(+nU(a2[RRURS5USS5$U$) a( macOS users can specify an alternate SDK using'-isysroot'. Calculate the SDK root if it is specified. Note that, as of Xcode 7, Apple SDKs may contain textual stub libraries with .tbd extensions rather than the normal .dylib shared libraries installed in /. The Apple compiler tool chain handles this transparently but it can cause problems for programs that are being built with an SDK and searching for specific libraries. Callers of find_library_file need to keep in mind that the base filename of the returned SDK library file might have a different extension from that of the library file installed on the running system, for example: /Applications/Xcode.app/Contents/Developer/Platforms/ MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/ usr/lib/libedit.tbd vs /usr/lib/libedit.dylib CFLAGSz-isysroot\s*(\S+)r4z/System/z/usr/z /usr/local/rN) rrresearchrr startswithrrrggroup)rcflagsmatch apply_roots r _library_rootUnixCCompiler._library_rootGs*))(3 .7 LLH $  z*SNN7+QCNN=4Q0Q 9Crww||EKKNCG4KKrc^^UU4SjSR55n[TRU5nS[R"XT55n[ [ RRU5n[US5$)a Second-guess the linker with not much hard data to go on: GCC seems to prefer the shared library, so assume that *all* Unix C compilers do, ignoring even GCC's "-static" option. >>> compiler = UnixCCompiler() >>> compiler._library_root = lambda dir: dir >>> monkeypatch = getfixture('monkeypatch') >>> monkeypatch.setattr(os.path, 'exists', lambda d: 'existing' in d) >>> dirs = ('/foo/bar/missing', '/foo/bar/existing') >>> compiler.find_library_file(dirs, 'abc').replace('\\', '/') '/foo/bar/existing/libabc.dylib' >>> compiler.find_library_file(reversed(dirs), 'abc').replace('\\', '/') '/foo/bar/existing/libabc.dylib' >>> monkeypatch.setattr(os.path, 'exists', ... lambda d: 'existing' in d and '.a' in d) >>> compiler.find_library_file(dirs, 'abc').replace('\\', '/') '/foo/bar/existing/libabc.a' >>> compiler.find_library_file(reversed(dirs), 'abc').replace('\\', '/') '/foo/bar/existing/libabc.a' c3D># UHnTRTUS9v M g7f))lib_typeN)rX).0rerr?s r 2UnixCCompiler.find_library_file..s( @  ! !# ! 5@s zdylib xcode_stub shared staticc3d# UH&up[RRX5v M( g7f)N)rrrg)rrootlib_names rrrs) "E GGLL ( ("Es.0N) rmapr itertoolsproductfilterrrexistsnext)r?dirsrr[ lib_namesrootssearchedfounds` ` rfind_library_fileUnixCCompiler.find_library_filejsn. 8>>@ D&&- "+"3"3E"E  rww~~x0E4  rr~)NNNNN)NrN) NNNNNrNNNN)r)__name__ __module__ __qualname____firstlineno__ compiler_type executablesrrsrc_extensions obj_extensionstatic_lib_extensionshared_lib_extensiondylib_lib_extensionxcode_stub_lib_extensionstatic_lib_formatshared_lib_formatdylib_lib_formatxcode_stub_lib_format exe_extensionrJrRr_rzrrrr staticmethodrr__static_attributes__r~rrr&r&is(MFvI&f5M K ||BQ8#!) H?NM "%?HHH),<, ||x #$J$NRC:!9C~6 &"P L LD&!rr&)__doc__rrrrrr _modifiedr ccompilerrrrerrorsr r r r _logr _macos_compatrrrr$r&r~rrrsP  IIII)$$$ $8g!Ig!r