ó Àfc@sÕdZddlZddlZddlZddlZddlZddlmZddl Z ddl m Z ddl Z gZ d„Zd„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((s5/usr/lib/python2.7/site-packages/setuptools/monkey.pyt_get_mros cCsCt|tjƒrtnt|tjƒr0tnd„}||ƒS(NcSsdS(N(tNone(titem((s5/usr/lib/python2.7/site-packages/setuptools/monkey.pyt*t(t isinstanceRt class_typestget_unpatched_classttypest FunctionTypetget_unpatched_function(R tlookup((s5/usr/lib/python2.7/site-packages/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((s5/usr/lib/python2.7/site-packages/setuptools/monkey.pys 6st distutilss(distutils has already been patched by %r(R tnextRRtAssertionError(Rtexternal_basestbasetmsg((s5/usr/lib/python2.7/site-packages/setuptools/monkey.pyR/s  cCsWtjtj_tjd k}|r6tjtj_ntjd kpŸd tjko_dknpŸdtjko~dknpŸdtjkodkn}|rÀd }|tjj _ nt ƒt ƒx/tj tjtjfD]}tj j|_qçWtjjtj_tjjtj_d tjkrLtjjtjd _ntƒdS(Niiiii iiishttps://upload.pypi.org/legacy/sdistutils.command.build_ext(iii(iii (ii(iii(ii(iii(ii(iii(RtCommandRtcoretsyst version_infotfindalltfilelisttconfigt PyPIRCCommandtDEFAULT_REPOSITORYt+_patch_distribution_metadata_write_pkg_filet+_patch_distribution_metadata_write_pkg_infotdisttcmdt Distributiont extensiont Extensiontmodulest#patch_for_msvc_specialized_compiler(thas_issue_12885tneeds_warehouset warehousetmodule((s5/usr/lib/python2.7/site-packages/setuptools/monkey.pyt patch_allAs(cCstjjtjj_dS(sDPatch write_pkg_file to also write Requires-Python/Requires-ExternalN(RR+twrite_pkg_fileRtDistributionMetadata(((s5/usr/lib/python2.7/site-packages/setuptools/monkey.pyR)kscCsFdtjd kodkn}|s-dStjjtjj_dS(sÇ Workaround issue #197 - Python 3 prior to 3.2.2 uses an environment-local encoding to save the pkg_info. Monkey-patch its write_pkg_info method to correct this undesirable behavior. iiN(i(iii(R"R#RR+twrite_pkg_infoRR8(tenvironment_local((s5/usr/lib/python2.7/site-packages/setuptools/monkey.pyR*rs#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(tgetattrtvarst setdefaulttsetattr(t replacementt target_modt func_nametoriginal((s5/usr/lib/python2.7/site-packages/setuptools/monkey.pyt patch_funcscCs t|dƒS(NR;(R<(t candidate((s5/usr/lib/python2.7/site-packages/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_(tlstripR<Rthasattrt ImportError(tmod_nameRBt repl_prefixt repl_nametrepltmod(tmsvc(s5/usr/lib/python2.7/site-packages/setuptools/monkey.pyt patch_params¢s sdistutils.msvc9compilersdistutils._msvccompilertfind_vcvarsalltquery_vcvarsallt _get_vc_envtgen_lib_options(RRtsystemt functoolstpartialRDRM(RTRGtmsvc14((RSs5/usr/lib/python2.7/site-packages/setuptools/monkey.pyR1–s&     (t__doc__R"tdistutils.filelistRRRRZt importlibRRtsetuptools.externRRt__all__R RRR6R)R*RDRR1(((s5/usr/lib/python2.7/site-packages/setuptools/monkey.pyts&          *