ó þ¾v]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-vZZv26/setuptools/setuptools/monkey.pyt_get_mros cCsCt|tjƒrtnt|tjƒr0tnd„}||ƒS(NcSsdS(N(tNone(titem((s7/tmp/pip-install-vZZv26/setuptools/setuptools/monkey.pyt*t(t isinstanceRt class_typestget_unpatched_classttypest FunctionTypetget_unpatched_function(R tlookup((s7/tmp/pip-install-vZZv26/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-vZZv26/setuptools/setuptools/monkey.pys 6st distutilss(distutils has already been patched by %r(R tnextRRtAssertionError(Rtexternal_basestbasetmsg((s7/tmp/pip-install-vZZv26/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_metadatatdisttcmdt Distributiont extensiont Extensiontmodulest#patch_for_msvc_specialized_compiler(thas_issue_12885tneeds_warehouset warehousetmodule((s7/tmp/pip-install-vZZv26/setuptools/setuptools/monkey.pyt patch_allAs$cCs=x6dD].}ttj|ƒ}ttjj||ƒqWdS(sDPatch write_pkg_file and read_pkg_file for higher metadata standardstwrite_pkg_filet read_pkg_filetget_metadata_versionN(R6R7R8(tgetattrRR*tsetattrRtDistributionMetadata(tattrtnew_val((s7/tmp/pip-install-vZZv26/setuptools/setuptools/monkey.pyR)hs cCs9t||ƒ}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(R9tvarst setdefaultR:(t replacementt target_modt func_nametoriginal((s7/tmp/pip-install-vZZv26/setuptools/setuptools/monkey.pyt patch_funcoscCs t|dƒS(NR>(R9(t candidate((s7/tmp/pip-install-vZZv26/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_(tlstripR9Rthasattrt ImportError(tmod_nameRCt repl_prefixt repl_nametrepltmod(tmsvc(s7/tmp/pip-install-vZZv26/setuptools/setuptools/monkey.pyt patch_paramss sdistutils.msvc9compilersdistutils._msvccompilertfind_vcvarsalltquery_vcvarsallt _get_vc_envtgen_lib_options(RRtsystemt functoolstpartialRERN(RURHtmsvc14((RTs7/tmp/pip-install-vZZv26/setuptools/setuptools/monkey.pyR0„s&     (t__doc__R"tdistutils.filelistRRRR[t importlibRRtsetuptools.externRRt__all__R RRR5R)RERR0(((s7/tmp/pip-install-vZZv26/setuptools/setuptools/monkey.pyts$          '