ó à\e[c@sÌdZddlZddlZddlZddlZddlZddlmZddl Z ddl m Z ddl Z gZ d„Zd„Zd„Zd„Zd „Zd „Zd „Zd „ZdS( s Monkey patching of distutils. iÿÿÿÿN(t import_module(tsixcCs-tjƒdkr |f|jStj|ƒS(sm 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. tJython(tplatformtpython_implementationt __bases__tinspecttgetmro(tcls((s7/tmp/pip-install-0xiv62/setuptools/setuptools/monkey.pyt_get_mros cCsCt|tjƒrtnt|tjƒr0tnd„}||ƒS(NcSsdS(N(tNone(titem((s7/tmp/pip-install-0xiv62/setuptools/setuptools/monkey.pyt*s(t isinstanceRt class_typestget_unpatched_classttypest FunctionTypetget_unpatched_function(R tlookup((s7/tmp/pip-install-0xiv62/setuptools/setuptools/monkey.pyt get_unpatched&s cCsQd„t|ƒDƒ}t|ƒ}|jjdƒsMd|}t|ƒ‚n|S(s•Protect against re-patching the distutils if reloaded Also ensures that no other distutils extension monkeypatched the distutils first. css'|]}|jjdƒs|VqdS(t setuptoolsN(t __module__t startswith(t.0R((s7/tmp/pip-install-0xiv62/setuptools/setuptools/monkey.pys 6st distutilss(distutils has already been patched by %r(R tnextRRtAssertionError(Rtexternal_basestbasetmsg((s7/tmp/pip-install-0xiv62/setuptools/setuptools/monkey.pyR/s  cCs1tjtj_tjd k}|r6tjtj_ntjd kp€d tjko_d knp€dtjko~dkn}|r¡d}|tjj _ nt ƒx/tj tjtj fD]}tj j|_qÁWtjjtj_tjjtj_d tjkr&tjjtjd _ntƒdS(Niiiii iishttps://upload.pypi.org/legacy/sdistutils.command.build_ext(iii(iii (ii(iii(ii(iii(RtCommandRtcoretsyst version_infotfindalltfilelisttconfigt PyPIRCCommandtDEFAULT_REPOSITORYt+_patch_distribution_metadata_write_pkg_filetdisttcmdt Distributiont extensiont Extensiontmodulest#patch_for_msvc_specialized_compiler(thas_issue_12885tneeds_warehouset warehousetmodule((s7/tmp/pip-install-0xiv62/setuptools/setuptools/monkey.pyt patch_allAs$cCstjjtjj_dS(sDPatch write_pkg_file to also write Requires-Python/Requires-ExternalN(RR)twrite_pkg_fileRtDistributionMetadata(((s7/tmp/pip-install-0xiv62/setuptools/setuptools/monkey.pyR(hscCs9t||ƒ}t|ƒjd|ƒt|||ƒdS(sž Patch func_name in target_mod with replacement Important - original must be resolved by name to avoid patching an already patched function. t unpatchedN(tgetattrtvarst setdefaulttsetattr(t replacementt target_modt func_nametoriginal((s7/tmp/pip-install-0xiv62/setuptools/setuptools/monkey.pyt patch_funcoscCs t|dƒS(NR7(R8(t candidate((s7/tmp/pip-install-0xiv62/setuptools/setuptools/monkey.pyR€scsátdƒ‰tjƒdkr"dS‡fd†}tj|dƒ}tj|dƒ}y$t|dƒŒt|dƒŒWntk rŒnXyt|d ƒŒWntk r´nXyt|d ƒŒWntk rÜnXdS( s\ Patch functions in distutils to use standalone Microsoft Visual C++ compilers. ssetuptools.msvctWindowsNcsqd|krdnd}||jdƒ}tˆ|ƒ}t|ƒ}t||ƒsdt|ƒ‚n|||fS(sT Prepare the parameters for patch_func to patch indicated function. tmsvc9tmsvc9_tmsvc14_t_(tlstripR8Rthasattrt ImportError(tmod_nameR>t repl_prefixt repl_nametrepltmod(tmsvc(s7/tmp/pip-install-0xiv62/setuptools/setuptools/monkey.pyt patch_paramss sdistutils.msvc9compilersdistutils._msvccompilertfind_vcvarsalltquery_vcvarsallt _get_vc_envtgen_lib_options(RRtsystemt functoolstpartialR@RI(RPRCtmsvc14((ROs7/tmp/pip-install-0xiv62/setuptools/setuptools/monkey.pyR/„s&     (t__doc__R!tdistutils.filelistRRRRVt importlibRRtsetuptools.externRRt__all__R RRR4R(R@RR/(((s7/tmp/pip-install-0xiv62/setuptools/setuptools/monkey.pyts$          '