zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
U
G=®dã@sœdZddlZddlZddlZddlZddlZddlmZddl    Z    ddl
m Z ddl Z gZ dd„Zdd„Zd    d
„Zd d „Zd d„Zdd„Zdd„Zdd„ZdS)z
Monkey patching of distutils.
éN)Ú import_module)ÚsixcCs"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 úHD:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\setuptools/monkey.pyÚ_get_mros      r cCs0t|tjƒrtnt|tjƒr tndd„}||ƒS)NcSsdS)Nr )Úitemr r r Ú<lambda>*ózget_unpatched.<locals>.<lambda>)Ú
isinstancerÚ class_typesÚ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 Ú    <genexpr>5s þz&get_unpatched_class.<locals>.<genexpr>Ú    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_allAs*
 
 
 
þû
 
ÿ
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)Úgetattrrr4ÚsetattrrÚDistributionMetadata)ÚattrÚnew_valr r r r3hs r3cCs*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_funcos
rJcCs
t|dƒS)NrD)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_namerHZ repl_prefixZ    repl_nameÚreplÚmod©Zmsvcr r Ú patch_paramss
 
z9patch_for_msvc_specialized_compiler.<locals>.patch_paramszdistutils.msvc9compilerzdistutils._msvccompilerZfind_vcvarsallZquery_vcvarsallZ _get_vc_envZgen_lib_options)rrÚsystemÚ    functoolsÚpartialrJrQ)rVrMZmsvc14r rUr r:„s&    r:)Ú__doc__r,Údistutils.filelistrrrrXÚ    importlibrrZsetuptools.externrrÚ__all__r rrr<r3rJrr:r r r r Ú<module>s$      '