U ë˜Reaã@s�dZddlZddlZddlZddlZddlZddlmZddl Z ddl Z gZ dd„Z dd„Z dd „Zd d „Zd d „Zdd„Zdd„Zdd„ZdS)z Monkey patching of distutils. éN)Ú import_modulecCs"t ¡dkr|f|jSt |¡S)am Returns the bases classes for cls sorted by the MRO. Works around an issue on Jython where inspect.getmro will not return all base classes if multiple classes share the same name. Instead, this function will return a tuple containing the class itself, and the contents of cls.__bases__. See https://github.com/pypa/setuptools/issues/1024. ÚJython)ÚplatformÚpython_implementationÚ __bases__ÚinspectÚgetmro)Úcls©r ú‡/builddir/build/BUILDROOT/alt-python38-setuptools-58.3.0-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/setuptools/monkey.pyÚ_get_mros  r cCs.t|tƒrtnt|tjƒrtndd„}||ƒS)NcSsdS)Nr )Úitemr r r Ú(ózget_unpatched..)Ú isinstanceÚtypeÚget_unpatched_classÚtypesÚ FunctionTypeÚget_unpatched_function)r Úlookupr r r Ú get_unpatched$s ýrcCs:dd„t|ƒDƒ}t|ƒ}|j d¡s6d|}t|ƒ‚|S)z•Protect against re-patching the distutils if reloaded Also ensures that no other distutils extension monkeypatched the distutils first. css|]}|j d¡s|VqdS)Ú setuptoolsN)Ú __module__Ú startswith)Ú.0r r r r Ú 3s þz&get_unpatched_class..Ú distutilsz(distutils has already been patched by %r)r ÚnextrrÚAssertionError)r Zexternal_basesÚbaseÚmsgr r r r-sþ rcCsÔtjtj_tjdk}|r"tjtj_tjdkp^dtjko@dknp^dtjkoZdkn}|rrd}|tjj _ t ƒtj tjtj fD]}tj j|_qˆtjjtj_tjjtj_dtjkrÊtjjtjd_tƒdS)N)éér")ééé )r"é)r"r'é)r"r#zhttps://upload.pypi.org/legacy/zdistutils.command.build_ext)rÚCommandrÚcoreÚsysÚ version_infoÚfindallÚfilelistÚconfigÚ PyPIRCCommandÚDEFAULT_REPOSITORYÚ_patch_distribution_metadataÚdistÚcmdÚ DistributionÚ extensionÚ ExtensionÚmodulesÚ#patch_for_msvc_specialized_compiler)Zhas_issue_12885Zneeds_warehouseZ warehouseÚmoduler r r Ú patch_all?s*    þû     ÿ r;cCs*dD] }ttj|ƒ}ttjj||ƒqdS)zDPatch write_pkg_file and read_pkg_file for higher metadata standards)Úwrite_pkg_fileÚ read_pkg_fileZget_metadata_versionN)Úgetattrrr3ÚsetattrrÚDistributionMetadata)ÚattrÚnew_valr r r r2fs r2cCs*t||ƒ}t|ƒ d|¡t|||ƒdS)zž Patch func_name in target_mod with replacement Important - original must be resolved by name to avoid patching an already patched function. Ú unpatchedN)r>ÚvarsÚ setdefaultr?)Ú replacementZ target_modÚ func_nameÚoriginalr r r Ú patch_funcms rIcCs t|dƒS)NrC)r>)Ú candidater r r r~srcs¾tdƒ‰t ¡dkrdS‡fdd„}t |d¡}t |d¡}zt|dƒŽt|d ƒŽWntk rlYnXzt|d ƒŽWntk r’YnXzt|d ƒŽWntk r¸YnXdS) z\ Patch functions in distutils to use standalone Microsoft Visual C++ compilers. zsetuptools.msvcÚWindowsNcsLd|kr dnd}|| d¡}tˆ|ƒ}t|ƒ}t||ƒsBt|ƒ‚|||fS)zT Prepare the parameters for patch_func to patch indicated function. Úmsvc9Zmsvc9_Zmsvc14_Ú_)Úlstripr>rÚhasattrÚ ImportError)Úmod_namerGZ repl_prefixZ repl_nameÚreplÚmod©Zmsvcr r Ú patch_paramsŽs  z9patch_for_msvc_specialized_compiler..patch_paramszdistutils.msvc9compilerzdistutils._msvccompilerZfind_vcvarsallZquery_vcvarsallZ _get_vc_envZgen_lib_options)rrÚsystemÚ functoolsÚpartialrIrP)rUrLZmsvc14r rTr r9‚s&    r9)Ú__doc__r+Údistutils.filelistrrrrWÚ importlibrrrÚ__all__r rrr;r2rIrr9r r r r Ús"  '